Text, currency and date
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:"template"- Response: the same for every message (see response)
Text, currency and date-time parameters that are substituted in the header and body components of the template. All are sent with POST /v1/messaging; headers, common fields and the response are in HTTP connection. The general template structure (template and components objects) is in Template messages.
Text
Text parameter for the header and body components. In the parameter object, type must be "text".
Body
Fields for Text:
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | The value is "text". | String | Required |
| text | Text that replaces the placeholder in the component. | String | Required (max 1024 characters) |
| parameter_name | Parameter name. Only accepted value: otp_code. | String | Optional |
Example
Complete Text example (HTTP request and JSON body):
HTTP request with text header
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": "template","template":{"language": "es","name": "header_text","components":[{"type":"header","parameters":[{"type":"text","text":"123456"}]}]}}'
Body with text header
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "header_text","components": [{"type": "header","parameters": [{"text": "123456","type": "text"}]}]}}
HTTP request with text body
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": "template","template":{"language": "es","name": "body_text","components":[{"type":"body","parameters":[{"type":"text","text":"123456"}]}]}}'
Body with text body
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "body_text","components": [{"type": "body","parameters": [{"text": "123456","type": "text"}]}]}}
Currency
Currency parameter for the header and body components. In the parameter object, type must be "currency".
Body
Fields for Currency:
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | The value is "currency". | String | Required |
| currency | Object with the currency data. | Object | Required |
Fields of the currency object:
| Name | Description | Type | Requirements |
|---|---|---|---|
| fallback_value | Value used if the currency code isn't recognized. | String | Required |
| code | Currency code (ISO 4217). | String | Required |
| amount | Amount multiplied by 1000, as an integer (for example, 100.99 → 100990). Internally represented as a 64-bit integer, so you can send currency values beyond Integer range without truncation. | Number | Required |
Example
Complete Currency example (HTTP request and JSON body):
HTTP request with currency header
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": "template","template":{"language": "es","name": "template_utility_23","components":[{"type":"header","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 100990}}]}]}}'
Body with currency header
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "template_utility_23","components": [{"type": "header","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 100990}}]}]}}
HTTP request with currency body
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": "template","template":{"language": "es","name": "template_utility_23","components":[{"type":"body","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 100990}}]}]}}'
Body with currency body
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "template_utility_23","components": [{"type": "body","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 100990}}]}]}}
Date time
Date and time parameter for the header and body components. In the parameter object, type must be "date_time".
Body
Fields for Date time:
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | The value is "date_time". | String | Required |
| date_time | Object with the date data. | Object | Required |
Fields of the date_time object (at least one of day_of_month, month, day_of_week, hour, year or minute must be present):
| Name | Description | Type | Requirements |
|---|---|---|---|
| fallback_value | Value used if the date isn't recognized. | String | Required |
| day_of_month | Day of the month. | Number | Optional |
| day_of_week | Day of the week. | String | Optional |
| year | Year. | Number | Optional |
| month | Month. | Number | Optional |
| hour | Hour. | Number | Optional |
| minute | Minute. | Number | Optional |
Example
Complete Date time example (HTTP request and JSON body):
HTTP request with date time header
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": "template","template":{"language": "es","name": "header_date_time","components":[{"type":"header","parameters": [{"type": "date_time","date_time": {"fallback_value": "October 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}'
Body with date time header
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "header_date_time","components": [{"type": "header","parameters": [{"type": "date_time","date_time": {"fallback_value": "October 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}
HTTP request with date time body
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": "template","template":{"language": "es","name": "body_date_time","components":[{"type":"body","parameters": [{"type": "date_time","date_time": {"fallback_value": "October 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}'
Body with date time body
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "body_date_time","components": [{"type": "body","parameters": [{"type": "date_time","date_time": {"fallback_value": "October 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}
