Skip to main content
All CollectionsIntegrationsLINE Messaging
Integrate LINE Messaging with Dotdigital
Integrate LINE Messaging with Dotdigital

Send LINE messages using our LINE Messaging integration.

Gareth Burroughes avatar
Written by Gareth Burroughes
Updated over 10 months ago

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.

Use our LINE integration to gather opt-ins and de-anonymise your LINE followers, so that you can engage with your LINE followers with personalised content using our automation programs.

The integration prompts new LINE followers and non opted-in followers to provide either their mobile number or email address in order to opt-in to messages from the business. You can customise the messaging the bot uses to ensure all communications are in keeping with your brand.

What the integration does

  • When a LINE user follows your LINE account, the integration engages with the user to request their mobile number or email address in order to opt-in to messaging.

  • Ensures that any entered mobile number or email address is in a valid format.

  • Automatically converts local mobile numbers to international numbers for a specified country.

  • Creates a Dotdigital contact once the opt-in process is complete and stores their LINE ID in a custom contact data field: LINE_ID.

  • Automatically clears the stored LINE ID for a contact if they unfollow your LINE account, preventing you from attempting to send to them again.


Before you start

Things you need to know:


Configure LINE

1. Add the LINE integration

After confirming with your Customer Success representative that you want to install the integration, we add the LINE integration in your Dotdigital account, and you must complete the setup in order to activate it.

  1. Go to Connect > Integrations.

  2. Find and select the LINE integration. You can use the search field in the top left.

  3. Select ADD.

  4. Select INSTALL.

  5. You’re presented with a brief summary of what the integration does, and a warning about the webhook for the LINE provider being overwritten during the setup; if you’re happy to proceed select NEXT.


2. Configure your LINE Messaging API authorisation

To allow Dotdigital to call the LINE Messaging API you need to enter the authorisation details. You can find these in the LINE Developers Console.

  1. Enter your LINE Providers’ LINE Channel access token. You can find this in the LINE Developers Console in the providers settings:

    1. Enter your LINE providers settings.

    2. Select the Messaging API tab.

    3. Go to the bottom of the tab settings 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. You can find this in the LINE Developers Console in the providers settings:

    1. Enter your LINE providers settings.

    2. Select the Basic settings tab.

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

  3. Select Create. 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 Dotdigital to link a LINE user to a Dotdigital contact, we automatically ask new LINE users that follow or message your LINE Provider for their mobile number or email address in order to proceed. You can customise the messaging used in the opt-in journey if you want to, or leave the messages as their defaults.

Enter any customised user messages you want to use, and then select NEXT to move on:

Setting

Purpose

Default message

Welcome message

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

Important: It is essential that the message is unambiguous, and states that by providing a mobile number or an email address the contact is consenting to be contacted by the provided channels.

Thanks for contacting us; for us to message you we need either your mobile number or email address please. Please reply with one to opt in to communications via LINE

Please wait message

To confirm we are checking the contact’s input is valid and we are opting them in.

Thank you 👍, please wait...

Complete and opted in

To confirm the process is complete and the contact is opted it.

All done, thanks for opting in

Already opted in

If a LINE follower tries to send you an additional message after opt in.

You're all good to go; nothing more to do here 👍

Invalid mobile number

If an invalid mobile number is entered.

Use the token [user_input] if you want to quote what the user entered back to them in your message.

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

Invalid email

If an invalid email address is entered.

Use the token [user_input] if you want to quote what the user entered back to them in your 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

General error

If an error occurs during the opt in process.

Sorry something went wrong, please send your email again

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


4. Select your default country code

You now need to select the country that is used as a default when trying to validate mobile phone numbers. The integration accepts any valid international phone number (E.164 format) or a local format mobile number which we attempt to internationalise using the default country you select.

It’s likely that LINE followers will provide their mobile number in local format.

  1. Select the country you want to use as a default when converting local numbers to international numbers from the drop down.

  2. Select NEXT to proceed.


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 has created a new contact data field in your account called LINE_ID.

If this field is populated, it indicates an opt in to be messaged using LINE, as the customer must have submitted their email address through the automated opt-in process.

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

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

Select FINISH to complete the setup.


6. Ensure LINE webhooks are enabled

You need to ensure that the LINE Providers Messaging API settings are correct.

To do this:

  1. Enter your LINE providers settings.

  2. Select the Messaging API tab.

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

  4. Ensure the Use webhook option is enabled.

  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.


Send a LINE message

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

We 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 must ensure that 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 program extension node in from the left hand menus Extensions section:

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

  4. For Headers, select Enter headers, then in the text field, enter
    Authorization: Bearer <LINE Channel access token>
    Example:
    Authorization: Bearer BBDeGYq1CZz7fZRuAfATsEEn2A25dfKVhi/Z8kL+saGOkU9SPYKQD38/LZzuCw4scLuTvIL1wPribpD+aKgZXjLXsPoc1La5iP8N94e5LWj1YwQK168/TQv+ZMtV4OPnoldZr5rJdnBSEotEkttZcAdB04t89/1O/w1cDnyilFU=
    Instructions for locating your access token are in Step 2 of the integration setup.

  5. Select APPLY.

  6. Expand the Content-type drop-down menu and select application/JSON.

  7. For Body data, select the edit icon and enter your message request in the text field (learn more below). Once done, select Apply.

    You can modify the examples below for the body to create your message send request, or craft a new one using the LINE Messaging API guidance here. You must ensure you copy in the "to": "@LINE_ID@" addressing element so that your message is sent 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?