POST to every subscribed webhook, so you can react without polling. Each webhook has a url, a list of enabled_events, and a signing secret returned once at creation.
Events
"*"subscribes to thesession.status_updatedfirehose.- Each subscribed type is delivered separately: with both
session.status_updatedandsession.failed, a failure sends two deliveries. - List the types programmatically with List event types.
Delivery payload
All event types share this shape:Delivery payload
created_at is when the status changed (UTC, RFC 3339, milliseconds). status is any session state. previous_status is null when unknown.
Verifying deliveries
Always verify before trusting a delivery. The SDK helper checks the signature, rejects deliveries older than 5 minutes (tune with
tolerance_s / toleranceS), and parses the event. On failure it raises WebhookVerificationError. Respond with 400.
HMAC-SHA256(secret, "{timestamp}." + raw_body), hex-encode it, prefix sha256=, compare it to X-H-Webhook-Signature in constant time, and reject timestamps more than a few minutes old.
Delivery semantics
Deliveries are at-least-once, with a 10-second timeout per attempt. An unreachable endpoint or a non-2xx response is retried with increasing backoff, up to 8 attempts over about 24 hours, then the event is dropped. So:- Deduplicate. The event
idandX-H-Webhook-Deliveryare stable across retries. - Ignore arrival order. A retried old event can land after a newer one. Trust
status,previous_status, andcreated_at. - Return 2xx fast. Do slow work after responding.
- Treat it as a trigger. Fetch the authoritative state with Get session status.
last_delivery_status, last_delivery_error, last_delivery_at, last_success_at, consecutive_failures), so you can check its health without reading receiver logs.
Testing an endpoint
Ping sends a signedping event through the real delivery path and returns your endpoint’s response synchronously. Use it to check the URL, signature verification, and connectivity.
Rotating the secret
Rotate returns a new secret, and deliveries are signed with it from then on. The verify helpers accept a list of secrets for the switch:- Pass
["whsec_old", "whsec_new"]to the verify helper as soon as you have the new secret. Deliveries rejected in between are retried. - Once deliveries verify against the new secret, remove the old one.
Constraints
- Target URLs must be
https://and resolve to a public address. AHEADrequest checks reachability when you register or change the URL. Deliveries to private or internal hosts fail and count as failed attempts. - The
secretis returned only by Create and Rotate. - Up to 10 webhooks per organization.
- A
disabledwebhook stays registered but receives nothing. - After 50 consecutive failed attempts, a webhook is disabled. Fix the receiver, then re-enable it with Update (
{"disabled": false}).