Skip to content

Coupon code templates

Updated: May 28, 2026

Coupon code templates are marketing templates that display a single copy code button. When the app user taps the button, WhatsApp copies the coupon code to the clipboard.

A coupon code template message in WhatsApp with annotations showing the body text, coupon_code, and discount parameters, copy code button, and quick reply button

Limitations

  • 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.

To create and send a coupon code template, follow these steps:

Properties set at creation vs. send

Some properties are defined when you create the template, while others are provided when you send it. Some properties span both steps.

Creation only:

  • Header text
  • Body text (with parameter placeholders)
  • Quick reply button label
  • Copy code button example code

Send only:

  • Body parameter values (coupon_code, discount)
  • Coupon code (copy code button value)

Both creation and send:

  • Template name, language (referenced at both steps)

Step 1: Create a coupon code template

Use the Message Templates API to create a coupon code template.

Request syntax

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",  
  "parameter_format": "named",  
  "components": [  
    {  
      "type": "HEADER",  
      "format": "TEXT",  
      "text": "<HEADER_TEXT>"  
    },  
    {  
      "type": "BODY",  
      "text": "<BODY_TEXT>",  
      "example": {  
        "body_text_named_params": [  
          {  
            "param_name": "<BODY_PARAMETER_NAME>",  
            "example": "<BODY_PARAMETER_EXAMPLE_VALUE>"  
          }  
        ]  
      }  
    },  
    {  
      "type": "BUTTONS",  
      "buttons": [  
        {  
          "type": "QUICK_REPLY",  
          "text": "<QUICK_REPLY_BUTTON_LABEL_TEXT>"  
        },  
        {  
          "type": "COPY_CODE",  
          "example": "<COPY_CODE_BUTTON_EXAMPLE_CODE>"  
        }  
      ]  
    }  
  ]  
}'

Request parameters

PlaceholderDescriptionExample Value
<ACCESS_TOKEN> StringRequired. System token or business token.EAAA...
<API_VERSION> StringOptional. Graph API version.v25.0
<BODY_PARAMETER_EXAMPLE_VALUE> StringRequired 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.WINTER25
<BODY_PARAMETER_NAME> StringRequired if using named parameters. Parameter name. Must be a unique string, composed of lowercase characters and underscores.coupon_code
<BODY_TEXT> StringRequired. Template body text. Variables are supported. Maximum 1024 characters.Shop now through the end of December and use the one-time use code {​{coupon_code}​} to get {​{discount}​} off of your entire order!
<COPY_CODE_BUTTON_EXAMPLE_CODE> StringRequired. String to copy to device clipboard. Maximum 20 characters.WINTER25
<HEADER_TEXT> StringRequired if using a text header component. Header text. Maximum 60 characters.Our Winter Sale is on!
<QUICK_REPLY_BUTTON_LABEL_TEXT> StringRequired if using a quick-reply button. Button label text. Maximum 25 characters. Alphanumeric characters only.Unsubscribe
<TEMPLATE_LANGUAGE> StringRequired. Template language code.en_US
<TEMPLATE_NAME> StringRequired. 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.winter_sale_coupon
<WHATSAPP_BUSINESS_ACCOUNT_ID> StringRequired. WhatsApp Business account ID.102290129340398

Response syntax

Upon success, the API responds with:

{  
  "id": "<TEMPLATE_ID>",  
  "status": "<TEMPLATE_STATUS>",  
  "category": "<TEMPLATE_CATEGORY>"  
}

Response parameters

PlaceholderDescriptionExample value
<TEMPLATE_CATEGORY>Template category.MARKETING
<TEMPLATE_ID>Template ID.1627019861106475
<TEMPLATE_STATUS>Template status.PENDING

Example request

curl 'https://graph.facebook.com/v25.0/102290129340398/message_templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
  "name": "winter_sale_coupon",
  "language": "en_US",
  "category": "MARKETING",
  "parameter_format": "named",
  "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 {​{coupon_code}​} to get {​{discount}​} off of your entire order!",
      "example": {
        "body_text_named_params": [
          {
            "param_name": "coupon_code",
            "example": "WINTER25"
          },
          {
            "param_name": "discount",
            "example": "30%"
          }
        ]
      }
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "QUICK_REPLY",
          "text": "Unsubscribe"
        },
        {
          "type": "COPY_CODE",
          "example": "WINTER25"
        }
      ]
    }
  ]
}'

Example response

{  
  "category" : "MARKETING",  
  "id" : "1924084211297547",  
  "status" : "PENDING"  
}

Step 2: Send a coupon code template

Use the Messages API to send an approved coupon template in a template message.

Request syntax

curl -X POST "https://graph.facebook.com/<API_VERSION>/<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages" \  
  -H "Authorization: Bearer <ACCESS_TOKEN>" \  
  -H "Content-Type: application/json" \  
  -d '  
{  
    "messaging_product": "whatsapp",  
    "to": "<WHATSAPP_USER_PHONE_NUMBER>",  
    "type": "template",  
    "template": {  
      "name": "<TEMPLATE_NAME>",  
      "language": {  
        "code": "<TEMPLATE_LANGUAGE>"  
      },  
      "components": [  
        {  
          "type": "body",  
          "parameters": [  
            {  
              "type": "text",  
              "parameter_name": "<PARAMETER_NAME>",  
              "text": "<PARAMETER_VALUE>"  
            }  
          ]  
        },  
        {  
          "type": "button",  
          "sub_type": "copy_code",  
          "index": <BUTTON_INDEX>,  
          "parameters": [  
            {  
              "type": "coupon_code",  
              "coupon_code": "<COUPON_CODE>"  
            }  
          ]  
        }  
      ]  
    }  
  }'

Request parameters

PlaceholderDescriptionExample Value
<ACCESS_TOKEN> StringRequired. System token or business token.EAAA...
<API_VERSION> StringOptional. Graph API version.v25.0
<WHATSAPP_BUSINESS_PHONE_NUMBER_ID> StringRequired. WhatsApp business phone number ID.106540352242922
<BUTTON_INDEX> IntegerRequired. Indicates the order in which a button appears, if the template uses multiple buttons. Buttons are zero-indexed, so setting the value to 0 causes the button to appear first, and another button with an index of 1 appears next, and so on.0
<COUPON_CODE> StringRequired. String to copy to device clipboard. Maximum 20 characters.WINTER25
<PARAMETER_NAME> StringRequired if template uses one or more named parameters. Named parameter name.coupon_code
<PARAMETER_VALUE> StringRequired if template uses one or more named parameters. Named parameter value.WINTER25
<TEMPLATE_NAME> StringRequired. Name of the template to be sent.winter_sale_coupon
<TEMPLATE_LANGUAGE> StringRequired. The template's language and locale code.en_US
<WHATSAPP_USER_PHONE_NUMBER> StringRequired. WhatsApp user phone number.+16505551234

Response syntax

Upon success, the API responds 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 -->  
    }  
  ]  
}

Response parameters

PlaceholderDescriptionSample Value
<GROUP_ID> StringThe string identifier of a group made using the Groups API. This field shows when messages are sent, received, or read from a group. Learn more about the Groups APIY2FwaV9ncm91cDoxNzA1NTU1MDEzOToxMjAzNjM0MDQ2OTQyMzM4MjAZD
<PACING_STATUS> StringIndicates 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> StringWhatsApp user's WhatsApp phone number. May not match wa_id value.+16505551234
<WHATSAPP_USER_ID> StringWhatsApp user's WhatsApp ID. May not match input value.16505551234
<WHATSAPP_MESSAGE_ID> StringWhatsApp Message ID. This ID appears in associated messages webhooks, such as sent, read, and delivered webhooks.wamid.HBgLMTY0NjcwNDM1OTUVAgARGBI4MjZGRDA0OUE2OTQ3RkEyMzcA

Example request

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": "winter_sale_coupon",
    "language": {
      "code": "en_US"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "parameter_name": "coupon_code",
            "text": "WINTER25"
          },
          {
            "type": "text",
            "parameter_name": "discount",
            "text": "30%"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "copy_code",
        "index": 1,
        "parameters": [
          {
            "type": "coupon_code",
            "coupon_code": "WINTER25"
          }
        ]
      }
    ]
  }
}'

Example response

{  
  "messaging_product": "whatsapp",  
  "contacts": [  
    {  
      "input": "16505551234",  
      "wa_id": "16505551234"  
    }  
  ],  
  "messages": [  
    {  
      "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBIxRjk1REYzMDBERDE3RUI0RDYA"  
    }  
  ]  
}

Unofficial mirror for reference/search purposes. All content originates from developers.facebook.com — see the source link at the top of each page. Machine-readable indexes: llms.txt · llms-full.txt · About