logo
enes

Call to action (URL)

Last update: 6 hours ago by Irais Aguirre

Integration summary

  • Endpoint: POST https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging
  • Token: messaging token, in the Authorization: Bearer {{wa-msg-api-token}} header (how to generate it)
  • Common fields: from, to (phone number or BSUID) and type (details)
  • type values on this page: "interactive"
  • Response: the same for every message (see response)

Messages with a button that opens a URL. They let you send users to a website without showing the full URL in the message text. They are sent with POST /v1/messaging; headers, common fields and the response are in HTTP connection.

Call to action (URL)

The type field must be "interactive" and the message content is sent in the call_to_action_url object. See the general structure of interactive messages.

Body

Fields for Call to action (URL):

NameDescriptionTypeRequirements
call_to_action_urlObject for sending a message with a button that opens a URL.ObjectRequired if you're sending a call to action (URL) message.

Call to action url object

NameDescriptionTypeRequirements
headerTextHeader text.StringOptional.
headerImageHeader image.ObjectOptional.
headerVideoHeader video.ObjectOptional.
headerDocumentHeader document.ObjectOptional.
bodyThe message text, which can include formatting and URLs.StringRequired.
footerThe message footer.StringOptional.
actionObject containing the button data.ObjectRequired.

You can use only one media header per message. If you send more than one, the header is chosen in this order of priority: headerDocument, headerImage, headerVideo.

HeaderImage object (CTA)
NameDescriptionTypeRequirements
linkImage URL.Stringlink or media_id required (one of them).
media_idWhatsApp media resource ID.Stringlink or media_id required (one of them).
HeaderVideo object (CTA)
NameDescriptionTypeRequirements
linkVideo URL.Stringlink or media_id required (one of them).
media_idWhatsApp media resource ID.Stringlink or media_id required (one of them).
HeaderDocument object (CTA)
NameDescriptionTypeRequirements
linkDocument URL.Stringlink or media_id required (one of them).
media_idWhatsApp media resource ID.Stringlink or media_id required (one of them).
fileNameFile name.StringOptional

Action URL object

NameDescriptionTypeRequirements
parametersObject with the button text and URL.ObjectRequired.

Parameters URL object

NameDescriptionTypeRequirements
display_textText shown on the button.StringRequired.
urlURL opened when the button is tapped.StringRequired.

Example

Complete Call to action (URL) example (HTTP request and JSON body):

Call to action HTTP request

curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
-H 'Authorization: Bearer {{wa-msg-api-token}}' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215500000001",
"to": "5215500000002",
"type": "interactive",
"call_to_action_url": {
"headerImage": {
"link": "https://www.ejemplo.com/ejemplo_imagen.jpg"
},
"body": "Check your order status on our website.",
"footer": "Thanks for your purchase",
"action": {
"parameters": {
"display_text": "View order",
"url": "https://www.ejemplo.com/pedidos/12345"
}
}
}
}'

Call to action body

{
"from": "5215500000001",
"to": "5215500000002",
"type": "interactive",
"call_to_action_url": {
"headerImage": {
"link": "https://www.ejemplo.com/ejemplo_imagen.jpg"
},
"body": "Check your order status on our website.",
"footer": "Thanks for your purchase",
"action": {
"parameters": {
"display_text": "View order",
"url": "https://www.ejemplo.com/pedidos/12345"
}
}
}
}


Previous
Reply buttons
Next
Contact information request