This document explains how to send approved coupon code templates in a template message.
Use the WhatsApp Business Phone Number > Messages endpoint to send an approved coupon template in a template message.
POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
{ "messaging_product": "whatsapp", "to": "<TO>", "type": "template", "template": { "name": "<NAME>", "language": { "code": "<CODE>" }, "components": [ ... // Additional components, if using { "type": "button", "sub_type": "COPY_CODE", "index": <INDEX>, "parameters": [ { "type": "coupon_code", "coupon_code": "<COUPON_CODE>" } ] } ] } }
Placeholder | Description | Example Value |
---|---|---|
String | Required. The WhatsApp ID or phone number of the customer to send the message to. See Phone Number Formats. |
|
String | Required. Name of the template to be sent. |
|
String | Required. The template's language and locale code. |
|
Integer | Required. Indicates order in which button should appear, if the template uses multiple buttons. Buttons are zero-indexed, so setting value to |
|
String | Required. The coupon code to be copied when the customer taps the button. Only accepting alphanumeric characters. |
|
Upon success the API will respond with:
{ "messaging_product": "whatsapp", "contacts": [ { "input": "<WHATSAPP_USER_PHONE_NUMBER>", "wa_id": "<WHATSAPP_USER_ID>" } ], "messages": [ { "id": "<WHATSAPP_MESSAGE_ID>", "message_status": "<PACING_STATUS>" } ] }
Placeholder | Description | Sample Value |
---|---|---|
String | WhatsApp user's WhatsApp phone number. May not match |
|
String | WhatsApp user's WhatsApp ID. May not match |
|
String | WhatsApp Message ID. This ID appears in associated messages webhooks, such as sent, read, and delivered webhooks. |
|
String | Indicates template pacing status. The |
|
curl 'https://graph.facebook.com/v21.0
/106540352242922/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"messaging_product": "whatsapp",
"to": "16505551234",
"type": "template",
"template": {
"name": "coupon_code_fall2023_25off",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "button",
"sub_type": "COPY_CODE",
"index": 1,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "25OFF"
}
]
}
]
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "16505551234", "wa_id": "16505551234" } ], "messages": [ { "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBIxRjk1REYzMDBERDE3RUI0RDYA" } ] }