Carousel Templates

Carousel Templates are only available while using Cloud API.

Carousel templates allow you to send a single text message (1), accompanied by a set of up to 10 carousel cards (2) in a horizontally scrollable view:

From January 2024, in addition to the mobile device experience, users can now view Carousel messages seamlessly on the WhatsApp Web Client.

Template Creation

Use the create template endpoint to create coupon code templates

POST https://waba-v2.360dialog.io/v1/configs/templates

Headers

NameTypeDescription

D360-API-KEY

string

object	{WABA Template}	
    name	string	optional
    namespace	string	optional
    category	string	optional
    components	array[object]	optional
        type	string	Allowed Values: BODY, HEADER, FOOTER, BUTTONS
        format	string	Allowed Values: TEXT, IMAGE, DOCUMENT, VIDEO
        text	string	optional
        example	string	optional
        buttons	object	optional
            type	string	Allowed Values: PHONE_NUMBER, URL, QUICK_REPLY
            text	string	required
            url	string	optional
            phone_number	string	optional
            example	string	optional
    language	string	optional
    rejected_reason	string	optional
    status	string	optional

Once your template is approved, you can use Cloud API to send it in a template message.

Post Body

{
  "name": "<TEMPLATE_NAME>",
  "language": "<TEMPLATE_LANGUAGE>",
  "category": "<TEMPLATE_CATEGORY>",
  "components": [

    /* Message bubble */
    {
      "type": "BODY",
      "text": "<BUBBLE_TEXT>",
      "example": {
        "body_text": [["<BUBBLE_TEXT_VAR_EXAMPLE>"]]
      }
    },

    /* Carousel cards */
    {
      "type": "CAROUSEL",
      "cards": [

        /* First carousel card */
        {
          "components": [
            {
              "type": "HEADER",
              "format": "<CARD_HEADER_FORMAT>",
              "example": {
                "header_handle": ["<CARD_HEADER_HANDLE>"]
              }
            },
            {
              "type": "BODY",
              "text": "<CARD_BODY_TEXT>",
              "example": {
                "body_text": [["<CARD_BODY_TEXT_VAR_EXAMPLE>"]]
              }
            },
            {
              "type": "BUTTONS",
              "buttons": [
                {
                  "type": "QUICK_REPLY",
                  "text": "<QUICK_REPLY_BUTTON_TEXT>"
                },
                {
                  "type": "URL",
                  "text": "<URL_BUTTON_TEXT>",
                  "url": "<URL_BUTTON_URL>",
                  "example": ["<URL_BUTTON_VAR_EXAMPLE>"]
                }
              ]
            }
          ]
        },
     
        /* Addt'l cards would follow, using same structure as first card */

      ]
    }
  ]
}

Properties

PlaceholderDescriptionExample Value

<BUBBLE_TEXT>

String

Required.

Message bubble text string. Supports variables.

Maximum 1024 characters.

Summer is here, and we've got the freshest produce around! Use code {{1}} to get {{2}} off your next order.

<BUBBLE_TEXT_VAR_EXAMPLE>

Array of strings

Required if the message bubble text string uses variables.

Array of example variable strings. Number of strings must match the number of variables included in the string.

"15OFF","15%"

<CARD_BODY_TEXT>

String

Required if using card body text.

Card body text. Support variables.

Maximum 160 characters.

Rare lemons for unique cocktails. Use code {{1}} to get {{2}} off all produce.

<CARD_BODY_TEXT_VAR_EXAMPLE>

Array of strings

Required if using card body text with variables.

Card body text example variables.

"15OFF","15%"

<CARD_HEADER_FORMAT>

Enum

Required.

Card media header format. Must be IMAGE or VIDEO.

IMAGE

<CARD_HEADER_HANDLE>

Media asset handle

Required.

Uploaded media asset handle. Use the Resumable Upload API to generate an asset handle.

See Carousel Cards for media asset requirements.

4::aW...

<TEMPLATE_CATEGORY>

Enum

Required.

Must be MARKETING or UTILITY.

MARKETING

<TEMPLATE_LANGUAGE>

Enum

Required.

Template language and locale code.

en_US

<TEMPLATE_NAME>

String

Required.

Template name.

Maximum 512 characters.

summer_carousel_promo_2023

<QUICK_REPLY_BUTTON_TEXT>

String

Required if using a quick reply button.

Quick reply button label text.

Maximum 25 characters.

Send more like this

<URL_BUTTON_TEXT>

String

Required if using a URL button.

URL button label text. Supports 1 variable.

25 characters maximum.

Buy now

<URL_BUTTON_URL>

String

Required if using a URL button.

URL of website that loads in the device's default mobile web browser when the URL button is tapped by the app user.

Supports 1 variable, appended to the end of the URL string.

Maximum 2000 characters.

https://www.luckyshrub.com/shop?promo={{1}}

<URL_BUTTON_VAR_EXAMPLE>

String

Required if using a URL button.

URL of website. Supports 1 variable.

If using a variable, add sample variable property to the end of the URL string. The URL loads in the device's default mobile web browser when the customer taps the URL button.

Maximum 2000 characters.

https://www.luckyshrub.com/shop?promo=summer_lemons_2023

Message Bubble

A message bubble is required. Message bubbles are text-only and support variables.

Carousel templates support up to 10 carousel cards. Cards must have a media header (image or video) and can optionally include body text and up to 2 quick reply buttons, phone number buttons, or URL buttons (button types can be mixed).

The media header format and buttons must be the same across all cards that make up a carousel template.

Media assets will be cropped to a wide ratio based on the customer's device.

Example Request

{
  "name": "summer_carousel_promo_2023",
  "language": "en_US",
  "category": "MARKETING",
  "components": [
    {
      "type": "BODY",
      "text": "Summer is here, and we have the freshest produce around! Use code {{1}} to get {{2}} off your next order.",
      "example": {
        "body_text": [
          [
            "15OFF",
            "15%"
          ]
        ]
      }
    },
    {
      "type": "CAROUSEL",
      "cards": [
        {
          "components": [
            {
              "type": "HEADER",
              "format": "IMAGE",
              "example": {
                "header_handle": [
                  "4::aW..."
                ]
              }
            },
            {
              "type": "BODY",
              "text": "Rare lemons for unique cocktails. Use code {{1}} to get {{2}} off all produce.",
              "example": {
                "body_text": [
                  [
                    "15OFF",
                    "15%"
                  ]
                ]
              }
            },
            {
              "type": "BUTTONS",
              "buttons": [
                {
                  "type": "QUICK_REPLY",
                  "text": "Send more like this"
                },
                {
                  "type": "URL",
                  "text": "Buy now",
                  "url": "https://www.luckyshrub.com/shop?promo={{1}}",
                  "example": [
                    "https://www.luckyshrub.com/shop?promo=summer_lemons_2023"
                  ]
                }
              ]
            }
          ]
        },
        {
          "components": [
            {
              "type": "HEADER",
              "format": "IMAGE",
              "example": {
                "header_handle": [
                  "4::aW..."
                ]
              }
            },
            {
              "type": "BODY",
              "text": "Exotic fruit for unique cocktails! Use code {{1}} to get {{2}} off all exotic produce.",
              "example": {
                "body_text": [
                  [
                    "20OFFEXOTIC",
                    "20%"
                  ]
                ]
              }
            },
            {
              "type": "BUTTONS",
              "buttons": [
                {
                  "type": "QUICK_REPLY",
                  "text": "Send more like this"
                },
                {
                  "type": "URL",
                  "text": "Buy now",
                  "url": "https://www.luckyshrub.com/shop?promo={{1}}",
                  "example": [
                    "https://www.luckyshrub.com/shop?promo=exotic_produce_2023"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}'

Example Response

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

Sending Carousel Templates

Catalog template messages cannot be sent with the On-Premises API.

Once your carousel template is approved, you can use the Cloud API to send it in a Carousel Template Message.

POST https://waba-v2.360dialog.io/messages

Request Body

NameTypeDescription

to

string

Recipient wa_id

type

string

Message type

language

string

Template language

policy

string

Delivery policy

code

string

Language code

name

string

Template name

messaging_product

string

Required only for Cloud API. Messaging service used for the request. Use "whatsapp".

index

integer

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.

cupon_code

string

Required.

The coupon code to be copied when the customer taps the button.

Upon success, the API will respond with the following:

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "<INPUT>",
      "wa_id": "<WA_ID>"
    }
  ],
  "messages": [
    {
      "id": "<ID>"
    }
  ]
}

It is only possible to send Templates with an Active status. A message template's status can change automatically from Active to Paused or Disabled based on feedback from customers. For this reason, we recommend that you monitor status changes to take appropriate actions whenever a message template that you rely upon becomes, or is in danger of becoming, paused or disabled.

Properties

PlaceholderDescriptionExample Value

<BUBBLE_TEXT_VARIABLE>

String

Required if the message bubble uses variables.

Message bubble text variable.

There is no maximum character limit on this value, but counts against the message bubble limit of 1024 characters.

20OFF

<BUTTON_INDEX>

Integer

Required.

Zero-indexed order in which button appears at the bottom of the template message. 0 indicates the first button, 1 indicates second button, etc.

0

<CARD_INDEX>

Integer

Required.

Zero-indexed order in which card appears within the card carousel. 0 indicates first card, 1 indicates second card, etc.

0

<CARD_BODY_VARIABLE>

String

Required if card body text uses a variable.

Card body text variable.

There is no maximum character limit on this value, but counts against the card body text limit of 160 characters.

20OFF

<HEADER_ASSET_ID>

Media asset handle

Required.

Uploaded media asset ID. Use the /media endpoint to generate an ID.

24230790383178626

<QUICK_REPLY_BUTTON_PAYLOAD>

String

Optional.

Value to be included in messages webhooks (messages.button.payload) when the button is tapped.

59NqSd

<TEMPLATE_LANGUAGE_CODE>

Enum

Required.

Language and locale code of the template to be sent in the template message.

en_US

<TEMPLATE_NAME>

String

Required.

Name of the template to be sent in the template message.

summer_carousel_promo_2023

<TO>

String

Required.

Phone number of customer who the template message should be sent to.

16505555555

<URL_BUTTON_PAYLOAD>

String

Required if the URL button uses a variable.

URL button variable value.

last_chance_2023

Post Body

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "<TO>",
  "type": "template",
  "template": {
    "name": "<TEMPLATE_NAME>",
    "language": {
      "code": "<TEMPLATE_LANGUAGE_CODE>"
    },
    "components": [
      
      /* Message bubble; can omit if template message bubble has no variables */
      {
        "type": "BODY",
        "parameters": [
          {
            "type": "TEXT",
            "text": "<BUBBLE_TEXT_VARIABLE>"
          }
        ]
      },

      /* Carousel cards */
      {
        "type": "CAROUSEL",
        "cards": [

          /* Card one */
          {
            "card_index": <CARD_INDEX>,
            "components": [
              {
                "type": "HEADER",
                "parameters": [
                  {

                    /* Required if template uses image header, otherwise omit */
                    "type": "IMAGE",
                    "image": {
                      "id": "<HEADER_ASSET_ID>"
                    }

                    /* Required if template uses video header, otherwise omit */
                    "type": "VIDEO",
                    "video": {
                      "id": "<HEADER_ASSET_ID>"
                    }
                  }
                ]
              },

              /* Can be omitted if card body text in template has no variables */
              {
                "type": "BODY",
                "parameters": [
                  {
                    "type": "text",
                    "text": "<CARD_BODY_VARIABLE>"
                  }
                ]
              },
              {
                "type": "BUTTON",
                "sub_type": "QUICK_REPLY",
                "index": "<BUTTON_INDEX>",
                "parameters": [
                  {
                    "type": "PAYLOAD",
                    "payload": "<QUICK_REPLY_BUTTON_PAYLOAD>"
                  }
                ]
              },
              {
                "type": "BUTTON",
                "sub_type": "URL",
                "index": "BUTTON_INDEX",
                "parameters": [
                  {
                    "type": "PAYLOAD",
                    "payload": "<URL_BUTTON_PAYLOAD>"
                  }
                ]
              }
            ]
          }
        ]
      },

      /* Additional cards would follow, using same structure as card above. Must 
         define a card for every card that the template uses. */

    ]
  }
}

Example Request

Example request to send a carousel template that uses a message bubble requiring values for two variables, and 2 carousel cards that each use an image header and require values for body text and button variables.

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "16505555555",
  "type": "template",
  "template": {
    "name": "summer_carousel_promo_2023",
    "language": {
      "code": "en_US"
    },
    "components": [
      {
        "type": "BODY",
        "parameters": [
          {
            "type": "TEXT",
            "text": "20OFF"
          },
          {
            "type": "TEXT",
            "text": "20%"
          }
        ]
      },
      {
        "type": "CAROUSEL",
        "cards": [
          {
            "card_index": 0,
            "components": [
              {
                "type": "HEADER",
                "parameters": [
                  {
                    "type": "IMAGE",
                    "image": {
                      "id": "24230790383178626"
                    }
                  }
                ]
              },
              {
                "type": "BODY",
                "parameters": [
                  {
                    "type": "TEXT",
                    "text": "10OFF"
                  },
                  {
                    "type": "TEXT",
                    "text": "10%"
                  }
                ]
              },
              {
                "type": "BUTTON",
                "sub_type": "QUICK_REPLY",
                "index": "0",
                "parameters": [
                  {
                    "type": "PAYLOAD",
                    "payload": "59NqSd"
                  }
                ]
              },
              {
                "type": "button",
                "sub_type": "URL",
                "index": "1",
                "parameters": [
                  {
                    "type": "payload",
                    "payload": "last_chance_2023"
                  }
                ]
              }
            ]
          },
          {
            "card_index": 1,
            "components": [
              {
                "type": "HEADER",
                "parameters": [
                  {
                    "type": "IMAGE",
                    "image": {
                      "id": "1690627074790615"
                    }
                  }
                ]
              },
              {
                "type": "BODY",
                "parameters": [
                  {
                    "type": "TEXT",
                    "text": "30OFF"
                  },
                  {
                    "type": "TEXT",
                    "text": "30%"
                  }
                ]
              },
              {
                "type": "BUTTON",
                "sub_type": "QUICK_REPLY",
                "index": "0",
                "parameters": [
                  {
                    "type": "PAYLOAD",
                    "payload": "7C4xhY"
                  }
                ]
              },
              {
                "type": "BUTTON",
                "sub_type": "URL",
                "index": "1",
                "parameters": [
                  {
                    "type": "payload",
                    "payload": "summer_blues_2023"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}'

Example Response

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

Last updated