Step 1: Create an Endpoint on Your Server
Your server needs an endpoint (e.g.,POST /api/webhooks/whatsapp) that can receive JSON payloads from OTP Edge.
Here is a simple example using Node.js and Express:
Step 2: Configure Webhook in OTP Edge Dashboard
- Log into your OTP Edge Dashboard.
- Go to the Webhooks settings.
- Click Add Webhook.
- Enter the public URL of the endpoint you created in Step 1 (e.g.,
https://api.yourcompany.com/webhooks/whatsapp). - Select the events you want to listen to (we recommend selecting
message.status).
Understanding Status Payloads
When a message changes state, OTP Edge will send aPOST request to your webhook with the following JSON structure:
1. Delivered Status
This means the message reached the user’s device.2. Read Status
This means the user opened the WhatsApp chat (only fires if the user has Read Receipts enabled).3. Failed Status
This means the message could not be delivered. This usually happens if the number is not registered on WhatsApp, or if it violates a Meta policy.Security & Best Practices
- Always return a
200 OKstatus code. If your server takes too long to respond or returns an error, OTP Edge will aggressively retry sending the webhook, which could overwhelm your server. - Verify Signatures. In production, you should verify the
X-OTP-Signatureheader to ensure the webhook genuinely came from OTP Edge and wasn’t spoofed. Check our Security documentation for details on verifying signatures.