Follow this pattern when your server receives WhatsApp events from Wazapin.
1

Verify signature

Validate incoming signature on the raw body bytes before processing to secure your endpoint. See Webhook signature verification.
2

Parse and validate payload

Convert the verified raw payload to JSON and check the event direction (direction: "inbound" vs direction: "outbound").
3

Deduplicate events

Use the svix-id (or webhook-id) HTTP header as an idempotency key. Check your database/cache to ensure you have not processed this event ID before.
4

Acknowledge quickly

Return a 200 OK response to Wazapin within 3 seconds to prevent delivery retries. Queue the event payload for asynchronous processing.
5

Process asynchronously

Inspect msg_type or event types and dispatch to the correct task handler (text, media, interactive buttons, or delivery receipts).

Code example

Here is a template to receive, verify, and route webhook events:

Route guides

Once your skeleton handler is set up, implement the business logic using these detailed guides: