logo
enes

Text, currency and date

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: "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:

NameDescriptionTypeRequirements
typeThe value is "text".StringRequired
textText that replaces the placeholder in the component.StringRequired (max 1024 characters)
parameter_nameParameter name. Only accepted value: otp_code.StringOptional

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:

NameDescriptionTypeRequirements
typeThe value is "currency".StringRequired
currencyObject with the currency data.ObjectRequired

Fields of the currency object:

NameDescriptionTypeRequirements
fallback_valueValue used if the currency code isn't recognized.StringRequired
codeCurrency code (ISO 4217).StringRequired
amountAmount 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.NumberRequired

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:

NameDescriptionTypeRequirements
typeThe value is "date_time".StringRequired
date_timeObject with the date data.ObjectRequired

Fields of the date_time object (at least one of day_of_month, month, day_of_week, hour, year or minute must be present):

NameDescriptionTypeRequirements
fallback_valueValue used if the date isn't recognized.StringRequired
day_of_monthDay of the month.NumberOptional
day_of_weekDay of the week.StringOptional
yearYear.NumberOptional
monthMonth.NumberOptional
hourHour.NumberOptional
minuteMinute.NumberOptional

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
}
}
]
}
]
}
}


Previous
Template messages
Next
Media and location