# Creating Message Template

## **Creating a New Template**

### **1. Setting up the Basics**

* **Template Name**: Begin by setting your template name on the top left corner.
* **Platform Filter**: Utilize this to ensure your message adheres to the guidelines of the desired platform. It filters messages to fit the selected platform's capabilities.

### **2. Crafting the Message**

* **Message Types**: On the left selector, choose the kind of message you wish to add to your template. For further detail and examples of each message type, please see [Message Type Examples](https://docs.amitysolutions.com/amity-solutions/amity-bots-platform/message-template/message-types-examples) section

### **Message Types Support**

Here's a breakdown of which message types are supported across different platforms:

| Message Type   | Line | Facebook | Webchat | Multi-Platform |
| -------------- | ---- | -------- | ------- | -------------- |
| Text           | ✅    | ✅        | ✅       | ✅              |
| Media          | ✅    | ✅        | ✅       | ✅              |
| Carousel       | ✅    | ✅        | ✅       | ✅              |
| Image Carousel | ✅    | ❌        | ❌       | ❌              |
| Option         | ✅    | ✅        | ✅       | ✅              |
| Image Map      | ✅    | ❌        | ✅       | ❌              |
| Flex           | ✅    | ❌        | ❌       | ❌              |

## **Message Type Specifications**

| **Message Type** | **Limitation**                                                                                                                                                                                                                                 |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Image            | <ul><li>File Types: JPEG, PNG</li><li>File Size: Up to 1 MB</li><li>Support URL</li></ul>                                                                                                                                                      |
| Video            | <ul><li>File Type: MP4</li><li>File Size: Up to 25 MB</li><li>Does not support  URL</li></ul>                                                                                                                                                  |
| Carousel         | <ul><li>File Types: JPEG, PNG</li><li>File Size: Up to 1 MB</li><li>Image Ratios: 1:1, 1.51:1</li><li>Max Option List: 10 options</li><li>Title: Up to 40 characters (optional)</li><li>Description: Up to 120 characters (required)</li></ul> |
| Image Carousel   | <ul><li>File Types: JPEG, PNG</li><li>File Size: Up to 1 MB</li><li>Image Ratio: 1:1</li><li>Max Option List: 10 options</li></ul>                                                                                                             |
| Option           | <ul><li>Text: Up to 5000 characters, including emojis</li><li>Does not support Variables</li></ul>                                                                                                                                             |
| ImageMap         | <ul><li>File Types: JPEG, PNG</li><li>File Size: Up to 1 MB</li><li>Image Ratio: 1:1</li></ul>                                                                                                                                                 |

## Common Fields

* **Alternatives**: A text-based description of the message. Handy in scenarios where the original message might not render appropriately, such as in push notifications or chat preview trays.
* **Quick Reply**: Offer users clickable response options. This feature displays a series of buttons for users to interact with after receiving the message.

## Using Variables

Variables play a pivotal role in ensuring dynamic interactions in chatbot conversations. By utilizing variables, you can customize and personalize the chatbot's responses based on user data or other contextual information.

### Format of Variables

In Amity Bots, the format for calling a variable are `{{user.field}}, {{bot.field}},{{metadata.field}}`.

Here's a breakdown:

* `{{...}}`: This double curly brace notation is used to denote that the content inside is a variable.
* `user`: This represents the category or source of the variable. In this case, "user" implies that the variable is tied to a user's data.
* `field`: This is a placeholder for the specific attribute or data you want to retrieve from the user.

## Button and Action

Some message templates provide avenues for user engagement through interactions like button clicks. These interactions can lead to various outcomes. When defining a button, you can configure the following actions:

* **Received as Text**: The bot perceives the button click as if the user sent a text defined within the action.
* **Send Template**: Trigger another predefined message template upon the button click.
* **Go to Flow:** Trigger the @action in flow engine directly without using mapper.
* **Open Website**: Direct the user to a specified website or webpage.
* **Call Number**: Allow users to initiate a call to a designated phone number directly.
* **Open Camera**: Users can activate their device's camera.
* **Date Time Picker**: Users can select a specific date and time, useful for appointment setups or reminders.
* **Location:** Allow user to open the map and share location to bot
