telnyx-signature-ed25519 and telnyx-timestamp request headers. The SDK’s
webhook helper verifies the signature against your account’s public key and
parses the payload into a typed event.
Webhook verification needs the optional webhooks extra:
TELNYX_PUBLIC_KEY — the client reads it automatically, the same way it reads
TELNYX_API_KEY:
Verify and parse an event
Pass the raw request body and the request headers toclient.webhooks.unwrap().
Verification needs the exact bytes Telnyx sent, so read the body directly rather
than re-serializing parsed JSON:
unwrap() raises when the signature does not match, and returns the parsed
event as a typed union of every webhook event the API sends — check
event.data.event_type to handle specific events.
Skipping verification
client.webhooks.unsafe_unwrap(payload) parses a payload without checking the
signature. Only use it for payloads you have already verified by other means,
or in tests.
Related
- Receiving webhooks covers delivery, retries, and failover URLs.
- Errors, retries, and timeouts covers the SDK’s exception hierarchy.