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) andtype(details)typevalues 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):
| Name | Description | Type | Requirements |
|---|---|---|---|
| call_to_action_url | Object for sending a message with a button that opens a URL. | Object | Required if you're sending a call to action (URL) message. |
Call to action url object
| Name | Description | Type | Requirements |
|---|---|---|---|
| headerText | Header text. | String | Optional. |
| headerImage | Header image. | Object | Optional. |
| headerVideo | Header video. | Object | Optional. |
| headerDocument | Header document. | Object | Optional. |
| body | The message text, which can include formatting and URLs. | String | Required. |
| footer | The message footer. | String | Optional. |
| action | Object containing the button data. | Object | Required. |
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)
| Name | Description | Type | Requirements |
|---|---|---|---|
| link | Image URL. | String | link or media_id required (one of them). |
| media_id | WhatsApp media resource ID. | String | link or media_id required (one of them). |
HeaderVideo object (CTA)
| Name | Description | Type | Requirements |
|---|---|---|---|
| link | Video URL. | String | link or media_id required (one of them). |
| media_id | WhatsApp media resource ID. | String | link or media_id required (one of them). |
HeaderDocument object (CTA)
| Name | Description | Type | Requirements |
|---|---|---|---|
| link | Document URL. | String | link or media_id required (one of them). |
| media_id | WhatsApp media resource ID. | String | link or media_id required (one of them). |
| fileName | File name. | String | Optional |
Action URL object
| Name | Description | Type | Requirements |
|---|---|---|---|
| parameters | Object with the button text and URL. | Object | Required. |
Parameters URL object
| Name | Description | Type | Requirements |
|---|---|---|---|
| display_text | Text shown on the button. | String | Required. |
| url | URL opened when the button is tapped. | String | Required. |
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"}}}}
