# Multi-Product Templates

Multi-Product Message templates can be used to open [marketing conversations](/docs/get-started/pricing/free-vs-billed-messaging.md), meaning you can start a conversation using this template. They allow you to showcase up to 30 products from your ecommerce catalog, organized in up to 10 sections, in a single message.

<figure><img src="/files/83A3ilN1MBGEQOTV5HxK" alt=""><figcaption></figcaption></figure>

Customers can browse products and sections within the message, view details for each product, add and remove products from their cart, and submit their cart to place an order. Orders are then sent to you via a webhook.

<figure><img src="/files/1N5GWZtCXWimOV80lLn1" alt=""><figcaption></figcaption></figure>

{% embed url="<https://www.facebook.com/business/help/978451836847222>" %}

#### Requirements&#x20;

You must have inventory uploaded to Meta in an ecommerce catalog connected to your WhatsApp Business Account. See [Products and Catalogs.](/docs/messaging/catalogs.md) \
\
MPM templates cannot be forwarded to other customers.

## 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 " %}

```json
{
  "name": "<NAME>",
  "category": "<CATEGORY>",
  "language": "<LANGUAGE>",
  "components": [<COMPONENTS>]
}
```

{% endtab %}
{% endtabs %}

#### Parameters <a href="#parameters" id="parameters"></a>

| Placeholder    | Description                                                                                                                                                                                                                                                                         | Sample Value                                                                                                                              |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `<CATEGORY>`   | <p><strong>Required.</strong><br></p><p>Template category. Set this to <code>MARKETING</code>.</p>                                                                                                                                                                                  | `MARKETING`                                                                                                                               |
| `<COMPONENTS>` | <p><strong>Required.</strong></p><p></p><p>Array of objects that describe the components that make up the template. </p><p>See <a href="https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/mpm-templates#components">Components</a> below.</p> | See [Components](https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/mpm-templates#components) below. |
| `<LANGUAGE>`   | <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`                                                                                                                                   |
| `<NAME>`       | <p><strong>Required.</strong></p><p></p><p>Template name.</p><p></p><p>Maximum 512 characters.</p>                                                                                                                                                                                  | `abandoned_cart`                                                                                                                          |

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

The `components` value must be an array of objects that describes each component that makes up the template. MPM templates must have the following components:

* a single header component
* a single body component
* a single footer component (optional)
* a single MPM button component

```json
[
  {
    "type": "HEADER",
    "format": "TEXT",
    "text": "<HEADER_TEXT>",
    
    /* Example required if header uses a variable */
    "example": {
      "header_text": [
        "<HEADER_EXAMPLE_TEXT>"
      ]
    }
  },
  {
    "type": "BODY",
    "text": "<BODY_TEXT>",

    /* Example required if body uses variables */
​​    "example": {
      "body_text": [
        [
          "<BODY_EXAMPLE_TEXT>"
        ]
      ]
    }
  },
  {
    "type": "FOOTER",
    "text": "<FOOTER_TEXT>"
  },
  {
    "type":"BUTTONS",
    "buttons": [
      {
        "type": "MPM",
        "text": "View items"
      }
    ]
  }
]
```

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

| Placeholder             | Description                                                                                                                                                                                              | Sample Value                                                                                     |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `<BODY_EXAMPLE_TEXT>`   | String or array of strings. Example body variable value(s).                                                                                                                                              | `10OFF`                                                                                          |
| `<BODY_TEXT>`           | <p>Template body text. Supports multiple variables.<br></p><p>If the string contains variables, you must include the example property and sample variable values.<br></p><p>1024 characters maximum.</p> | `Forget something, {{1}}?`                                                                       |
| `<FOOTER_TEXT>`         | <p>Template footer text.</p><p></p><p>60 characters maximum.</p>                                                                                                                                         | `Lucky Shrub, 1 Hacker Way, Menlo Park, CA 94025`                                                |
| `<HEADER_EXAMPLE_TEXT>` | Example header variable value.                                                                                                                                                                           | `Pablo`                                                                                          |
| `<HEADER_TEXT>`         | <p>Template header text. Supports 1 variable.</p><p></p><p>If the string contains a variable, you must include the example property and a sample variable value.</p><p></p><p>60 characters maximum.</p> | `Looks like you left these items in your cart, still interested? Use code {{1}} to get 10% off!` |

#### Sample Request <a href="#sample-request" id="sample-request"></a>

```json
{
  "name": "abandoned_cart",
  "language": "en_US",
  "category": "MARKETING",
  "components": [
    {
      "type": "HEADER",
      "format": "TEXT",
      "text": "Forget something, {{1}}?",
      "example": {
        "header_text": [
          "Pablo"
        ]
      }
    },
    {
      "type": "BODY",
      "text": "Looks like you left these items in your cart, still interested? Use code {{1}} to get 10% off!",
      "example": {
        "body_text": [
          [
            "10OFF"
          ]
        ]
      }
    },
    {
      "type":"BUTTONS",
      "buttons": [
        {
          "type": "MPM",
          "text": "View items"
        }
      ]
    }
  ]
}
```

## Sending MPM Templates&#x20;

Use the API to send an MPM template once it has been approved.

<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 " %}

```json
{
    "messaging_product": "whatsapp",
    "contacts": [
        {
            "input": "12015553931",
            "wa_id": "12015553931"
        }
    ],
    "messages": [
        {
            "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBI4Qzc5QkNGNTc5NTMyMDU5QzEA"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

**Post Body**

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

      /* Header component required if template uses a header variable, otherwise omit */
      {
        "type": "header",
        "parameters": [
          {
            "type": "text",
            "text": "<HEADER_TEXT>"
          }
        ]
      },

      /* Body component required if template uses a body variable, otherwise omit */
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "<BODY_TEXT>"
          }
        ]
      },

      /* MPM button component always required */
      {
        "type": "button",
        "sub_type": "mpm",
        "index": 0,
        "parameters": [
          {
            "type": "action",
            "action": {
              "thumbnail_product_retailer_id": "<THUMBNAIL_PRODUCT_RETAILER_ID>",
              "sections": [
                {
                  "title": "<TITLE>",
                  "product_items": [
                    {
                      "product_retailer_id": "<PRODUCT_RETAILER_ID>"
                    },
                    ... // Additional item objects (up to 30)
                  ]
                },
                ... // Add section objects (up to 10)
              ]
            }
          }
        ]
      }
    ]
  }
}
```

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

<table><thead><tr><th width="292.3333333333333">Placeholder</th><th>Description</th><th>Sample Value</th></tr></thead><tbody><tr><td><code>&#x3C;BODY_TEXT></code></td><td><p><strong>Required if template uses variables.</strong><br></p><p>String or array of strings. Text to replace body variable(s) defined in the template.</p></td><td><code>10OFF</code></td></tr><tr><td><code>&#x3C;CODE></code></td><td>Template <a href="https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages">language and locale code</a>.</td><td><code>en_US</code></td></tr><tr><td><code>&#x3C;HEADER_TEXT></code></td><td><p><strong>Required if template uses a variable.</strong><br></p><p>Text to replace header variable defined in the template.</p></td><td><code>Pablo</code></td></tr><tr><td><code>&#x3C;NAME></code></td><td>Template name.</td><td><code>abandoned_cart</code></td></tr><tr><td><code>&#x3C;PRODUCT_RETAILER_ID></code></td><td><p>SKU number of the item you want to appear in the section.<br></p><p>SKU numbers are labeled as <strong>Content ID</strong> in the Commerce Manager.</p><p></p><p>Supports up to 30 products total, across all sections.</p></td><td><code>2lc20305pt</code></td></tr><tr><td><code>&#x3C;THUMBNAIL_PRODUCT_RETAILER_ID></code></td><td><p>Item SKU number. Labeled as <strong>Content ID</strong> in the Commerce Manager.<br></p><p>The thumbnail of this item will be used as the template message's header image.</p></td><td><code>2lc20305pt</code></td></tr><tr><td><code>&#x3C;TITLE></code></td><td><p>Section title text.</p><p></p><p>You can define up to 10 sections.</p><p></p><p>Maximum 24 characters. Markdown is not supported.</p></td><td><code>Popular Bundles</code></td></tr><tr><td><code>&#x3C;TO></code></td><td>Customer phone number.</td><td><code>1650555123</code></td></tr></tbody></table>

#### Example Request <a href="#example-request" id="example-request"></a>

This example sends an approved template named "abandoned\_cart" and injects a variable (the customer's first name) into the template header and a discount code into the template body. It also defines two sections ("Popular Bundles" and "Premium Packages") and identifies the products (a total of 3) that should be injected into those sections.

```json
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "16505551234",
  "type": "template",
  "template": {
    "name": "abandoned_cart",
    "language": {
      "code": "en_US"
    },
    "components": [
      {
        "type": "header",
        "parameters": [
          {
            "type": "text",
            "text": "Pablo"
          }
        ]
      },
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "10OFF"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "mpm",
        "index": 0,
        "parameters": [
          {
            "type": "action",
            "action": {
              "thumbnail_product_retailer_id": "2lc20305pt",
              "sections": [
                {
                  "title": "Popular Bundles",
                  "product_items": [
                    {
                      "product_retailer_id": "2lc20305pt"
                    },
                    {
                      "product_retailer_id": "nseiw1x3ch"
                    }
                  ]
                },
                {
                  "title": "Premium Packages",
                  "product_items": [
                    {
                      "product_retailer_id": "n6k6x0y7oe"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    ]
  }
}'
```

## Webhooks <a href="#webhooks" id="webhooks"></a>

When a customer adds one or more products to their cart and submits an order, Meta will send you a webhook that describes the order.

#### Webhook Syntax <a href="#webhook-syntax" id="webhook-syntax"></a>

```json
{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "<ENTRY.ID>",
      "changes": [
        {
          "value": {
            "messaging_product": "whatsapp",
            "metadata": {
              "display_phone_number": "<DISPLAY_PHONE_NUMBER>",
              "phone_number_id": "<PHONE_NUMBER_ID>"
            },
            "contacts": [
              {
                "profile": {
                  "name": "<NAME>"
                },
                "wa_id": "<WA_ID>"
              }
            ],
            "messages": [
              {
                "from": "<FROM>",
                "id": "<MESSAGES.ID>",
                "timestamp": "<TIMESTAMP>",
                "type": "order",
                "order": {
                  "catalog_id": "<CATALOG_ID>",
                  "product_items": [
                    {
                      "product_retailer_id": "<PRODUCT_RETAILER_ID>",
                      "quantity": <QUANTITY>,
                      "item_price": <ITEM_PRICE>,
                      "currency": "<CURRENCY>"
                    }
                  ]
                }
              }
            ]
          },
          "field": "messages"
        }
      ]
    }
  ]
}
```

#### Webhook Contents <a href="#webhook-contents" id="webhook-contents"></a>

<table><thead><tr><th width="277.3333333333333">Placeholder</th><th>Description</th><th>Sample Value</th></tr></thead><tbody><tr><td><code>&#x3C;CATALOG_ID></code></td><td>Ecommerce product catalog ID.</td><td><code>1537566713439863</code></td></tr><tr><td><code>&#x3C;CURRENCY></code></td><td>Item currency.</td><td><code>USD</code></td></tr><tr><td><code>&#x3C;DISPLAY_PHONE_NUMBER></code></td><td>Business phone number display number.</td><td><code>15550051310</code></td></tr><tr><td><code>&#x3C;ENTRY.ID></code></td><td>WhatsApp Business Account ID.</td><td><code>102290129340398</code></td></tr><tr><td><code>&#x3C;ITEM_PRICE></code></td><td>Item price.</td><td><code>99.99</code></td></tr><tr><td><code>&#x3C;MESSAGES.ID></code></td><td>WhatsApp message ID.</td><td><code>wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBJDOEI3ODgxNzQzMjJBQTdEQTcA</code></td></tr><tr><td><code>&#x3C;NAME></code></td><td>Customer's name.</td><td><code>Pablo Morales</code></td></tr><tr><td><code>&#x3C;PHONE_NUMBER_ID></code></td><td>Business phone number ID.</td><td><code>106540352242922</code></td></tr><tr><td><code>&#x3C;PRODUCT_RETAILER_ID></code></td><td>The item SKU number. Labeled as <strong>Content ID</strong> in the Commerce Manager.</td><td><code>2lc20305pt</code></td></tr><tr><td><code>&#x3C;QUANTITY></code></td><td>Number of items ordered (for this particular item).</td><td><code>1</code></td></tr><tr><td><code>&#x3C;TIMESTAMP></code></td><td>UNIX timestamp indicating when we sent you the webhook.</td><td><code>1677522117</code></td></tr><tr><td><code>&#x3C;WA_ID></code></td><td>Customer's WhatsApp phone number.</td><td><code>16505551234</code></td></tr></tbody></table>

**Sample Webhook**

```json
{
  "object": "whatsapp_business_account",
  "entry": [
    {
      "id": "102290129340398",
      "changes": [
        {
          "value": {
            "messaging_product": "whatsapp",
            "metadata": {
              "display_phone_number": "15550051310",
              "phone_number_id": "106540352242922"
            },
            "contacts": [
              {
                "profile": {
                  "name": "Pablo Morales"
                },
                "wa_id": "16505551234"
              }
            ],
            "messages": [
              {
                "from": "16505551234",
                "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQTMxNzA1QzNENEI4ODY0OTY2MAA=",
                "timestamp": "1683223069",
                "type": "order",
                "order": {
                  "catalog_id": "1537566713439863",
                  "product_items": [
                    {
                      "product_retailer_id": "n6k6x0y7oe",
                      "quantity": 1,
                      "item_price": 99.99,
                      "currency": "USD"
                    }
                  ]
                }
              }
            ]
          },
          "field": "messages"
        }
      ]
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.360dialog.com/docs/resources/templates/multi-product-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
