When user completes the flow, a message is sent to WhatsApp chat. You will receive that message through a webhook which you normally use to process chat messages from the user. Below is the structure of flow response message webhook payload:
{ "messages": [{ "context": { "from": "16315558151", "id": "gBGGEiRVVgBPAgm7FUgc73noXjo" }, "from": "<USER_ACCOUNT_NUMBER>", "id": "<MESSAGE_ID>", "type": "interactive", "interactive": { "type": "nfm_reply", "nfm_reply": { "name": "flow", "body": "Sent", "response_json": "{\"flow_token\": \"<FLOW_TOKEN>\", \"optional_param1\": \"<value1>\", \"optional_param2\": \"<value2>\"}" } }, "timestamp": "<MESSAGE_SEND_TIMESTAMP>" }] }
Parameter | Description |
---|---|
| Context of the message that the user replied to. Context object contains message_id of flows request message and sender number. |
| User's WhatsApp account number |
| Message ID |
| Always |
| Always |
|
|
| Always |
| Flow-specific data. The structure is either defined in flow JSON (see Complete action) or, if flow is using an endpoint, controlled by endpoint (see Final Response Payload in Data Exchange Request) |
| Time of flow response message |
Subscribe to webhooks to monitor the statuses and performance of your business' Flows.
Currently, there are webhooks to monitor:
Before you can start receiving notifications you will need to create an endpoint on your server to receive notifications.
Your endpoint must be able to process two types of HTTPS requests: Verification Requests and Event Notifications. Since both requests use HTTPs, your server must have a valid TLS or SSL certificate correctly configured and installed. Self-signed certificates are not supported.
Learn more about Verifying Requests and Event Notifications
To test your Webhooks, you can create a sample app with an endpoint for receiving notifications.
Once your endpoint is ready, go to your App Dashboard. If you do not have app, create a Business Type App. In your App Dashboard, find the WhatsApp product and click Configuration. Then, find the webhooks section and select Configure a webhook. A dialog will then appear asking you for the following:
Callback URL: The URL WhatsApp will be sending the events to. This is the endpoint you have created above
Verify Token: Set up when you create your webhook endpoint
After adding the information, click Verify and Save.
Back in the App Dashboard, click WhatsApp > Configuration on the left-side panel. From there, select Webhooks > Manage. A dialog box will open with all the objects you can get notified about. To receive messages from your users, click Subscribe for Flows.
A Meta App can have only one endpoint configured. If you need to send your webhook updates to multiple endpoints, you need multiple Meta Apps.
If you are a Solution Partner, you may need to:
whatsapp_business_messaging
permission
in your App Dashboard
To get Webhook events for a specific WABA, you must explicitly subscribe to that WABA.
A combination of nested objects of JSON arrays and objects that contain information about a change.
Name | Description |
---|---|
| The webhook a business has subscribed to |
| An array of entry objects. Entry objects have the following properties:
|
Contains details for the change that triggered the webhook. This object is nested within the changes
array of the entry
array.
Name | Description |
---|---|
| ID of the flow |
| The alert threshold that was reached or recovered from |
| Type of webhook notification sent, value being one of:
|
| Detailed message describing webhook |
| Previous status of the flow, value being one of:
|
| Previous status of the flow, value being one of:
|
| Status of the alert, value being one of:
|
| Number of requests used to calculate metric |
| An array of error objects describing each error included in the alert. Error objects have the following properties:
|
| P50 latency of the endpoint requests |
| P90 latency of the endpoint requests |
| Overall error rate for the alert |
A notification is sent when the status for the flow changes, specifically when the flow is either Published
, Throttled
, Blocked
or Deprecated.
{ "entry": [ { "id": "644600416743275", "time": 1684969340, "changes": [ { "value": { "event": "FLOW_STATUS_CHANGE", "message": "Flow Webhook 3 changed status from DRAFT to PUBLISHED", "flow_id": "6627390910605886", "old_status": "DRAFT", "new_status": "PUBLISHED" }, "field": "flows" } ] } ], "object": "whatsapp_business_account" }
The notification is also sent on the flow creation event. In this case the old status value will not be set, and the new value will be Draft
as a default status.
{ "entry": [ { "id": "644600416743275", "time": 1684969340, "changes": [ { "value": { "event": "FLOW_STATUS_CHANGE", "message": "Flow Webhook 3 has been created with DRAFT status", "flow_id": "6627390910605886", "new_status": "DRAFT" }, "field": "flows" } ] } ], "object": "whatsapp_business_account" }
Client error rate is approximate as it’s not available for all the client devices and regions.
A notification is sent to you when the error rate for screen navigations on the client goes over one of the following thresholds and then again when it goes below these thresholds.
Error rate thresholds:
The detection period for these thresholds is 60 minutes, which is the period that we calculate the error rate. WhatsApp will only send a webhook if the error rate of the events in the past 60 minutes reaches any of these thresholds or goes below them.
{ "entry": [ { "id": "106181168862417", "time": 1674160476, "changes": [ { "value": { "event": "CLIENT_ERROR_RATE", "message": "The flow client request error rate has reached the 5% threshold in the last 60 minutes. A higher error rate will make it harder for users to complete the flow, resulting in drop-offs.", "flow_id": "691244242662581", "error_rate": 14.28, "threshold": 10, "alert_state": "ACTIVATED", "errors": [ { "error_type": "INVALID_SCREEN_TRANSITION", "error_rate": 66.66, "error_count": 2 }, { "error_type": "PUBLIC_KEY_MISSING", "error_rate": 33.33, "error_count": 1 }, ], }, "field": "flows" } ] } ], "object": "whatsapp_business_account" }
A notification is sent to you when the error rate for endpoint requests goes over one of the following thresholds and then again when it goes below these thresholds.
Error rate thresholds:
The detection period for these thresholds is 30 minutes, which is the period that we calculate the error rate. WhatsApp will only send a webhook if the error rate of the events in the past 30 minutes reaches any of these thresholds or goes below them.
{ "entry": [ { "id": "106181168862417", "time": 1674160476, "changes": [ { "value": { "event": "ENDPOINT_ERROR_RATE", "message": "The flow endpoint request error rate has reached the 10% threshold in the last 30 minutes. A higher error rate will make it harder for users to complete the flow, resulting in drop-offs.", "flow_id": "691244242662581", "error_rate": 14.28, "threshold": 10, "alert_state": "ACTIVATED", "errors": [ { "error_type": "CAPABILITY_ERROR", "error_rate": 66.66, "error_count": 2 }, { "error_type": "TIMEOUT", "error_rate": 33.33, "error_count": 1 }, ], }, "field": "flows" } ] } ], "object": "whatsapp_business_account" }
A notification is sent to you when the p90 latency for endpoint requests goes over one of these thresholds and then again when it goes below these thresholds.
p90 latency thresholds:
The detection period for these thresholds is 30 minutes, which is the period that we calculate the latency. WhatsApp will only send a webhook if the latency of the events in the past 30 minutes reaches any of these thresholds or goes below them.
{ "entry": [ { "id": "106181168862417", "time": 1674160476, "changes": [ { "value": { "event": "ENDPOINT_LATENCY", "message": "Flow endpoint latency has reached the p90 threshold in the last 30 minutes. High latency will increase the loading time between screens in the flow, impacting user experience.", "flow_id": "691244242662581", "p90_latency": 8000, "p50_latency": 500, "requests_count": 34, "threshold": 7000, "alert_state": "ACTIVATED", }, "field": "flows" } ] } ], "object": "whatsapp_business_account" }
A notification is sent to you when the the endpoint availability goes below 90% threshold and then again when it goes above the threshold.
The detection period for the alert is 10 minutes.
{ "entry": [ { "id": "106181168862417", "time": 1674160476, "changes": [ { "value": { "event": "ENDPOINT_AVAILABILITY", "message": "The flow endpoint availability has breached the 90% threshold in the last 10 minutes. Users will be unable to open or use the flow.", "flow_id": "12345678", "alert_state: "ACTIVATED", "availability": 75, "threshold" : 90, }, "field": "flows" } ] } ], "object": "whatsapp_business_account" }