This document describes how to send an approved limited-time offer template in a template message.
Use the WhatsApp Business Phone Number > Messages endpoint to send an approved limited-time offer template in a template message.
POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<CUSTOMER_PHONE_NUMBER>", "type": "template", "template": { "name": "<TEMPLATE_NAME>", "language": { "code": "<TEMPLATE_LANGUAGE_CODE>" }, "components": [ /* Required if template uses header, otherwise omit */ { "type": "header", "parameters": [ { "type": "<HEADER_TYPE>", "<HEADER_TYPE>": { "id": "<HEADER_ASSET_ID>" } } ] }, /* Body and params required if templates uses body params, otherwise omit */ { "type": "body", "parameters": [ <BODY_VARIABLES> ] }, /* Required if template uses offer expiration details, otherwise omit */ { "type": "limited_time_offer", "parameters": [ { "type": "limited_time_offer", "limited_time_offer": { "expiration_time_ms": <EXPIRATION_TIME> } } ] }, /* Copy code button optional */ { "type": "button", "sub_type": "copy_code", "index": 0, "parameters": [ { "type": "coupon_code", "coupon_code": "<OFFER_CODE>" } ] }, /* Required */ { "type": "button", "sub_type": "url", "index": <URL_BUTTON_INDEX>, "parameters": [ { "type": "text", "text": "<URL_VARIABLE>" } ] } ] } }'
Placeholder | Description | Example Value |
---|---|---|
Array of objects | Required if template body text uses variables. Body text variable values. Define each variable as an individual object. |
|
String | Required. Phone number of customer who the template message should be sent to. |
|
Unix timestamp | Required. Offer code expiration time as a UNIX timestamp in milliseconds. |
|
Media asset ID | Required. Uploaded media asset ID. Use the /PHONE_NUMBER_ID/media endpoint to generate an ID. |
|
String | Required. Header type used by the template. Values can be |
|
String | Required if template uses a copy code button. Offer code. Maximum 15 characters. |
|
Enum | Required. The template's language and locale code. |
|
String | Required. The template's name. |
|
Integer | Required. URL button index. If the template uses a copy code button, value must be If the template does not use a copy code button, the value must be |
|
String | Required if URL uses a variable. URL variable value. No maximum but value counts against URL string maximum of 2000 characters. |
|
Example request to send a limited-time offer template that uses:
curl 'https://graph.facebook.com/v17.0/106540352242922/messages' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer EAAJB...' \ -d ' { "messaging_product": "whatsapp", "recipient_type": "individual", "to": "16505555555", "type": "template", "template": { "name": "limited_time_offer_caribbean_pkg_2023", "language": { "code": "en_US" }, "components": [ { "type": "header", "parameters": [ { "type": "image", "image": { "id": "1602186516975000" } } ] }, { "type": "body", "parameters": [ { "type": "text", "text": "Pablo" }, { "type": "text", "text": "CARIBE25" } ] }, { "type": "limited_time_offer", "parameters": [ { "type": "limited_time_offer", "limited_time_offer": { "expiration_time_ms": 1209600000 } } ] }, { "type": "button", "sub_type": "copy_code", "index": 0, "parameters": [ { "type": "coupon_code", "coupon_code": "CARIBE25" } ] }, { "type": "button", "sub_type": "url", "index": 1, "parameters": [ { "type": "text", "text": "n3mtql" } ] } ] } }'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "16505555555", "wa_id": "16505555555" } ], "messages": [ { "id": "wamid.HBgLMTY1MDUwNzY1MjAVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTcA" } ] }