- Automated customer support
- WhatsApp chatbots
- Real-time notifications
- Order and delivery workflows
- Customer communication systems
- Message synchronization
- Delivery tracking
- WhatsApp automation
- CRM integrations
- Custom backend workflows
How WhatsApp Webhooks Work
The Antryk webhook workflow consists of four main steps:- Create or connect a WhatsApp Business service in Antryk.
- Configure your application’s webhook endpoint as the Callback URL.
- Add a Signing Secret to securely authenticate webhook requests.
- Receive and process WhatsApp events in your backend.
POST request to your configured Callback URL.
Configure WhatsApp Webhook
To configure a webhook, first open the WhatsApp service you want to configure.Setup Steps
- Open the WhatsApp Services section in your Antryk dashboard.
- Select the WhatsApp Business service you want to configure.
- Open the Overview page.
- Click the Webhook button.
- Enter your application’s Callback URL.
- Configure a Signing Secret.
- Review the sample payload.
- Click Send Test Event to verify connectivity.
- Click Save Configuration.
WhatsApp Webhook Configuration
The WhatsApp webhook configuration drawer contains the settings required to connect your Antryk WhatsApp service to your backend application.Callback URL
The Callback URL is the public API endpoint where Antryk sends WhatsApp webhook events. For example:https://api.example.com/webhooks/whatsapp
Your backend should expose this endpoint and accept HTTP POST requests.
The endpoint should be publicly reachable by Antryk and should be capable of receiving JSON request bodies.
Signing Secret
The Signing Secret is a private secret used to verify that webhook requests were sent by Antryk. You should store this secret securely in your backend environment rather than hard-coding it directly into your application source code. For example:WHATSAPP_WEBHOOK_SECRET=your_callback_secret
Security: Never expose your webhook signing secret in frontend code, public repositories, client-side applications, or browser-accessible configuration.
Sample Payload
The webhook configuration drawer provides a sample payload that will be used in sending test event to check connectivity of entered callback URL.Webhook Configuration Actions
- Cancel — Close the webhook configuration drawer without saving changes.
- Send Test Event — Send a sample webhook request to your Callback URL.
- Save Configuration — Save the Callback URL and Signing Secret.
Building Your Webhook Endpoint
The Callback URL you configure in Antryk must point to a backend route in your application. For example, if you configure:https://api.example.com/webhooks/whatsapp
your backend should have a corresponding route:
POST /webhooks/whatsapp
Antryk will send the WhatsApp event as a JSON request body.
Your backend should:
- Receive the POST request.
- Read the
X-Webhook-Signatureheader. - Retrieve the signing secret from your environment variables.
- Calculate the expected signature.
- Compare the received signature with the calculated signature.
- Reject the request if the signature is invalid.
- Process the webhook event.
- Return a successful HTTP 2xx response.
Webhook Signature Verification
Every webhook request contains the following HTTP header:X-Webhook-Signature
The header contains a SHA-256 HMAC signature generated using the Signing Secret configured for your WhatsApp service.
The signature format is:
sha256=<signature>
Your backend should calculate the expected signature using the raw request payload and your webhook secret.
Signature Verification Flow
Important: The webhook secret should be stored as an environment variable or another secure server-side secret store. Do not hard-code production secrets in your source code.
JavaScript Signature Verification
The following example demonstrates how to verify an Antryk webhook request using Node.js and JavaScript.JavaScript Environment Variable
Store the Signing Secret in your server environment:Python Signature Verification
The following example demonstrates webhook signature verification using Python.Python Environment Variable
Store your webhook Signing Secret as an environment variable:Webhook Response Status Codes
Your webhook endpoint should return an HTTP status code indicating whether the request was successfully received and processed.Successful Responses
Return a 2xx response when the webhook has been accepted. For example:HTTP/1.1 200 OK
A successful response tells Antryk that your endpoint received the webhook successfully.
Invalid Signature
If theX-Webhook-Signature does not match the signature calculated using your configured secret, reject the request.
For example:
HTTP/1.1 401 Unauthorized
Example response:
Invalid signature
Other Failed Requests
If your endpoint returns an error or cannot be reached, Antryk may retry webhook delivery. Common failure scenarios include:- 401 — Invalid webhook signature.
- 4xx — Invalid or rejected request.
- 5xx — Server-side processing error.
- Timeout — Your endpoint did not respond within the expected time.
- Connection failure — Your endpoint could not be reached.
Recommended Webhook Response Flow
A recommended webhook handler follows this pattern:WhatsApp Webhook Events
When your account receives WhatsApp activity, Antryk forwards a clean, normalized payload to your configured Callback URL using an HTTP POST request. All webhook requests are signed using your configured Signing Secret. Your backend should verify the signature before processing the event.Event Types Overview
1. message — Incoming Customer Message
The message event is fired when a customer sends a message to your WhatsApp Business number.
Field Notes
from— Customer’s phone number.to— Your business WhatsApp number.messageType— Message type such as text, image, audio, video, document, or template.body— Message text or media caption.mediaUrl— URL of the resolved media file. This can temporarily be null immediately after receiving the message while media is being resolved.
2. message_echo — Message Sent From the App
The message_echo event is fired when someone from your team sends a message directly from the connected WhatsApp Business app rather than through the Antryk API.
This keeps your records synchronized with messages manually sent by your staff.
Field Notes
from— Your business WhatsApp number because the message was sent by your team.to— The customer who received the message.- The remaining fields follow the same structure as an incoming message.
- If the message was originally sent through the Antryk Send Message API, a duplicate
message_echoevent is not generated because messages are deduplicated usingwaMessageId.
3. message_edited — App Message Edited
The message_edited event is fired when your staff edits a message previously sent from the WhatsApp Business app.
Field Notes
waMessageIdrefers to the original WhatsApp message. Use it to locate and update the corresponding message.bodycontains the newly edited content.- For media messages, only the caption can be edited. The attached media file remains unchanged.
mediaUrltherefore remains the same as the original message.- The corresponding message record is updated to edited on the Antryk side.
4. message_revoked — App Message Deleted
The message_revoked event is fired when your staff deletes a message previously sent from the WhatsApp Business app.
Field Notes
waMessageIdidentifies the message that was deleted.bodycontains the last known content before the message was deleted.- If the message was previously edited, the
bodyrepresents the latest known content. - The corresponding Antryk message record is marked with the status revoked.
5. message_status — Delivery Status Change
The message_status event is fired when a message sent through the API or WhatsApp Business app changes its delivery state.
Supported Status Values
sentdeliveredreadfailed
sent → delivered → read
Each status transition can result in a separate webhook request.
Failed messages may include additional error information in the Antryk dashboard and logs.
Common Webhook Fields Reference
Webhook Retry & Delivery Behavior
Antryk automatically retries webhook delivery when your callback endpoint fails. For reliable webhook processing:- Return a 2xx response quickly.
- Keep webhook processing asynchronous where possible.
- Avoid long-running operations inside the webhook request.
- Make your webhook handler idempotent.
- Use
waMessageIdto identify and deduplicate WhatsApp messages. - Monitor failed webhook requests from the Webhook Audit Logs.
Webhook Security Best Practices
Webhook endpoints should be treated as public-facing API endpoints. Follow these security practices:- Keep your Signing Secret private.
- Store the secret in environment variables or a secure secrets manager.
- Never expose the secret in frontend code.
- Always validate the
X-Webhook-Signatureheader. - Reject requests with invalid signatures.
- Use HTTPS for your Callback URL.
- Return a 401 response when signature verification fails.
- Use
waMessageIdto prevent duplicate message processing. - Keep webhook processing fast and asynchronous where possible.
- Monitor webhook failures through Antryk Webhook Audit Logs.
- HTTP status codes
- Request attempts
- Target URL
- Request payload
- Authentication errors
- Server errors
- Connection failures
Troubleshooting Webhook Issues
Webhook returns 401
A 401 response usually indicates that signature verification failed. Check:- The Signing Secret in your environment matches the Antryk dashboard configuration.
- Your backend is reading the
X-Webhook-Signatureheader correctly. - Your HMAC algorithm is SHA-256.
- The
sha256=prefix is included in the comparison. - The payload used for signature calculation matches the request payload.
Webhook requests are repeated
Repeated webhook requests can occur when Antryk does not receive a successful response from your endpoint. Check:- Your endpoint returns a 2xx response.
- Your server responds quickly.
- Your endpoint is publicly reachable.
- Your webhook handler does not take too long to process events.
waMessageId where applicable to prevent duplicate processing.
Webhook endpoint is not receiving requests
Check:- The Callback URL is correct.
- The URL uses HTTPS.
- Your server is publicly accessible.
- Your route accepts POST requests.
- Your firewall or reverse proxy allows the request.
- Your server is returning a response.
- The Send Test Event feature works correctly.
Webhook Audit Logs
Antryk provides Webhook Audit Logs to help developers monitor webhook delivery and troubleshoot integration issues. The audit log provides visibility into webhook delivery attempts made by Antryk.Webhook Log Information
Webhook Log Details
Clicking a webhook audit log opens a detail drawer containing additional information about the delivery attempt. Log details can include:- Event information
- Delivery status
- Attempt information
- Target URL
- Request payload
- Response information
- Debugging details

