LINE

With Dialogflow's LINE integration, you can use your Dialogflow agent as a LINE bot.

Limitations

Only the default agent language is supported by this integration.

How it works

This is how the integration works:

  • You create a LINE channel.
  • You associate your Dialogflow agent with that channel, so that they communicate with each other.
  • The Dialogflow integration sends messages to the end-user by using the LINE Messaging API.
  • The Dialogflow integration receives messages from the end-user by acting as the LINE Webhook.

Setup

To set up the integration:

  1. Follow the steps to create a LINE channel: Getting started with the Messaging API.
  2. Get the LINE webhook URL from the Dialogflow Console:
    1. Go to the Dialogflow ES Console.
    2. Click Integrations in the left sidebar menu.
    3. Click LINE.
    4. Copy the Webhook URL value. You will need this to configure your LINE webhook.
  3. Configure a LINE webhook:
    1. Follow the steps to configure a LINE webhook for your channel: LINE Receiving messages (webhooks).
    2. Provide the LINE webhook configuration with the webhook URL copied above.
    3. Copy the Channel ID, Channel secret, and Channel access token values. You will need these values to configure your Dialogflow integration.
  4. Configure the Dialogflow integration:
    1. Go to the Dialogflow ES Console.
    2. Click Integrations in the left sidebar menu.
    3. Click LINE.
    4. Paste the Channel ID, Channel secret, and Channel access token into the respective fields.
    5. Choose an environment, as applicable.
    6. Click START.

Testing

To test your agent, tap on the three horizontal dots on the main screen of the LINE app. Then tap the QR code icon and scan the QR code on the settings page of your bot. This adds your bot to the list of conversations.

Rich response messages

The following rich response messages are supported.

Image responses

A Dialogflow image response type is sent to LINE as a LINE image message type.

The supported formats and sizes are as follows:

  • jpeg
  • 1 MB max size
  • 240 x 240 max dimensions

Card responses

A Dialogflow card response type is sent to LINE as a LINE template message type.

Quick reply responses

A Dialogflow quick reply response type is sent to LINE as a LINE template message type.

Custom payload responses

You can send most LINE message types with a custom payload response.

For example, the following custom payload provides a LINE template message:

{
  "type": "template",
  "altText": "this is a buttons template",
  "template": {
    "type": "buttons",
    "thumbnailImageUrl": "https://example.com/bot/images/image.jpg",
    "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"
      }
    ]
  }
}