Overview
Rewrite sends webhook deliveries as HTTPSPOST requests with a JSON body.
Current public event families are:
sms.otpmessage.sentmessage.batchmessage.queuedmessage.failedmessage.canceledmessage.deliveredmessage.receivedmessage.scheduled
Registering a webhook
You can create webhooks in the dashboard or throughPOST /webhooks.
Example create request:
Delivery request shape
Rewrite currently sends:Content-Type: application/jsonUser-Agent: rewrite-webhooks/1.0svix-idsvix-timestampsvix-signature
data.contactanddata.contactIdare always present. They becomenullwhen the original send did not target a saved contact.sandboxon the event envelope indicates the originating project mode.data.sandboxrepeats that signal inside message payloads.- Webhook resource reads return
retriesandtimeoutat the top level, while create/update requests accept them insidedelivery.
Signature validation
Validate webhook signatures before trusting the body. Important implementation details:- Use the raw request body.
- Read
svix-id,svix-timestamp, andsvix-signaturefrom headers. - Verify against the webhook secret returned by
POST /webhooksorGET /webhooks/{id}.
Handler guidance
- Return any
2xxresponse quickly. - Process heavy work asynchronously.
- Deduplicate by webhook event id.
- Persist the raw payload for debugging and replays.