Use Case
Brands launch bulk campaigns and broadcast messages to a large audience using either Call-to-Action (CTA) WhatsApp Ads or WhatsApp marketing templates. To enhance campaign effectiveness, generate leads, or automate workflows, businesses can integrate WhatsApp Chatbots.
The chatbot is triggered based on the specific ad or template the user responds to, ensuring a tailored experience.
WhatsApp templates allow businesses to define variables and pass dynamic values within messages. The chatbot captures these values and stores the template message along with them. These stored values can be used in subsequent chatbot interactions if required.
Implementation
WhatsApp Template Integration
When a business sends an outbound WhatsApp message, the following variables store campaign-related data:
replied_message_variableтАУ Stores mapped variablesreplied_messageтАУ Stores complete message contenttemplate_nameтАУ Name of the WhatsApp templatetemplate_languageтАУ Language of the templatecampaign_nameтАУ Name of the campaigncampaign_request_idтАУ Unique request ID for the campaignmessage_uuidтАУ Unique identifier for the messagereplied_message_typeтАУ Type of message replied totemplate_idтАУ Unique ID of the template
To display these variables in a Send a Message card, enclose them in double curly brackets ({{variable_name}}).
For script-based access, use the format:_flow_variables.replied_message_variable.
For example, if a template contains two placeholders ({{1}} and {{2}}), the bot saves the entire template in the variable replied_message. The variables within the template can be accessed using replied_message_variable.
These stored values can be further used in the bot's flow.
Click-to-WhatsApp (CTW) Ads
For Click-to-WhatsApp (CTW) Ads, the bot receives referral data, which can be retrieved and used in the same format as templates.
Example Referral Object:
"replied_message": [
{
"referral": {
"source_url": "https://fb.me/2new123",
"source_id": "123533385",
"source_type": "ad",
"body": "new hello",
"headline": "gasfgaefawf",
"media_type": "video",
"video_url": "https://www.facebook.com/",
"thumbnail_url": "url",
"ctwa_clid": "lJKVANOvL6J0FCSCEdTcA"
}
}
],
"template_name": null,
"template_language": null,
"campaign_name": null,
"campaign_request_id": null
To fetch source_url, use the following format:
_flow_variable.sourceurl = _flow_variables.replied_message.[0].referral.source_url
To display it in a Send a Message card, simply use:{{sourceurl}}