# Create a Carousel template

{% hint style="info" %}
The Carousel message template is only supported in the Cloud API.
{% endhint %}

<figure><img src="https://3038546383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNEoTGRNfzqHGVway9Wkd%2Fuploads%2FVxmTWPnU8BZvaR8WZV4Q%2Fimage.png?alt=media&#x26;token=e07fe306-f7e4-4c76-b1af-bf1408a44888" alt=""><figcaption><p>Carousel template in WhatsApp</p></figcaption></figure>

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.

The template can be viewed by users both from mobile devices and in the WhatsApp web client.

## Basic rules for creating a template:

1. A message bubble (1) is required. Message bubbles are text-only and support variables in it.&#x20;
2. Carousel templates support up to 10 carousel cards.
3. The media header format and button types must be the same for all cards.
4. Cards must have a mandatory media header (image or video) and card body text
5. Card should at least have 1 button. Template supports a maximum of up to 2 buttons for each card.
6. The button types supported are Quick Reply, Website URL CTA & Call Phone Number CTA. Buttons can be the same type or a mix of Quick reply buttons, phone number buttons, or URL buttons for each card.

## Create a template using the developer API

Creating a template is described in [the API documentation](https://my.1msg.io/documentation/1msg) in the /addTemplate method.

The difference from the basic template creation is the addition of a new CAROUSEL type to the components and cards array..

You can also create a template from the 'Dev Toolkit' →[ 'Test requests'](https://my.1msg.io/testing/test-requests) section of your personal cabinet. The example below was created using this section. Don't forget to specify examples of variables if you have added them to the body, link URL of buttons. Otherwise the template will be rejected by Meta\*.

<details>

<summary>Example of creating a Carousel template</summary>

The links are test links, be sure to use the correct ones when copying. The filling example is taken from the 360Dialog source.

```json
POST https://api.1msg.io/{{channel}}/addTemplate
Content-Type: application/json
Body: {
  "token": "{{token}}",
  "name": "marceting_carousel_01_test",
  "allow_category_change": true,
  "category": "MARKETING",
  "language": "en",
  "components": [
    {
      "text": "Summer is here, and we have the freshest produce around! Use code {{1}} to get {{2}} off your next order.",
      "type": "BODY",
      "example": {
        "body_text": [
          [
            "15OFF",
            "15%"
          ]
        ]
      }
    },
     /* Carousel cards */
    {
      "type": "CAROUSEL" // new type for Carousel template
      "cards": [ 
        {
        /* First carousel card */
          "components": [ 
            {
              "type": "HEADER",
              "format": "IMAGE", 
              "example": {
                "header_handle": [
                  "https://img.example.com/delicious-background-orange-slices_23-2148231462.jpg"
                ]
              }
            },
            {
              "type": "BODY",
              "text": "Rare lemons for unique cocktails. Use code {{1}} to get {{2}} off all produce",
              "example": {
                "body_text": [
                  [
                    "150FF",
                    "10%"
                  ]
                ]
              }
            },
            {
              "type": "BUTTONS",
              "buttons": [
                {
                  "type": "QUICK_REPLY",
                  "text": "Send more like this #1"
                },
                {
                  "type": "URL",
                  "text": "Buy now",
                  "url": "https://www.luckyshrub.com/shop?promo={{1}}",
                  "example": [
                    "summer_lemons_2023"
                  ]
                }
              ]
            }
          ]
        },
       /* Second carousel card */
        {
          "components": [
            {
              "type": "HEADER",
              "format": "IMAGE",
              "example": {
                "header_handle": [
                  "https://img.example.com/top-view-citric-fruit-slices-table_23-2148495686.jpg"
                ]
              }
            },
            {
              "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 #2"
                },
                {
                  "type": "URL",
                  "text": "Buy now",
                  "url": "https://www.luckyshrub.com/shop?promo={{1}}",
                  "example": [
                    "exotic_produce_2023"
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
```

</details>

<table><thead><tr><th width="287">Placeholder</th><th width="279">Description</th><th>Example Value</th></tr></thead><tbody><tr><td><p>BUBBLE_TEXT</p><p>String</p></td><td><p><strong>Required</strong>..<br></p><p>Message bubble text string. Supports variables.<br></p><p>Maximum 1024 characters.</p></td><td>Summer is here, and we've got the freshest produce around! Use code {{1}} to get {{2}} off your next order.</td></tr><tr><td><p>BUBBLE_TEXT_VAR_EXAMPLE</p><p>Array of strings</p></td><td><p><strong>Required</strong> if the message bubble text string uses variables.<br></p><p>Array of example variable strings. Number of strings must match the number of variables included in the string.</p></td><td>"15OFF","15%"</td></tr><tr><td><p>CARD_BODY_TEXT</p><p>String</p></td><td><p><strong>Required</strong>.</p><p></p><p>Card body text. Support variables.<br></p><p>Maximum 160 characters.</p></td><td>Rare lemons for unique cocktails. Use code {{1}} to get {{2}} off all produce.</td></tr><tr><td><p>CARD_BODY_TEXT_VAR_EXAMPLE</p><p>Array of strings</p></td><td><p><strong>Required</strong> if using card body text with variables.</p><p><br></p><p>Card body text example variables.</p></td><td>"15OFF","15%"</td></tr><tr><td><p>CARD_HEADER_FORMAT</p><p>Enum</p></td><td><p><strong>Required</strong>.</p><p>Card media header format. Must be IMAGE or VIDEO.</p></td><td>IMAGE</td></tr><tr><td>CARD_HEADER_HANDLE</td><td><strong>Required</strong>.</td><td></td></tr><tr><td><p>QUICK_REPLY_BUTTON_TEXT</p><p>String</p></td><td><p><strong>Required</strong> if using a quick reply button.<br></p><p>Quick reply button label text.<br></p><p>Maximum 25 characters.</p></td><td>Send more like this #2</td></tr><tr><td><p>TEMPLATE_CATEGORY</p><p>Enum</p></td><td><p><strong>Required</strong>.</p><p>Must be MARKETING or UTILITY.</p></td><td>MARKETING</td></tr><tr><td><p>TEMPLATE_LANGUAGE</p><p>Enum</p></td><td><p><strong>Required</strong>.</p><p>Template language and locale code.</p></td><td>en</td></tr><tr><td><p>TEMPLATE_NAME</p><p>String</p></td><td><p><strong>Required</strong>.</p><p>Template name.</p><p>Maximum 512 characters.</p></td><td>marceting_carousel_01_test</td></tr><tr><td><p>URL_BUTTON_TEXT</p><p>String</p></td><td><p><strong>Required</strong> if using a URL button.</p><p>URL button label text. </p><p>25 characters maximum.</p></td><td>Buy now</td></tr><tr><td><p>URL_BUTTON_URL</p><p>String</p></td><td><p><strong>Required</strong> if using a URL button.</p><p></p><p>URL of website that loads in the device's default mobile web browser when the URL button is tapped by the app user.</p><p></p><p>Supports 1 variable, appended to the end of the URL string.</p><p></p><p>Maximum 2000 characters.</p></td><td><a href="https://www.luckyshrub.com/shop?promo=%7B%7B1%7D%7D">https://www.luckyshrub.com/shop?promo={{1}}</a></td></tr><tr><td><p>URL_BUTTON_VAR_EXAMPLE</p><p>String</p></td><td><p><strong>Required</strong> if using a URL button.</p><p></p><p>URL of website. Supports 1 variable.</p><p></p><p>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.</p><p></p><p>Maximum 2000 characters.</p></td><td><a href="https://www.luckyshrub.com/shop?promo=summer_lemons_2023">https://www.luckyshrub.com/shop?promo=summer_lemons_2023</a></td></tr></tbody></table>

<br>
