# LINE Messenger: Message types and payload examples

**Cognigy Support**  
October 24, 2022

On Cognigy.AI you are able to send messages to Line from the AI (default) channel, as well as from a specific Line channel node configuration for specific output that is highly customizable.

The Line channel supports “Text” and “Custom JSON” fields.

The “Custom JSON” field allows you to copy-paste JSON payloads.

## Line Messenger Message Types and Configurations

## **Text**

Check the API documentation fields here:

[https://developers.line.biz/en/reference/messaging-api/#text-message](https://developers.line.biz/en/reference/messaging-api/#text-message)

**Sample payload for text containing messages:**

```json
{
    "type": "text",
    "text": "Hello, world"
}
```

## **Quick Replies & Text with Buttons**

When configuring a Quick Reply in AI channel the required fields are:

- Text
- At least one button

Check required fields, file size & format limitations here:

[https://developers.line.biz/en/reference/messaging-api/#buttons](https://developers.line.biz/en/reference/messaging-api/#buttons)

**Sample Payload for Quick Replies:**

```json
{
  "type": "template",
  "altText": "This is a buttons template",
  "template": {
    "type": "buttons",
    "thumbnailImageUrl": "https://example.com/bot/images/image.jpg",
    "imageAspectRatio": "rectangle",
    "imageSize": "cover",
    "imageBackgroundColor": "#FFFFFF",
    "title": "Menu",
    "text": "Please select",
    "defaultAction": {
      "type": "uri",
      "label": "View detail",
      "uri": "http://example.com/page/123"
    },
    "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"
      }
    ]
  }
}
```

## **Image**

When configuring an image containing message in AI channel required fields are:

- Image URL - only .PNG or .JPG downloadable images supported, max file size: 10 MB.

Check required fields, file size & format limitations here:

[https://developers.line.biz/en/reference/messaging-api/#image-message](https://developers.line.biz/en/reference/messaging-api/#image-message)

**Sample payload for image containing messages:**

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

## **Video**

When configuring a video containing message in AI channel required fields are:

- Video URL - only .mp4 downloadable videos supported, max file size: 200 MB

Check required fields, file size & format limitations here:

[https://developers.line.biz/en/reference/messaging-api/#video-message](https://developers.line.biz/en/reference/messaging-api/#video-message)

**Sample Payload for Video Containing Messages:**

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

## **Audio**

When configuring an audio containing message in AI channel required fields are:

- Audio URL - only .m4a downloadable audio supported, max file size: 200 MB

Check required fields, file size & format limitations here:

[https://developers.line.biz/en/reference/messaging-api/#audio-message](https://developers.line.biz/en/reference/messaging-api/#audio-message)

**Sample Payload for Audio Containing messages:**

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

## **Gallery & List**

When configuring a gallery or list containing message in AI channel required fields are:

- Image URL - only .PNG or .JPG downloadable images supported, max file size: 10 MB.
- Title
- Subtitle
- At least one Button
- Fallback Text

Check required fields, file size & format limitations here: [https://developers.line.biz/en/reference/messaging-api/#carousel](https://developers.line.biz/en/reference/messaging-api/#carousel)

**Sample Payload for a Gallery or List Containing Messages:**

```json
{
  "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"
  }
}
```

## **Location**

Check required fields, file size & format limitations:

[https://developers.line.biz/en/reference/messaging-api/#location-message](https://developers.line.biz/en/reference/messaging-api/#location-message)

**Sample Payload for Location Containing Messages:**

```json
{
  "type": "location",
  "title": "Cognigy GmbH",
  "address": "Speditionstraße 1, 40221 Düsseldorf, North Rhine-Westphalia, Germany",
  "latitude": 51.214005624409445,
  "longitude": 6.748941454406442
}
```

**For more information please refer to Line Messenger Messaging API documentation:** [https://developers.line.biz/en/reference/messaging-api/#message-objects](https://developers.line.biz/en/reference/messaging-api/#message-objects)
