# Product Template



**Warning:** Product template is only available on Graph API v8.0+

The product template is a structured message that can be used to render products that have been uploaded to a [catalog](https://www.facebook.com/business/help/1275400645914358). Product details (image, title, price) will automatically be pulled from the product catalog.

### Contents

- [Template Payload](#payload)
- [Sending a Carousel of Product Templates](#carousel)
- [Example Request](#example_request)
- [Example Response](#example_response)

## Template Payload {#payload}

```http
"payload": {
  "template_type":"product",
  "elements":[
     {
        "id":<PRODUCT_ID>
      },
    ]
  }
```

`product_ids` can be obtained via [Catalog API](https://developers.facebook.com/documentation/ads-commerce/catalog) or via [Facebook Commerce Manager](https://www.facebook.com/business/help/2371372636254534?id=533228987210412). Product template only supports `product_ids` owned by the same page.

## Sending a Carousel of Product Templates {#carousel}

The Messenger Platform supports the sending of a horizontally scrollable carousel of product templates.

To create a scrollable carousel, include up to 10 products in the `elements` array of the `payload`.

```http
"payload": {
  "template_type":"product",
  "elements":[
    {
        "id":<PRODUCT_ID_1>
    },
    {
        "id":<PRODUCT_ID_2>
    }
    ...
  ]
}
```

## Example Request {#example_request}

```curl
curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"<PSID>"
  },
  "message":{
    "attachment":{
      "type":"template",
        "payload": {
          "template_type": "product",
          "elements": [
            {
              "id": "<PRODUCT_ID_1>"
            },
            {
              "id": "<PRODUCT_ID_2>"
            }
         ]
      }
    }
  }
}' "https://graph.facebook.com/v8.0/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
```

## Example Response {#example_response}

```js
{
  "recipient_id": "1254477777772919",
  "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P"
}
```


## Error Codes

| Code | Subcode | Message |
| --- | --- | --- |
| `100` | `2018320  ` | Invalid product id. See [Product Template](https://developers.facebook.com/documentation/business-messaging/messenger-platform/send-messages/template/product) |
| `100` | `2018328` | Product template is not supported below version 8. Use api version 8 or higher to use product templates. See [Product Template](https://developers.facebook.com/documentation/business-messaging/messenger-platform/send-messages/template/product) |

For other errors returned by the Send API, see [error code](https://developers.facebook.com/documentation/business-messaging/messenger-platform/error-codes)