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) andtype(details)typevalues 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:
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | The value is "button". | String | Required |
| subtype | The value is "copy_code". | String | Required |
| index | Position 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. | Integer | Required |
| parameters | List of objects | Required |
Parameters object
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | The value is "coupon_code". | String | Required |
| coupon_code | The coupon code that's copied when the customer taps the button. | String | Required |
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:
| Name | Description | Type | Requirements |
|---|---|---|---|
| type | The value is "limited_time_offer". | String | Required |
| limited_time_offer | Object that specifies the offer's expiration date. | Object | Required |
Limited_time_offer object
| Name | Description | Type | Requirements |
|---|---|---|---|
| expiration_date_time | The 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. | String | Required |
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"}]}]}}
