# Message

### Common properties

| Field      | Required | Type   | Description                         | Restriction |
| ---------- | -------- | ------ | ----------------------------------- | ----------- |
| quickReply | false    | Object | Contains quickReply **items** array |             |

#### Quick Reply - Items

| Field    | Required | Type   | Description                                                      | Restriction                                   |
| -------- | -------- | ------ | ---------------------------------------------------------------- | --------------------------------------------- |
| type     | true     | String | **action**                                                       |                                               |
| imageUrl | false    | String | URL of the icon that is displayed at the beginning of the button | <p></p><ul><li>Max characters: 1000</li></ul> |
| action   | false    | Object | Action performed when the button is tapped (see Action Schema)   |                                               |

```
"quickReply": {
  "items": [
    {
      "type": "action",
      "action": {
         "type":"message",
         "label":"Yes",
         "text":"Yes"
      }
    }
  ]
}
```

### Text Message

| Field | Required | Type   | Description  | Restriction |
| ----- | -------- | ------ | ------------ | ----------- |
| type  | true     | String | **message**  |             |
| text  | true     | String | Message text |             |

```
// Example - Text Message

{
    "type": "text",
    "text": "Hello, world"
},
{
    "type": "text",
    "text": "https://megabot-livechat-prod.s3.ap-southeast-1.amazonaws.com/%file.xlsx"
}
```

### Image Message

| Field              | Required | Type   | Description       | Restriction                             |
| ------------------ | -------- | ------ | ----------------- | --------------------------------------- |
| type               | true     | String | **image**         |                                         |
| originalContentUrl | true     | String | Image URL         | <ul><li>Max characters: 1000</li></ul>  |
| previewImageUrl    | true     | String | Preview image URL | <ul><li>Max characters: 1000 </li></ul> |

```
// Example - Text Message

{
    "type": "image",
    "originalContentUrl": "https://example.com/original.jpg",
    "previewImageUrl": "https://example.com/preview.jpg"
}
```

### Video Message
| Field              | Required | Type   | Description          | Restriction                             |
| ------------------ | -------- | ------ | -------------------- | --------------------------------------- |
| type               | true     | String | **video**            |                                         |
| originalContentUrl | true     | String | URL of video file    | <ul><li>Max characters: 1000</li></ul>  |
| previewImageUrl    | true     | String | URL of preview image | <ul><li>Max characters: 1000 </li></ul> |

```
{
    "type": "video",
    "originalContentUrl": "https://example.com/original.mp4",
    "previewImageUrl": "https://example.com/preview.jpg",
    "trackingId": "track_id"
}
```

### Audio Message

| Field              | Required | Type   | Description                         | Restriction                            |
| ------------------ | -------- | ------ | ----------------------------------- | -------------------------------------- |
| type               | true     | String | **audio**                           |                                        |
| originalContentUrl | true     | String | URL of audio file                   | <ul><li>Max characters: 1000</li></ul> |
| duration           | true     | Number | Length of audio file (milliseconds) |                                        |

```
{
    "type": "audio",
    "originalContentUrl": "https://example.com/original.m4a",
    "duration": 60000
}
```

### Imagemap Message

| Field           | Required | Type   | Description                            | Restriction                                   |
| --------------- | -------- | ------ | -------------------------------------- | --------------------------------------------- |
| type            | true     | String | **imagemap**                           |                                               |
| baseUrl         | true     | String | Base URL of the image                  | <p></p><ul><li>Max characters: 1000</li></ul> |
| baseSize.width  | true     | Number | Width of base image in pixels.         |                                               |
| baseSize.height | true     | Number | Height of base image in pixels.        |                                               |
| actions         | true     | Array  | Action when tapped (see Action Schema) | <ul><li>Max: 50</li></ul>                     |

```
{
  "type": "imagemap",
  "baseUrl": "https://example.com/bot/images/rm001",
  "baseSize": {
      "width": 1040,
      "height": 1040
  },
  "actions": [
      {
          "type": "uri",
          "linkUri": "https://example.com/",
          "area": {
              "x": 0,
              "y": 586,
              "width": 520,
              "height": 454
          }
      }
  ]
}
```

### Template Message

| Field    | Required | Type   | Description           | Restriction |
| -------- | -------- | ------ | --------------------- | ----------- |
| type     | true     | String | **template**          |             |
| template | true     | Object | See "Template" schema |             |
