LINE Messaging

Send LINE messages using our LINE Messaging integration.

Gareth Burroughes avatar
Written by Gareth Burroughes
Updated this week

Use our LINE integration to enable the LINE node in automation programs, which can be used to send LINE messages to opted-in customers.

The LINE Integration is currently only available as a private preview; please contact your Customer Success Manager if you are interested in using this integration.


Before you start

Things you need to know:

  • You must have a LINE Business account.

    • You can register for LINE through your app.

  • Can log into the LINE Developers Console.

    • You are limited to 1000 messages per month without a rate plan by LINE.

  • Have a LINE provider registered in the LINE Developer Console you want to use with Dotdigital with the Messaging API channel enabled. Instructions on how to do this can be found here.

    We will need to remap the webhook to point at Dotdigital’s services, and therefore, it shouldn’t be in use with any other service.


Configuring LINE

1. Complete the settings for the LINE integration

Dotdigital creates an instance of the LINE integration in your account. You must complete the settings in order to activate it.

To complete your LINE integration settings:

  1. Go to Connect > Integrations.

  2. In the left menu, under SHOW, select Installed.

  3. Find LINE, then select SETUP.

  4. You‘re presented with a brief summary of functionality and a warning about the webhook for the LINE provider being overwritten during the setup; if you are happy to proceed select Ok.

    If you do not want to continue, select Cancel.

line-message-integration.png

2. Configure your LINE Messaging API authorisation

To allow Dotdigital to call the LINE Messaging API you need to enter the authorisation details.

  1. Enter your LINE Providers’ LINE Channel access token.

    This can be found in the LINE Developers Console:

    1. Go to your LINE providers settings.

    2. Select the Messaging API tab.

    3. Go to the bottom of the tab and you see the Channel access token (long-lived) field.

    4. If a value is shown, copy the value and enter it in the settings, otherwise select Issue to create a new token.

  2. Enter your LINE Providers’ LINE Channel secret which can be found in the LINE Developers Console:

    1. Go to your LINE providers settings.

    2. Select the Basic settings tab.

    3. Go to the bottom of the tab and you see the Channel secret field. Copy the value and enter it in the settings.

  3. Select Next.

  4. The details entered are checked and your LINE Providers webhook is configured to send data to Dotdigital.

3. Configure the opt in journey

To allow a LINE user to be linked to a Dotdigital contact, we automatically ask new LINE users that follow or message your LINE Provider for their email address. You can customise the messaging used in the opt in journey if you want to, or leave the messages as their defaults.

Setting

Purpose

Default message

Message 1

To prompt the LINE user to enter their email address to confirm opt in.

Important: It is important that the message is unambiguous and states by providing an email address they are consenting to be contacted and by what channels

Thanks for contacting us; for us to message you we need your email address please. Please reply with it to opt in to communications via LINE and email

Response 1

To confirm the email entered is valid and we are opting them in

Thank you 👍, please wait...

Response 2

To confirm all is complete and they are opted it

All done, thanks for opting in

Response 3

If an error occurs during the opt in process

Sorry something went wrong, please send your email again

Response 4

An invalid email address is entered

Note: use the token [user_input] if you want to quote what the user entered back in the message

[user_input]' is not a valid email address; if you would like us to be able to message you via LINE please reply with your email address

The logical flow of the opt in process and where the messages are used is illustrated below:

logical-flow.png

Select Submit to complete the setup.

4. Ensure LINE webhooks are enabled

You now need to ensure that the LINE Providers Messaging API settings are correct by following these steps:

  1. Go to your LINE providers settings.

  2. Select the Messaging API tab.

  3. Ensure that the Webhook URL field has a URL populated.

  4. Enable the Use webhook option.

  5. Open the Greeting messages options by selecting Edit at the end of the fields line.

  6. In the Main settings section:

    1. Ensure that Response mode is set to Bot.

    2. You can use a Greet message but be mindful of the user experience with the opt in flow.

  7. In the Detailed settings section:

    1. Ensure that Auto-response is disabled.

    2. Ensure that Webhooks is enabled.

5. Setup complete

You have now performed all the necessary steps to enable Dotdigital to use your LINE Provider to message your LINE users.

The integration creates a new contact data field in your account called LINE_ID If this field is populated it indicates an opt in to be messaged through LINE, as the customer must have submitted their email address via the automated opt-in process.

You must not populate the LINE_ID field yourself; it is only intended to be modified by the integration.


Send a LINE message

To use the LINE Messaging API you need to use the LINE Program extension in an automated program to call the LINE Messaging API.

You can send LINE messages to any contact that has a populated LINE_ID contact field.

We automatically create an automated program in your account called Example LINE send that demonstrates how to make a call using the program extension to the LINE Messaging API.

The example is a simple text based message but you can send any message the LINE Messaging API supports. To alter the message select the Line message node in the Example LINE send program.

You should ensure all messaging you send complies with the LINE Messaging API terms.


Add a LINE message node

  1. Open or create a new program you want to add the LINE message node to.

  2. Drag the LINE message node from the Extensions section of the left hand menu:

  3. Select the LINE message node you added to open its settings.

  4. Select the Headers edit button.

    1. Go to your LINE providers settings.

    2. Select the Messaging API tab.

    3. Scroll to the bottom of the tab and you see the Channel access token (long-lived) field.

    4. If a value is shown, copy the value and enter it in the settings, or select the Issue button to create a new token.

      Authorization: Bearer <LINE Channel access token>`
      Authorization: Bearer BBDeGYq1CZz7fZRuAfATsEEn2A25dfKVhi/Z8kL+saGOkU9SPYKQD38/LZzuCw4scLuTvIL1wPribpD+aKgZXjLXsPoc1La5iP8N94e5LWj1YwQK168/TQv+ZMtV4OPnoldZr5rJdnBSEotEkttZcAdB04t89/1O/w1cDnyilFU=`

  5. Select the Body data edit button to enter your message request.

  6. Modify the examples below for the body, create your message send request, or craft a new one using the LINE Messaging API guidance.

    You must ensure you copy in the "to": "@LINE_ID@" addressing element so it goes to the selected contact:

{
"to": "@LINE_ID@",
"messages": [
{
"type": "text",
"text": "Example text message"
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "sticker",
"packageId": "446",
"stickerId": "1988"
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "image",
"originalContentUrl": "https://example.com/original.jpg",
"previewImageUrl": "https://example.com/preview.jpg"
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "video",
"originalContentUrl": "https://example.com/original.mp4",
"previewImageUrl": "https://example.com/preview.jpg"
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "audio",
"originalContentUrl": "https://example.com/original.m4a",
"duration": 60000
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "location",
"title": "my location",
"address": "1-6-1 Yotsuya, Shinjuku-ku, Tokyo, 160-0004, Japan",
"latitude": 35.687574,
"longitude": 139.72922
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "imagemap",
"baseUrl": "https://example.com/bot/images/rm001",
"altText": "This is an imagemap",
"baseSize": {
"width": 1040,
"height": 1040
},
"video": {
"originalContentUrl": "https://example.com/video.mp4",
"previewImageUrl": "https://example.com/video_preview.jpg",
"area": {
"x": 0,
"y": 0,
"width": 1040,
"height": 585
},
"externalLink": {
"linkUri": "https://example.com/see_more.html",
"label": "See More"
}
},
"actions": [
{
"type": "uri",
"linkUri": "https://example.com/",
"area": {
"x": 0,
"y": 586,
"width": 520,
"height": 454
}
},
{
"type": "message",
"text": "Hello",
"area": {
"x": 520,
"y": 586,
"width": 520,
"height": 454
}
}
]
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"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"
}
]
}
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "template",
"altText": "this is a confirm template",
"template": {
"type": "confirm",
"text": "Are you sure?",
"actions": [
{
"type": "message",
"label": "Yes",
"text": "yes"
},
{
"type": "message",
"label": "No",
"text": "no"
}
]
}
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"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"
}
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "template",
"altText": "this is a image carousel template",
"template": {
"type": "image_carousel",
"columns": [
{
"imageUrl": "https://example.com/bot/images/item1.jpg",
"action": {
"type": "postback",
"label": "Buy",
"data": "action=buy&itemid=111"
}
},
{
"imageUrl": "https://example.com/bot/images/item2.jpg",
"action": {
"type": "message",
"label": "Yes",
"text": "yes"
}
},
{
"imageUrl": "https://example.com/bot/images/item3.jpg",
"action": {
"type": "uri",
"label": "View detail",
"uri": "http://example.com/page/222"
}
}
]
}
}
]
}

{
"to": "@LINE_ID@",
"messages": [
{
"type": "flex",
"altText": "this is a flex message",
"contents": {
"type": "bubble",
"body": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "text",
"text": "hello"
},
{
"type": "text",
"text": "world"
}
]
}
}
}
]
}
Did this answer your question?