Skip to main content
Webhooks let Zexa push delivery events to your server in real time instead of requiring you to poll the API for status updates. When a message is delivered, fails, or a recipient opts out, Zexa sends an HTTP POST request to your registered endpoint with a JSON payload describing the event. This makes it easy to keep your own database in sync with message delivery state and react to opt-outs immediately.

Supported Events

Register a Webhook

Via the Dashboard

1

Open Webhook settings

Go to Settings → Webhooks in your Zexa dashboard and click Add Webhook.
2

Enter your endpoint URL

Provide the HTTPS URL of the endpoint on your server that will receive webhook events (e.g. https://yourapp.com/webhooks/zexa). HTTP endpoints are not accepted.
3

Select events

Choose the specific events you want to subscribe to. You can subscribe to all events or a targeted subset.
4

Save and verify

Click Save. Zexa will immediately send a test event to your endpoint to verify it is reachable and returning a 2xx response.

Via the API

You can also register webhooks programmatically:

Request Parameters

string
required
The HTTPS URL of your endpoint that will receive webhook events. Must use HTTPS — plain HTTP is not accepted.
array
required
An array of event names to subscribe to. Subscribe to one or more of: message.delivered, message.failed, message.undeliverable, message.optout, campaign.sent, campaign.completed. Pass ["*"] to subscribe to all events.

Response Fields

string
The unique webhook identifier, prefixed with wh_ (e.g. wh_ghi789).
string
The registered endpoint URL.
array
The list of event names this webhook is subscribed to.
string
ISO 8601 UTC timestamp of when the webhook was registered.
Example response (201 Created):

Error Scenarios


Webhook Payload

When a subscribed event occurs, Zexa sends a POST request to your endpoint with a JSON body in the following structure:

Responding to Webhooks

Your endpoint must return a 2xx HTTP status code within 10 seconds of receiving the request. If your endpoint does not respond in time, or returns a non-2xx status, Zexa treats the delivery as failed and retries automatically up to 3 times using exponential backoff (approximately 1 minute, 5 minutes, then 30 minutes between attempts).
Acknowledge the webhook immediately by returning 200 OK as soon as you receive the request, then process the event asynchronously (e.g. via a background job or message queue). This prevents timeout failures caused by slow processing logic inside the request handler.

Verify Webhook Authenticity

Zexa signs every webhook request with an HMAC-SHA256 signature computed from the raw request body and your webhook secret. The signature is included in the X-Zexa-Signature request header. Always verify this signature before processing the payload to ensure the request genuinely originated from Zexa. You can find your webhook secret in Settings → Webhooks next to the registered endpoint.
Always verify the X-Zexa-Signature header before processing any webhook payload. Skipping signature verification makes your endpoint vulnerable to spoofed events that could trigger unintended actions in your application.