LINE

Dialogflow's LINE Integration allows you to easily create LINE bots with natural language understanding based on Dialogflow technology.

Set Up LINE

In order to set up the LINE integration for your agent, you'll need the following:

  • a LINE account
  • the LINE app installed on a mobile device

Create a LINE bot

  1. Log in to LINE's developer website and click Messaging API.
  2. Click Start Now.
  3. Create or choose a provider.

    If you created a new provider, click on Create Channel under Messaging API.

  4. Click Next Page.

  5. Enter an app name and description.

  6. Choose a plan.

  7. Choose an app category and subcategory.

  8. Enter your email address.

  9. Click Confirm.

  10. Confirm the information on the following page.

  11. Check the terms of use options.

  12. Click Create.

Set up Dialogflow

  1. Click Integrations in the left menu.
  2. Click the LINE tile.
  3. Copy the Webhook URL.

Enable webhook in LINE

  1. Click on the newly created app.
  2. Under Channel access token (long-lived), click Issue.
  3. Under Use webhooks, click edit and Enable.
  4. Under Webhook URL, paste the copied URL.
  5. Copy or make note of the Channel ID, Channel secret, and Channel access token.

Continue Dialogflow set up

  1. Paste the Channel ID, Channel secret, and Channel access token into the related fields of the integration pop up.
  2. Choose an environment, as applicable.
  3. 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"
      }
    ]
  }
}