Coupon Code Templates

Coupon code templates are marketing templates that display a single copy code button. When tapped, the code is copied to the customer's clipboard.

Limitations

  • Coupon code templates are currently not supported by the WhatsApp web client.
  • Codes are limited to 15 characters.
  • Button text cannot be customized.
  • Templates are limited to one copy code button.

Creating Coupon Code Templates

Use the WhatsApp Business Account > Message Templates endpoint to create coupon code templates.

Request Syntax

POST /<WHATSAPP_BUSINESS_ACCOUNT_ID>/message_templates

Post Body

{
  "name": "<NAME>",
  "language": "<LANGUAGE>",
  "category": "MARKETING",
  "components": [
    ... // Additional components, if using
    {
      "type":"BUTTONS",
      "buttons": [
        {
          "type":"COPY_CODE",
          "example": "<EXAMPLE>"
        },
        ... // Additional buttons, if using
      ]
    }
  ]
}

Properties

PlaceholderDescriptionExample Value

<NAME>

String

Required.


Template name.


Maximum 512 characters.

fall2023_promotion

<LANGUAGE>

Enum

Required.


Template language and locale code.

en_US

<EXAMPLE>

String

Required.


Coupon code to be copied when tapped.


Maximum 15 characters.

25OFF

Response

Upon success, the API will respond with the following:

{
   "category" : "<CATEGORY>",
   "id" : "<ID>",
   "status" : "<STATUS>"
}

Response Properties

PlaceholderDescriptionExample Value

<CATEGORY>

Enum

Template category.

MARKETING

<ID>

Numeric string

Template ID.

1924084211297547

<STATUS>

Enum

Template status.

PENDING

Example Request

curl 'https://graph.facebook.com/v21.0/102290129340398/message_templates' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '
{
  "name": "coupon_code_fall2023_25off",
  "language": "en_US",
  "category": "MARKETING",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Our Fall Sale is on!"
    },
    {
      "type": "BODY",
      "text": "Shop now through November and use code {{1}} to get {{2}} off of all merchandise!",
      "example": {
        "body_text": [
          [
            "25OFF",
            "25%"
          ]
        ]
      }
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "QUICK_REPLY",
          "text": "Unsubscribe"
        },
        {
          "type": "COPY_CODE",
          "example": "250FF"
        }
      ]
    }
  ]
}'

Example Response

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

Sending Coupon Templates

Use the Cloud API to send approved coupon code templates in template messages. See Sending Coupon Code Templates.