WhatsApp Webhook
Receives delivery status callbacks from the Meta WhatsApp Cloud API.Verification (GET)
Meta requires webhook verification during setup. When you configure the webhook URL in the Meta Developer Dashboard, Meta sends a verification request.| Parameter | Description |
|---|---|
hub.mode | Must be subscribe |
hub.verify_token | Must match your WHATSAPP_WEBHOOK_VERIFY_TOKEN env var |
hub.challenge | Challenge string to echo back |
hub.challenge value as plain text (200) if token matches, or 403 if verification fails.
Status Callbacks (POST)
Meta sends delivery status updates as POST requests when message statuses change.| Meta Status | KaireonAI Status |
|---|---|
sent | delivered |
delivered | delivered |
read | opened |
failed | failed |
Signature Verification
WhatsApp webhooks are verified using HMAC-SHA256 signature verification. Meta signs every POST payload with your app secret and includes the signature in thex-hub-signature-256 header.
The platform computes the expected signature using the WHATSAPP_APP_SECRET environment variable and compares it to the header value using crypto.timingSafeEqual to prevent timing attacks. Requests with missing or invalid signatures are rejected with 401.
Environment Variables
| Variable | Required | Description |
|---|---|---|
WHATSAPP_WEBHOOK_VERIFY_TOKEN | Yes | Token for Meta webhook verification (GET requests) |
WHATSAPP_APP_SECRET | Yes | Meta app secret for HMAC-SHA256 signature verification (POST requests) |
Delivery Webhook
Universal delivery status webhook that auto-detects provider payload formats.Supported Providers
| Provider | Detection Method | Payload Format |
|---|---|---|
| AWS SES | notificationType field or SNS Type: "Notification" wrapper | SNS notification with nested JSON Message |
| SendGrid | Array payload with sg_message_id field | Array of event objects |
| Twilio | Message-SID field on the form body (see example below) | Form-style status callback |
| Standard | providerMessageId + event fields | KaireonAI native format |
X-Provider header (ses, sendgrid, twilio) to explicitly hint the format.
Twilio status-callback form body
Twilio sends delivery status as anapplication/x-www-form-urlencoded POST. The endpoint detects the format by the presence of the message-SID field (the preferred form) or its legacy alias. See the Twilio Message Status Values reference for the full list of status values. The exact wire-field names are shown in the example below:
Signature Verification
Delivery webhooks are verified using HMAC-SHA256 signature verification. Include the signature in theX-Webhook-Signature header:
WEBHOOK_SIGNING_SECRET environment variable. Requests with missing or invalid signatures are rejected with 401.
Normalized Events
All provider payloads are normalized to a standard event:| Event | Description |
|---|---|
delivered | Message was delivered to the recipient |
bounced | Message bounced or was marked as spam |
opened | Recipient opened the message |
clicked | Recipient clicked a link |
failed | Delivery failed |
Environment Variables
| Variable | Required | Description |
|---|---|---|
WEBHOOK_SIGNING_SECRET | Yes | Shared secret for HMAC-SHA256 signature verification |