logo
enes

Coupons and limited-time offers

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)

Templates with coupon codes and limited-time offers. 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.

Coupons

Button that copies a coupon code: a button component with subtype "copy_code". In the parameter object, type must be "coupon_code".

Body

Fields for Coupons:

NameDescriptionTypeRequirements
typeThe value is "button".StringRequired
subtypeThe value is "copy_code".StringRequired
indexPosition of the button at the bottom of the template message, as a zero-based index: 0 is the first button, 1 the second, and so on.IntegerRequired
parametersList of objectsRequired

Parameters object

NameDescriptionTypeRequirements
typeThe value is "coupon_code".StringRequired
coupon_codeThe coupon code that's copied when the customer taps the button.StringRequired

Example

Complete Coupons example (HTTP request and JSON body):

Coupons HTTP request

curl --location --request 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": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_cupones_products",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "button",
"subtype": "copy_code",
"index": 1,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "25OFF"
}
]
}
]
}
}'

Coupons body

{
"from": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_cupones_products",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "button",
"subtype": "copy_code",
"index": 1,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "25OFF"
}
]
}
]
}
}


Limited-time offer

Lets you display expiration dates and countdown timers for offer codes. It is sent as a limited_time_offer component, usually together with a "copy_code" button.

Body

Fields for Limited-time offer:

NameDescriptionTypeRequirements
typeThe value is "limited_time_offer".StringRequired
limited_time_offerObject that specifies the offer's expiration date.ObjectRequired

Limited_time_offer object

NameDescriptionTypeRequirements
expiration_date_timeThe exact date and time when the offer expires and is no longer available. Use the format "YYYY-MM-DD HH:mm". It is interpreted in the server's time zone. An invalid format returns error 1009.StringRequired

Example

Complete Limited-time offer example (HTTP request and JSON body):

Limited-time offer HTTP request

curl --location --request 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": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_olt_products",
"components": [
{
"type": "header",
"parameters": [
{
"link": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png",
"type": "image"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Pablo"
},
{
"type": "text",
"text": "CARIBE25"
}
]
},
{
"type": "limited_time_offer",
"parameters": [
{
"type": "limited_time_offer",
"limited_time_offer": {
"expiration_date_time": "2024-12-04 15:20"
}
}
]
},
{
"type": "button",
"subtype": "copy_code",
"index": 0,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "CARIBE25"
}
]
},
{
"type": "button",
"subtype": "url",
"index": 1,
"parameters": [
{
"type": "text",
"text": "n3mtql"
}
]
}
]
}
}'

Limited-time offer body

{
"from": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_olt_products",
"components": [
{
"type": "header",
"parameters": [
{
"link": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png",
"type": "image"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Pablo"
},
{
"type": "text",
"text": "CARIBE25"
}
]
},
{
"type": "limited_time_offer",
"parameters": [
{
"type": "limited_time_offer",
"limited_time_offer": {
"expiration_date_time": "2024-12-04 15:20"
}
}
]
},
{
"type": "button",
"subtype": "copy_code",
"index": 0,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "CARIBE25"
}
]
},
{
"type": "button",
"subtype": "url",
"index": 1,
"parameters": [
{
"type": "text",
"text": "n3mtql"
}
]
}
]
}
}


Previous
Carousel
Next
Interactive messages