Register an endpoint
Use an administrator session, the account token, or an API key holdingwebhooks:manage:
- Each account can hold up to 16 endpoints (active and disabled combined). Endpoints are enabled by default unless created with
"enabled": false. - Use
GET,PATCH, andDELETE /admin/webhooks/{webhook_id}to inspect, update, or remove an endpoint. - Use
POST /admin/webhooks/{webhook_id}/rotate_secret(with a freshIdempotency-Key) to generate a replacement signing secret once. - Changing the URL, disabling, rotating the secret, or deleting an endpoint cancels pending retry attempts for its previous configuration. A request already in flight may still arrive.
Event types
Every event uses the same envelope:
data is a snapshot captured at the transition. Because pricing can settle later, fetch the resource when you need its latest state. For a number’s live capabilities, prices, and campaign status, call GET /numbers/{phone_number}.
Verify the signature
Every delivery includes two headers:
The signature is
HMAC-SHA256(secret_utf8, "<timestamp>." + raw_body_bytes). Verify before parsing JSON:
- Require exactly one
X-Sendblue-Signatureheader. - Read the exact raw request bytes before any JSON parser touches them.
- Reject timestamps more than 5 minutes (300 seconds) from your clock.
- Compute the HMAC and compare digests in constant time.
Handle deliveries reliably
Respond with any2xx status as soon as you durably store the event. Design your receiver for:
- Duplicates: retries carry a fresh timestamp, the same event
id, and the same delivery ID. Store the eventidin the same transaction as your state change and ignore IDs you have already processed. - Reordering: events can arrive out of transition order.
- Timeouts: a delivery can time out after your handler has already applied the change and will then be retried.
Retries, delivery log, and replay
- Retry schedule: network failures and HTTP
408,425,429, or5xxresponses are retried up to 6 attempts with waits of1 min,5 min,30 min,2 hr, and8 hr. Any other non-2xxresponse stops retries. - 30-day delivery log:
GET /admin/webhooks/{webhook_id}/deliverieslists delivery metadata (IDs, event type, status, attempt count, HTTP status, timestamps) for 30 days. No message or response bodies are stored there. - 7-day replay: event bodies are retained for 7 days. Within that window,
POST /admin/webhooks/{webhook_id}/deliveries/{delivery_id}/replay(with a newIdempotency-Key) re-sends the original eventidand snapshot to the endpoint’s current configuration under a new delivery ID. - Erasure: redacting or deleting a message — or deleting one of its media attachments — removes its stored event snapshots from future delivery and replay.
Per-message
status_callback URLs and call/TwiML callback URLs are a separate mechanism. They send Twilio-compatible form parameters signed with X-Twilio-Signature, not the signed JSON described here. Webhook endpoints receive their events independently.