Fetch the complete documentation index at: https://docs.wazapin.id/llms.txtFollow this step-by-step guide to receive your first WhatsApp webhook event.
Step 1: Prerequisites
Before receiving events, ensure you have:- A connected WhatsApp number: Either an official WABA or unofficial channel. See Connect your number.
- An active API Key: For managing webhook settings programmatically (if needed). See API keys.
- An HTTPS endpoint: A publicly accessible URL on your server that can receive HTTP
POSTrequests. For local development, use tools like Ngrok or Localtunnel to expose your local port.
Step 2: Configure your webhook endpoint
You can configure endpoints through the Wazapin Dashboard under Settings → Developer → Webhooks, or programmatically using the API:| Action | Method and path | Description |
|---|---|---|
| Create endpoint | POST /v1/settings/developer/webhooks/endpoints | Register a new webhook listener URL. |
| List settings | GET /v1/settings/developer/webhooks | List registered endpoints and active subscriptions. |
| Update endpoint | PATCH /v1/settings/developer/webhooks/endpoints/{endpointID} | Edit URL or subscribed event types. |
| Delete endpoint | DELETE /v1/settings/developer/webhooks/endpoints/{endpointID} | Remove an endpoint. |
Step 3: Verify signatures
Every webhook delivery is signed using an endpoint signing secret (formatted aswhsec_...). To protect your server from unauthorized requests, you must verify the signature headers before parsing the JSON body.
Look for the following headers on each delivery:
svix-idorwebhook-idsvix-timestamporwebhook-timestampsvix-signatureorwebhook-signature
Step 4: Route by event type
Once verified, check the event type of the delivery. Subscribed events are delivered as flat JSON objects. Route them in your application logic based on themsg_type or event name:
| Event type | Description | Task guide |
|---|---|---|
message.new (msg_type: text) | User sent a text reply. | Handle inbound text |
message.new (msg_type: image, video, audio, document, sticker) | User sent a photo, voice note, document, etc. | Handle inbound media |
message.new (msg_type: interactive) | User replied to a quick-reply button or list menu. | Handle interactive replies |
message.status_update | A message transitioned to sent, delivered, read, or failed. | Handle delivery status |
Step 5: Handle idempotency
Network retries can cause your server to receive the same webhook event more than once.- Extract the
svix-id(orwebhook-id) header from the request. - Store processed event IDs in your database or cache (e.g., Redis).
- If a request arrives with an ID you have already processed, return a
200 OKresponse immediately and skip processing.
Step 6: Next steps
- View sample JSON payloads for every event type in Webhook payload examples.
- Implement a robust, production-ready webhook receiver using the Example: handle webhook events recipe.