Coupon code templates
Updated: Dec 3, 2025
Coupon code templates are marketing templates that display a single copy code button. When tapped, the code is copied to the customer’customer's clipboard.
Coupon code templates are currently not supported by the WhatsApp web client.Copy code button text cannot be customized.Templates are limited to one copy code button.Creating coupon code templates
curl 'https://graph.facebook.com/<API_VERSION>/<WHATSAPP_BUSINESS_ACCOUNT_ID>/message_templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-d '
{
"name": "<TEMPLATE_NAME>",
"language": "<TEMPLATE_LANGUAGE>",
"category": "marketing",
"components": [
<!-- Only if using a header component -->
{
"type": "header",
"format": "text",
"text": "<HEADER_TEXT>"
},
{
"type": "body",
"text": "<BODY_TEXT>",
<!-- Only include if body text includes one or more parameters -->
"example": {
"body_text": [
[
"<BODY_PARAMETER_EXAMPLE_VALUE>"
<!-- Additional examples values would follow, if using multiple body parameters -->
]
]
}
},
{
"type": "buttons",
"buttons": [
<!-- Only if using a quick-reply button -->
{
"type": "quick_reply",
"text": "<QUICK_REPLY_BUTTON_LABEL_TEXT>"
},
{
"type": "copy_code",
"example": "<COPY_CODE_BUTTON_EXAMPLE_CODE>"
}
]
}
]
}'
Placeholder
|
Description
|
Example Value
|
|---|
| | |
| Optional.
API version. If omitted, defaults to the newest API version available to your app.
| |
<BODY_PARAMETER_EXAMPLE_VALUE>
String
| Required if using a body component string that includes one or more parameters.
Example parameter value. You must supply an example for each parameter defined in your body component string.
| |
| Required.
Template body text. Variables are supported.
Maximum 1024 characters.
| Shop now through the end of December and use the one-time use code {{1}} to get {{2}} off of your entire order!
|
<COPY_CODE_BUTTON_EXAMPLE_CODE>
String
| Required.
Code to be copied to device clipboard when tapped.
Maximum 20 characters.
| |
| Required if using a text header component.
Header text.
Maximum 60 characters.
| |
<QUICK_REPLY_BUTTON_LABEL_TEXT>
| Required if using a quick-reply button.
Button label text. Maximum 25 characters. Alphanumeric characters only.
| |
<TEMPLATE_LANGUAGE>
String
| | |
| Required.
Template name. Must be unique, unless existing templates with the same name have a different template language.
Maximum 512 characters. Lowercase, alphanumeric characters and underscores only.
| coupon_code_onetime_winter_2025
|
<WHATSAPP_BUSINESS_ACCOUNT_ID>
String
| Required.
WhatsApp Business Account ID.
| |
Upon success:
{
"id": "<TEMPLATE_ID>",
"status": "<TEMPLATE_STATUS>",
"category": "<TEMPLATE_CATEGORY>"
}
Placeholder
|
Description
|
Example value
|
|---|
| | |
| | |
| | |
curl 'https://graph.facebook.com/v25.0/102290129340398/message_templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
"name": "coupon_code_onetime_winter_2025",
"language": "en_US",
"category": "marketing",
"components": [
{
"type": "header",
"format": "text",
"text": "Our Winter Sale is on!"
},
{
"type": "BODY",
"text": "Shop now through the end of December and use the one-time use code {{1}} to get {{2}} off of your entire order!",
"example": {
"body_text": [
[
"fLBponPDsqF0KQThzkrf",
"30%"
]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Unsubscribe"
},
{
"type": "COPY_CODE",
"example": "fLBponPDsqF0KQThzkrf"
}
]
}
]
}'
{
"category" : "MARKETING",
"id" : "1924084211297547",
"status" : "PENDING"
}
Sending coupon code templates
curl -X POST "https://graph.facebook.com/<API_VERSION>/<BUSINESS_PHONE_NUMBER_ID>/messages" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '
{
"messaging_product": "whatsapp",
"to": "<USER_PHONE_NUMBDER>",
"type": "template",
"template": {
"name": "<TEMPLATE_NAME>",
"language": {
"code": "<TEMPLATE_LANGUAGE>"
},
"components": [
{
"type": "button",
"sub_type": "copy_code",
"index": <BUTTON_INDEX>,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "<COUPON_CODE>"
}
]
}
<!-- Additional components would follow, if templates requires them -->
]
}
}'
Placeholder
|
Description
|
Example Value
|
|---|
| | |
| Optional.
API version. If omitted, defaults to the newest API version available to your app.
| |
<BUSINESS_PHONE_NUMBER_ID>
String
| Required.
WhatsApp business phone number ID.
| |
| Required.
Indicates order in which button should appear, if the template uses multiple buttons.
Buttons are zero-indexed, so setting value to 0 will cause the button to appear first, and another button with an index of 1 will appear next, etc.
| |
| Required.
The coupon code to be copied when the customer taps the button. Only accepting alphanumeric characters.
Maximum 20 characters.
| |
| Required.
Name of the template to be sent.
| coupon_code_fall2023_25off
|
<TEMPLATE_LANGUAGE>
String
| Required.
The template’s language and locale code.
| |
<USER_PHONE_NUMBER>
String
| | |
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>",
"group_id": "<GROUP_ID>", <!-- Only included if messaging a group -->
"message_status": "<PACING_STATUS>" <!-- Only included if sending a template -->
}
]
}
Placeholder
|
Description
|
Sample Value
|
|---|
| The string identifier of a group made using the Groups API.
This field shows when messages are sent, received, or read from a group.
| Y2FwaV9ncm91cDoxNzA1NTU1MDEzOToxMjAzNjM0MDQ2OTQyMzM4MjAZD
|
| Indicates template pacing status. The message_status property is only included in responses when sending a template message that uses a template that is being paced. | wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI4MjZGRDA0OUE2OTQ3RkEyMzcA
|
<WHATSAPP_USER_PHONE_NUMBER>
String
| WhatsApp user’s WhatsApp phone number. May not match wa_id value.
| |
| WhatsApp user’s WhatsApp ID. May not match input value.
| |
<WHATSAPP_MESSAGE_ID>
String
| WhatsApp Message ID. This ID appears in associated messages webhooks, such as sent, read, and delivered webhooks.
| wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI4MjZGRDA0OUE2OTQ3RkEyMzcA
|
curl 'https://graph.facebook.com/v25.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"
}
]
}