How to pass custom reference id in the WhatsApp Send Message API Call and get it in Webhooks Data ?
To pass a custom reference ID in the WhatsApp Send Message API and retrieve it via webhooks, follow this step-by-step guide based on the video content.
Setting Up the API and Webhook
Set up your WhatsApp API according to the documentation and ensure you have a template message approved.
Configure a webhook endpoint (such as using a webhook site URL) to receive status updates—like sent, delivered, read, or failed notifications—from WhatsApp.
Modifying the Template Message Body
When preparing the message payload, add your custom reference ID using the parameter bis_opaque_callback_data.
Insert this parameter just above the last curly bracket in your JSON request body.
For example, if using sample JSON from the documentation, add a comma and then the bis_opaque_callback_data parameter immediately before the final closing brace.
The value for bis_opaque_callback_data can be up to 200 characters in length, allowing you to set a unique reference ID for tracking the message.
Sending the Message
Send the message via the API; you’ll receive a Queue ID in the response that confirms the message has been queued for sending.
The webhook will then receive updates for this message under the configured endpoint, including detailed status information.
Retrieving the Reference ID in Webhooks
Each status update (sent, delivered, read, failed, etc.) sent to your webhook will include both the WhatsApp message ID and your supplied bis_opaque_callback_data as part of the payload.
This allows you to track messages end-to-end using your custom reference ID, making integration with CRMs and other systems straightforward.
Important Points
The bis_opaque_callback_data parameter name is fixed by Meta (WhatsApp) and cannot be changed.
You can use this for passing any variable data, such as customer IDs or campaign IDs, for later correlation.
All message statuses (success and failure) will propagate this reference ID to your webhook, ensuring reliable tracking.
This method streamlines tracking custom references for WhatsApp messaging automation and CRM integration.
Remember to Add Comma above this for a valid json.
"biz_opaque_callback_data": "my+own+reference+id-123456"
Last updated
Was this helpful?