Text messages
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:"text"- Response: the same for every message (see response)
Free-form text messages, with or without a URL preview. All are sent with POST /v1/messaging; headers, common fields and the response are in HTTP connection.
Text
Sends a text message. The type field must be "text".
Body
Fields for Text, in addition to the common fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| text | Message text. | String |
|
Example
Complete Text example (HTTP request and JSON body):
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": "text","text": "~Strikethrough text~ \n _Italic text_ \n *Bold text* \n Emojis ๐"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "text","text": "~Strikethrough text~ \n _Italic text_ \n *Bold text* \n Emojis ๐"}
Text with URL preview
Sends a text message with a preview of the URL it contains. The type field must be "text".
Body
Fields for Text with URL preview, in addition to the common fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| text | Message text. | String |
|
| preview_url | true to show a preview of the first URL in text. Default false. | Boolean | Optional. |
Example
Complete Text with URL preview example (HTTP request and JSON body):
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": "text","text": "https://www.ejemplo.com","preview_url": true}'
Body
{"from": "5215500000001","to": "5215500000002","type": "text","text": "https://www.ejemplo.com","preview_url": true}
Text with BSUID
Send the message to the user's BSUID in the to field. See Usernames and BSUID.
Uses the same fields as Text; the type field must be "text".
Example
Complete Text with BSUID example (HTTP request and JSON body):
HTTP request
curl --location '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": "US.13491208655302741918","type": "text","text": "Hello"}'
