# Media carousel

Interactive media carousel messages display a set of horizontally scrollable media cards. Each card can display an image or video header, body text, and either quick-reply buttons or a URL button.

<figure><img src="https://3527970750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4sMxKjL6eJRvZn6jeG-887967055%2Fuploads%2FkNeZRbqdxXdmHNB37Pl0%2Fimage.png?alt=media&#x26;token=80d84f47-6f2f-4c57-b155-20e9aebf67be" alt=""><figcaption></figcaption></figure>

This is the same message, but using quick-reply buttons instead of URL buttons:

<figure><img src="https://3527970750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4sMxKjL6eJRvZn6jeG-887967055%2Fuploads%2FLbtG8AZ1CKjUu43lLuII%2Fimage.png?alt=media&#x26;token=a9a3e9a4-13da-459a-b5b3-77d69f1bc394" alt=""><figcaption></figcaption></figure>

### Components

* Messages must include between 2 and 10 cards.
* Main message body text is required.
* Main message headers, footers, and interactive components are not supported.
* Cards must include either an image or a video header. Other header types are not supported.
* Card body text is optional.
* Cards must include either one URL button or one or more quick-reply buttons. Button types and numbers must match across all cards (for example, if you define a card with 2 quick-reply buttons, all cards must define exactly 2 quick-reply buttons).

### Example

<mark style="color:green;">`POST`</mark> `https://waba-v2.360dialog.io/messages`

To send a message, use the request URL and the following parameters.

**Parameters**

| Name                                                  | Type    | Description                                                                                                                                                      |
| ----------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| card\_body\_text                                      | string  | Card body text. Max 160 characters, and up to 2 line breaks.                                                                                                     |
| card\_index<mark style="color:red;">\*</mark>         | integer | <p><code>0</code></p><p>Zero-index card index. Cards will appear left to right in a scrollable view, starting from 0.</p>                                        |
| header\_type<mark style="color:red;">\*</mark>        | string  | Value can be `image` or `video` [Supported media types](https://developers.facebook.com/documentation/business-messaging/whatsapp/business-phone-numbers/media). |
| media\_asset\_url<mark style="color:red;">\*</mark>   | string  | Publicly available media asset URL.                                                                                                                              |
| message\_body\_text<mark style="color:red;">\*</mark> | string  | Main message body text. Maximum 1024 characters.                                                                                                                 |
| quick\_reply\_button\_id                              | string  | Maximum 20 characters.                                                                                                                                           |
| quick\_reply\_button\_label                           | string  | Maximum 20 characters.                                                                                                                                           |
| url\_button\_label                                    | string  | Maximum 20 characters.                                                                                                                                           |
| url\_button\_url                                      | string  | URL to load in the device’s default web browser when tapped by the user. Maximum 20 characters.                                                                  |
| user\_phone\_numers<mark style="color:red;">\*</mark> | string  | WhatsApp user phone number.                                                                                                                                      |

#### Example with URL buttons

**Request**

```
curl --location 'https://https://waba-v2.360dialog.io/messages' \
--header 'Content-Type: application/json' \
--header 'D360-API-KEY: <token>' \
--data '
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "<<RECIPIENT_PHONE_NUMBER>>",
  "type": "interactive",
  "interactive": {
    "type": "carousel",
    "body": {
      "text": "<BODY_TEXT>"
    },
    "action": {
      "cards": [
        {
          "card_index": 0,
          "type": "cta_url",
          "header": {
            "type": "image",
            "image": {
              "link": "https://www.yourimage.jpeg"
            }
          },
          "body": {
            "text": "<BODY_TEXT>"
          },
          "action": {
            "name": "cta_url",
            "parameters": {
              "display_text": "<TEXT>",
              "url": "https://www.website.com/url-example"
            }
          }
        },
        {
          "card_index": 1,
          "type": "cta_url",
          "header": {
            "type": "image",
            "image": {
              "link": "https://www.yourimage.jpeg"
            }
          },
          "body": {
            "text": "<BODY_TEXT>"
          },
          "action": {
            "name": "cta_url",
            "parameters": {
              "display_text": "<TEXT>",
              "url": "https://www.website.com/url-example"
            }
          }
        },
        {
          "card_index": 2,
          "type": "cta_url",
          "header": {
            "type": "image",
            "image": {
              "link": "https://www.yourimage.jpeg"
            }
          },
          "body": {
            "text": "<BODY_TEXT>"
          },
          "action": {
            "name": "cta_url",
            "parameters": {
              "display_text": "<TEXT>",
              "url": "https://www.website.com/url-example"
            }
          }
        }
      ]
    }
  }
}'
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "messaging_product": "whatsapp",
  "contacts": [{
    "input": "PHONE_NUMBER",
    "wa_id": "WHATSAPP_ID",
  }]
  "messages": [{
    "id": "wamid.ID",
  }]
}
```

{% endtab %}
{% endtabs %}
