# Catalog Templates

{% hint style="info" %}
Catalog Templates are only available while using Cloud API.&#x20;
{% endhint %}

Catalog templates are[ marketing templates ](../conversations)that allow you to showcase your product catalog entirely within WhatsApp. Catalog templates display a product thumbnail header image of your choice and custom body text, along with a fixed text header and fixed text sub-header.

<figure><img src="https://3527970750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4sMxKjL6eJRvZn6jeG-887967055%2Fuploads%2Fj3dC5OeBdPNx6NhVLrok%2Fspaces_uyAl2S0lSHJaNDXJHo7A_uploads_caXlUZQO35P16az5B51R_Screenshot%202024-01-09%20at%2018.png?alt=media&#x26;token=69adac4a-a54d-4cab-8217-29446d39b342" alt=""><figcaption><p>When a customer taps the <strong>View catalog</strong> button in a catalog template message, your product catalog appears within WhatsApp.</p></figcaption></figure>

#### Requirements&#x20;

You **must** have inventory uploaded to Meta in an ecommerce catalog connected to your WhatsApp Business Account. See [Products and Catalogs.](../products-and-catalogs)

If you require any assistance, please reach out to our Support Team.&#x20;

## Template Creation <a href="#request-syntax" id="request-syntax"></a>

Use the create template endpoint and assemble the Catalog Template components in the request:

<mark style="color:green;">`POST`</mark> `[base-url]/v1/configs/templates`&#x20;

The message template name field is limited to 512 characters. The message template content field is limited to 1024 characters.

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| D360-API-KEY | string |             |

#### Request Body

| Name                                         | Type            | Description                                                                                                                                |
| -------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark>       | string          |                                                                                                                                            |
| components<mark style="color:red;">\*</mark> | array\[objects] | Array of objects that describe the components that make up the template.                                                                   |
| category<mark style="color:red;">\*</mark>   | string          | Allowed values: **`MARKETING`**                                                                                                            |
| language<mark style="color:red;">\*</mark>   | string          | [View list of supported languages here.](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages) |

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

{% endtab %}
{% endtabs %}

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

#### Post Body <a href="#post-body" id="post-body"></a>

```json
{
  "name": "<NAME>",
  "language": "<LANGUAGE>",
  "category": "MARKETING",
  "components": [
    {
      "type": "BODY",
      "text": "<BODY_TEXT>",
      "example": {
        "body_text": [
          [
            "<EXAMPLE_BODY_TEXT>"
          ]
        ]
      }
    },
    {
      "type": "FOOTER",
      "text": "<FOOTER_TEXT>"
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "CATALOG",
          "text": "View catalog"
        }
      ]
    }
  ]
}
```

#### Properties <a href="#properties" id="properties"></a>

| Placeholder                                                                                 | Description                                                                                                                                                                                               | Sample Value                                                                                                                                                       |
| ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><code>&#x3C;BODY_TEXT></code></p><p><em>String</em></p>                                  | <p><strong>Required.</strong><br></p><p>Template body text. Variables are supported.</p><p></p><p>Maximum 1024 characters.</p>                                                                            | `Now shop for your favourite products right here on WhatsApp! Get Rs {{1}} off on all orders above {{2}}Rs! Valid for your first {{3}} orders placed on WhatsApp!` |
| <p><code>&#x3C;EXAMPLE_BODY_TEXT></code></p><p><em>String (of an array of strings)</em></p> | <p><strong>Required if body text uses variables.</strong></p><p></p><p>Sample strings to replace variable placeholders in <code>&#x3C;BODY_TEXT></code> string.</p><p></p><p>Maximum 1024 characters.</p> | `100`                                                                                                                                                              |
| <p><code>&#x3C;FOOTER_TEXT></code></p><p><em>String</em></p>                                | <p><strong>Optional.</strong><br></p><p>Template footer text. Variables are supported.<br></p><p>Maximum 60 characters.</p>                                                                               | `Best grocery deals on WhatsApp!`                                                                                                                                  |
| <p><code>&#x3C;LANGUAGE></code></p><p><em>String</em></p>                                   | <p><strong>Required.</strong><br></p><p>Template <a href="https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages">language and locale code</a>.</p>  | `en_US`                                                                                                                                                            |
| <p><code>&#x3C;NAME></code></p><p><em>String</em></p>                                       | <p><strong>Required.</strong><br></p><p>Template name.</p><p></p><p>Maximum 512 characters.</p>                                                                                                           | `intro_catalog_offer`                                                                                                                                              |

**Example Request**

```json
{
  "name": "intro_catalog_offer",
  "language": "en_US",
  "category": "MARKETING",
  "components": [
    {
      "type": "BODY",
      "text": "Now shop for your favourite products right here on WhatsApp! Get Rs {{1}} off on all orders above {{2}}Rs! Valid for your first {{3}} orders placed on WhatsApp!",
      "example": {
        "body_text": [
          [
            "100",
            "400",
            "3"
          ]
        ]
      }
    },
    {
      "type": "FOOTER",
      "text": "Best grocery deals on WhatsApp!"
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "CATALOG",
          "text": "View catalog"
        }
      ]
    }
  ]
}
```

## Sending Catalog Templates&#x20;

{% hint style="warning" %}
Catalog template messages cannot be sent with the On-Premises API.
{% endhint %}

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

#### Request Body

| Name       | Type   | Description                                                                                                                                |
| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| components | String | See [Components](#properties-1)                                                                                                            |
| language   | String | [View list of supported languages here.](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages) |

{% tabs %}
{% tab title="201: Created " %}

{% endtab %}
{% endtabs %}

**Post Body:**

```json
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "<TO>",
  "type": "template",
  "template": {
    "name": "<NAME>",
    "language": {
      "code": "<CODE>"
    },
    "components": [

      /* Body component required if template uses variables, otherwise omit */
      {
        "type": "body",
        "parameters": [
          {
            "type": "<TYPE>",
            "text": "<TEXT>"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "CATALOG",
        "index": 0,
        "parameters": [
          {
            "type": "action",
            "action": {
              "thumbnail_product_retailer_id": "<THUMBNAIL_PRODUCT_RETAILER_ID>"
            }
          }
        ]
      }
    ]
  }
}
```

#### Components <a href="#properties" id="properties"></a>

| Placeholder                                                                    | Description                                                                                                                                                                                                                                                                                                                                     | Sample Value          |
| ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| <p><code>&#x3C;CODE></code></p><p><em>String</em></p>                          | <p><strong>Required.</strong></p><p><br></p><p>Template <a href="https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages">language and locale code</a>.</p>                                                                                                                                 | `en_US`               |
| <p><code>&#x3C;NAME></code></p><p><em>String</em></p>                          | <p><strong>Required.</strong></p><p><br></p><p>Template name.</p>                                                                                                                                                                                                                                                                               | `intro_catalog_offer` |
| <p><code>&#x3C;THUMBNAIL_PRODUCT_RETAILER_ID></code></p><p><em>String</em></p> | <p><strong>Optional.</strong></p><p><br></p><p>Item SKU number. Labeled as Content ID in the Commerce Manager.</p><p><br></p><p>The thumbnail of this item will be used as the message's header image.</p><p><br></p><p>If the <code>parameters</code> object is omitted, the product image of the first item in your catalog will be used.</p> | `2lc20305pt`          |
| <p><code>&#x3C;TEXT></code></p><p><em>String</em></p>                          | <p><strong>Required if template uses variables.</strong></p><p><br></p><p>Template variable.</p>                                                                                                                                                                                                                                                | `100`                 |
| <p><code>&#x3C;TO></code></p><p><em>String</em></p>                            | <p><strong>Required.</strong></p><p><br></p><p>Customer phone number.</p>                                                                                                                                                                                                                                                                       | `+16505551234`        |
| <p><code>&#x3C;TYPE></code></p><p><em>String</em></p>                          | <p><strong>Required if template uses variables.</strong></p><p><br></p><p>Template variable type.</p>                                                                                                                                                                                                                                           | `text`                |



**Example Request**

```json
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "+16505551234",
  "type": "template",
  "template": {
    "name": "intro_catalog_offer",
    "language": {
      "code": "en_US"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "100"
          },
          {
            "type": "text",
            "text": "400"
          },
          {
            "type": "text",
            "text": "3"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "CATALOG",
        "index": 0,
        "parameters": [
          {
            "type": "action",
            "action": {
              "thumbnail_product_retailer_id": "2lc20305pt"
            }
          }
        ]
      }
    ]
  }
}'
```



