# Single-Product Message Templates

SPM templates are marketing templates that allow you to present a single product from your connected ecommerce catalog, accompanied by a product image, product title, and product price (all pulled from your product within your catalog), along with customizable body text, optional footer text, and an interactive **View** button.

<figure><img src="https://2248475362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuyAl2S0lSHJaNDXJHo7A%2Fuploads%2F2INXZry2rKAbI9QXj1qD%2FScreenshot%202024-10-04%20at%2013.31.50.png?alt=media&#x26;token=8429aff3-9ebf-4676-9674-ed0cbbd89bb2" alt="" width="563"><figcaption></figcaption></figure>

Users can tap the button to see details about the product, and can add or remove the product from the WhatsApp shopping cart.

<div><figure><img src="https://2248475362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuyAl2S0lSHJaNDXJHo7A%2Fuploads%2FwfQ053L5QqjMkBFwdqoC%2FScreenshot%202024-10-04%20at%2013.15.09.png?alt=media&#x26;token=a441c6ce-9f4b-4150-9b69-9db54a76fada" alt="" width="183"><figcaption></figcaption></figure> <figure><img src="https://2248475362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuyAl2S0lSHJaNDXJHo7A%2Fuploads%2F3QjJcYaDLfQZsoIInGBC%2Forder2.png?alt=media&#x26;token=5701f0b1-d113-4640-9866-a82acf758408" alt="" width="182"><figcaption></figcaption></figure></div>

If the user adds the product to the carts and submits an order, you will be notified via webhook and the user will see that an order has been placed:

<figure><img src="https://2248475362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuyAl2S0lSHJaNDXJHo7A%2Fuploads%2FRZ9AvDXLCnUUI8mrfEpw%2FScreenshot%202024-10-04%20at%2013.15.46.png?alt=media&#x26;token=7c15b4bf-7353-4d87-a859-a6de262bf9a7" alt="" width="259"><figcaption></figcaption></figure>

Users who place an order are also able to use the *View details* button to see information about the order:

<figure><img src="https://2248475362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuyAl2S0lSHJaNDXJHo7A%2Fuploads%2FVBdchGsZ6DMB8VOl8dxA%2FScreenshot%202024-10-04%20at%2013.14.51.png?alt=media&#x26;token=49bb5173-2e3e-432a-ad18-25fb41b63aa1" alt="" width="183"><figcaption></figcaption></figure>

#### Limitations <a href="#limitations" id="limitations"></a>

* Customers must be using WhatsApp v2.22.24 or greater.
* Message forwarding is disabled for SPM templates.
* SPM templates are only available to Cloud API.

#### Catalogs <a href="#catalogs" id="catalogs"></a>

To use SPM buttons,  SPM Templates or Product card carousel templates, you must have an ecommerce[ product catalog](https://docs.360dialog.com/partner/messaging/commerce-and-payments/products-and-catalogs), with inventory, connected to your WhatsApp Business Account.&#x20;

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

If you send templates that use a **View** button, when a customer adds one or more products to their cart and submits an order, you will receive a webhook that [describes the order](https://docs.360dialog.com/partner/onboarding/webhook-events-and-setup/webhook-events-partner-and-messaging-api#order-messages).

### Creating Single Product Message Templates <a href="#creating-product-card-carousel-templates" id="creating-product-card-carousel-templates"></a>

Use the create template [endpoint](https://app.gitbook.com/s/-M4sMxKjL6eJRvZn6jeG-887967055/messaging-api/api-reference/templates#post-v1-configs-templates)  to create Product Card Carousel Template.

**Headers**

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

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": "<TEMPLATE_NAME>",
  "language": "<TEMPLATE_LANGUAGE>",
  "category": "marketing",
  "components": [
    {
      "type": "header",
      "format": "product"
    },
    {
      "type": "body",
      "text": "<CARD_BODY_TEXT>",
      "example": {
        "body_text": [
          [
            "<CARD_BODY_TEXT_VARIABLE_EXAMPLE>",
            "<CARD_BODY_TEXT_VARIABLE_EXAMPLE>"
          ]
        ]
      }
    },
    {
      "type": "footer",
      "text": "<CARD_FOOTER_TEXT>"
    },
    {
      "type": "buttons",
      "buttons": [
        {
          "type": "spm",
          "text": "View"
        }
      ]
    }
  ]
}
```

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

<table><thead><tr><th width="285">Placeholder</th><th>Description</th><th>Example Value</th></tr></thead><tbody><tr><td><p><code>&#x3C;CARD_BODY_TEXT></code></p><p><em>String</em></p></td><td><p><strong>Required.</strong></p><p></p><p>Card body text. Supports variables.<br></p><p>Maximum 160 characters.</p></td><td><code>Use code {{1}} to get {{2}} off our newest succulent!</code></td></tr><tr><td><p><code>&#x3C;CARD_BODY_TEXT_VARIABLE_EXAMPLE></code></p><p><em>String</em></p></td><td><p><strong>Required if card body text uses variables.</strong></p><p></p><p>Card body text example variable string(s). Number of strings must match the number of variable placeholders in the card body text string.</p><p></p><p>If card body text uses a single variable, <code>body_text</code> value can be a string, otherwise it must be an array containing an array of strings.</p></td><td><code>25OFF</code></td></tr><tr><td><p><code>&#x3C;CARD_FOOTER_TEXT></code></p><p><em>String</em></p></td><td><p><strong>Optional.</strong></p><p></p><p>Footer text.</p></td><td><code>September 30, 2024</code></td></tr><tr><td><p><code>&#x3C;TEMPLATE_LANGUAGE></code></p><p><em>String</em></p></td><td><p><strong>Required.</strong></p><p></p><p>Template language and locale code.</p></td><td><code>en_US</code></td></tr><tr><td><p><code>&#x3C;TEMPLATE_NAME></code></p><p><em>String</em></p></td><td><p><strong>Required.</strong></p><p></p><p>Template name.</p><p>Maximum 512 characters.</p></td><td><code>abandoned_cart_offer</code></td></tr></tbody></table>

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

```json
{
  "name": "abandoned_cart_offer",
  "language": "en_US",
  "category": "marketing",
  "components": [
    {
      "type": "header",
      "format": "product"
    },
    {
      "type": "body",
      "text": "Use code {{1}} to get {{2}} off our newest succulent!",
      "example": {
        "body_text": [
          [
            "25OFF",
            "25%"
          ]
        ]
      }
    },
    {
      "type": "footer",
      "text": "Offer ends October 31, 2024"
    },
    {
      "type": "buttons",
      "buttons": [
        {
          "type": "spm",
          "text": "View"
        }
      ]
    }
  ]
}
```
