WhatsApp users may be hesitant to tap raw URLs containing lengthy or obscure strings in text messages. In these situations, you may wish to send an interactive call-to-action (CTA) URL button message instead. CTA URL button messages allow you to map any URL to a button so you don't have to include the raw URL in the message body.
Endpoint: POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
curl 'https://graph.facebook.com/<API_VERSION>/<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -d ' { "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<WHATSAPP_USER_PHONE_NUMBER>", "type": "interactive", "interactive": { "type": "cta_url", <!-- If using document header, otherwise omit --> "header": { "type": "document", "document": { "link": "<ASSET_URL>" } }, <!-- If using image header, otherwise omit --> "header": { "type": "image", "image": { "link": "<ASSET_URL>" } }, <!-- If using text header, otherwise omit --> "header": { "type": "text", "text": "<HEADER_TEXT>" } }, <!-- If using video header, otherwise omit --> "header": { "type": "video", "video": { "link": "<ASSET_URL>" } }, "body": { "text": "<BODY_TEXT>" }, "action": { "name": "cta_url", "parameters": { "display_text": "<BUTTON_LABEL_TEXT>", "url": "<BUTTON_URL>" } }, <!-- If using footer text, otherwise omit --> "footer": { "text": "<FOOTER_TEXT>" } } }'
Placeholder | Description | Example Value |
---|---|---|
String | Required. |
|
String | Optional. Graph API version. | v23.0 |
String | Required if using a header with a media asset. Asset URL on a public server. |
|
String | Required. Body text. URLs are automatically hyperlinked. Maximum 1024 characters. |
|
String | Required. Button label text. Must be unique if using multiple buttons. Maximum 20 characters. |
|
| Required. URL to load in the device's default web browser when tapped by the WhatsApp user. |
|
String | Required if using a footer. Footer text. URLs are automatically hyperlinked. Maximum 60 characters. |
|
String | Required if using a text header. Header text. Maximum 60 characters. |
|
String | Required. WhatsApp business phone number ID. |
|
String | Required. WhatsApp user phone number. |
|
curl 'https://graph.facebook.com/v23.0
/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "+16505551234",
"type": "interactive",
"interactive": {
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "https://www.luckyshrub.com/assets/lucky-shrub-banner-logo-v1.png"
}
},
"body": {
"text": "Tap the button below to see available dates."
},
"action": {
"name": "cta_url",
"parameters": {
"display_text": "See Dates",
"url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
}
},
"footer": {
"text": "Dates subject to change."
}
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "+16505551234", "wa_id": "16505551234" } ], "messages": [ { "id": "wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI1RjQyNUE3NEYxMzAzMzQ5MkEA" } ] }