> For the complete documentation index, see [llms.txt](https://docs.amitysolutions.com/ekoai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amitysolutions.com/ekoai/api-reference/botv2/botv2-schema/template.md).

# Template

Here is the schema for template messages: at the moment we support **Buttons** and **Carousel** templates.

### Button Template

| Field                | required | type   | description                                                                                                                                                                                                                                                                                                                                                              | Restrictions                                                                                                                     |
| -------------------- | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| type                 | true     | String | **buttons**                                                                                                                                                                                                                                                                                                                                                              |                                                                                                                                  |
| thumbnailImageUrl    | false    | String | Image URL (Max character limit: 1,000)                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                  |
| imageAspectRatio     | false    | String | Aspect ratio of the image. One of: **rectangle**: 1.51:1 **square**: 1:1 (Default: rectangle)                                                                                                                                                                                                                                                                            |                                                                                                                                  |
| imageSize            | false    | String | Size of the image. One of: **cover**: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. **contain**: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. (Default: cover) |                                                                                                                                  |
| imageBackgroundColor | false    | String | Background color of the image. (Default:`#FFFFFF`)                                                                                                                                                                                                                                                                                                                       |                                                                                                                                  |
| title                | false    | String | Title                                                                                                                                                                                                                                                                                                                                                                    | <ul><li>Max character limit: 40</li></ul>                                                                                        |
| text                 | true     | String | Message Text                                                                                                                                                                                                                                                                                                                                                             | <ul><li>Max character limit: 160 (no image or title) </li><li>Max character limit: 60 (message with an image or title)</li></ul> |
| actions              | true     | Array  | The actions linked to the button                                                                                                                                                                                                                                                                                                                                         | <ul><li>Max objects: 4</li></ul>                                                                                                 |

```
// Example

{
  "type": "template",
  "template": {
      "type": "buttons",
      "thumbnailImageUrl": "https://example.com/bot/images/image.jpg",
      "imageAspectRatio": "rectangle",
      "imageSize": "cover",
      "imageBackgroundColor": "#FFFFFF",
      "title": "Menu",
      "text": "Please select",
      "actions": [
          {
            "type": "postback",
            "label": "Buy",
            "data": "action=buy&itemid=123"
          },
          {
            "type": "postback",
            "label": "Add to cart",
            "data": "action=add&itemid=123"
          },
          {
            "type": "uri",
            "label": "View detail",
            "uri": "http://example.com/page/123"
          }
      ]
  }
}
```

### Carousel Template

| Field            | required | type   | description                                                                                                                                                                                                                                                                                                                                                                                      | Restrictions                      |
| ---------------- | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------- |
| type             | true     | String | **carousel**                                                                                                                                                                                                                                                                                                                                                                                     |                                   |
| columns          | true     | Array  | Array of **columns** (see below)                                                                                                                                                                                                                                                                                                                                                                 | <ul><li>Max objects: 10</li></ul> |
| imageAspectRatio | false    | String | Aspect ratio of the image. One of: **rectangle**: 1.51:1 **square**: 1:1. Applies to all columns. (Default: rectangle)                                                                                                                                                                                                                                                                           |                                   |
| imageSize        | false    | String | Size of the image. One of: **cover**: The image fills the entire image area. Parts of the image that do not fit in the area are not displayed. **contain**: The entire image is displayed in the image area. A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images. Applies to all columns. (Default: cover) |                                   |

### Carousel Template - Columns

| Field                | required | type   | description                                        | Restrictions                                                                                                                     |
| -------------------- | -------- | ------ | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| thumbnailImageUrl    | false    | String | Image URL (Max character limit: 1,000)             |                                                                                                                                  |
| imageBackgroundColor | false    | String | Background color of the image. (Default:`#FFFFFF`) |                                                                                                                                  |
| title                | false    | String | Title                                              | <ul><li>Max character limit: 40</li></ul>                                                                                        |
| text                 | true     | String | Message Text                                       | <ul><li>Max character limit: 160 (no image or title) </li><li>Max character limit: 60 (message with an image or title)</li></ul> |
| actions              | true     | Array  | The actions linked to the button                   | <ul><li>Max objects: 3</li></ul>                                                                                                 |

```
// Example

{
  "type": "template",
  "altText": "this is a carousel template",
  "template": {
      "type": "carousel",
      "columns": [
          {
            "thumbnailImageUrl": "https://example.com/bot/images/item1.jpg",
            "imageBackgroundColor": "#FFFFFF",
            "title": "this is menu",
            "text": "description",
            "defaultAction": {
                "type": "uri",
                "label": "View detail",
                "uri": "http://example.com/page/123"
            },
            "actions": [
                {
                    "type": "postback",
                    "label": "Buy",
                    "data": "action=buy&itemid=111"
                },
                {
                    "type": "postback",
                    "label": "Add to cart",
                    "data": "action=add&itemid=111"
                },
                {
                    "type": "uri",
                    "label": "View detail",
                    "uri": "http://example.com/page/111"
                }
            ]
          },
          {
            "thumbnailImageUrl": "https://example.com/bot/images/item2.jpg",
            "imageBackgroundColor": "#000000",
            "title": "this is menu",
            "text": "description",
            "defaultAction": {
                "type": "uri",
                "label": "View detail",
                "uri": "http://example.com/page/222"
            },
            "actions": [
                {
                    "type": "postback",
                    "label": "Buy",
                    "data": "action=buy&itemid=222"
                },
                {
                    "type": "postback",
                    "label": "Add to cart",
                    "data": "action=add&itemid=222"
                },
                {
                    "type": "uri",
                    "label": "View detail",
                    "uri": "http://example.com/page/222"
                }
            ]
          }
      ],
      "imageAspectRatio": "rectangle",
      "imageSize": "cover"
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.amitysolutions.com/ekoai/api-reference/botv2/botv2-schema/template.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
