Prerequisites
Before starting, you must:- Connect a WhatsApp channel and set up an HTTPS webhook endpoint. See Webhooks overview.
- Configure your webhook to subscribe to the
message.newevent. - Have your Endpoint Signing Secret (e.g.,
whsec_abc123...) and your API Key ready.
Processing flow
Handling an inbound message involves three primary steps:1. Verify the signature
To secure your endpoint, check the signature headers (svix-signature, svix-timestamp, svix-id) using your signing secret. See Webhook signature verification for helper libraries.
2. Parse the payload
Verify that the message is incoming (direction: "inbound") and of type text (msg_type: "text").
Here is the JSON body payload for an inbound text event:
Inbound text payload
3. Fetch the message content
Inbound webhooks are lightweight notifications and do not contain the text message body directly. Use themessage_id from the payload to query the GET /v1/messages/ endpoint to retrieve the text content.
Code example
Here is how to handle the webhook and fetch the message body:Troubleshooting
Why is the message body missing from the webhook?
Wazapin sends lightweight webhooks to reduce payload size and latency. You must make a follow-upGET /v1/messages/{messageID} call to read the text body.
Duplicate message deliveries
Wazapin uses at-least-once delivery for webhooks. If your server is slow to respond (takes more than 3 seconds) or returns a non-2xx status, Wazapin will retry sending the event. Always acknowledge the request with200 OK immediately, and process the event body asynchronously.
Missing from_phone
The from_phone field is always populated in international format (e.g., 6281234567890) for inbound messages. If you receive an event without from_phone, check if the direction is set to outbound (sent message status echo).