Line

Line is one of the world’s most popular instant messaging platforms, used by hundreds of millions of monthly active users. Through this platform, brands can engage with their customers with rich and two-way messaging.

The Line and Braze integration allows you to leverage Braze webhooks, advanced segmentation, personalization, and triggering features to message your users in Line through the Line Messaging API. The Line Webhook template can be found on the Braze platform listed under Templates & Media.

Prerequisites

Line allows both promotional and non-promotional messaging to users as long as brands have secured users’ consent. To begin sending through Line, you will need to register your business with Line and set up a Line Business Account. Below we go through the requirements for sending Line messages through Braze.

Requirement Origin Access Description
Line Business Account Line https://www.linebiz.com/jp-en/ Brands will need to set up a Line Official Business Account to use Line’s Messaging API.

When sending Line messages, your messages will all be associated with your Line Official Account, resulting in users seeing your account name and page.
Messaging API Channel Line Using OA Manager Line Documentation When enabling the use of the Messaging API in the LINE Official Account Manager, a Messaging API channel is created. This will be the channel you use to communicate with your customers.
Channel Access Tokens Line Channel Access Token Line Documentation The channel access token will allow you to send messages to users that have added your Line Official Account as a friend. It can be found in your Line Developer Console under the Messaging API tab.
Line User IDs Line Get Follower IDs Line Documentation You need to have users’ Line IDs (this ID is different from users’ username) to send messages on Line.

Once a user adds your Line Official Account as a friend, you can access the user’s Line ID through Line’s Users API.

To send messages to users, they must meet one of two conditions:

  • Users who have added your LINE Official Account as a friend
  • Users who haven’t added your LINE Official Account as a friend but have sent a message to your LINE Official Account (excluding users who have blocked your LINE Official Account)

Integration Details

Step 1: Collect Your Customers Line IDs

To send messages on Line Messenger, you need to collect your users’ Line IDs to identify your user and interact with them consistently.

What is a Line ID?
Line IDs are not the same as the user’s Line usernames. This is an ID generated by Line that can be used when interacting with Line’s APIs.

Where do you find it?
To get a list of your customers’ Line IDs, use the User ID API that Line offers. The API will return a list of Line IDs for all users who have friended your LINE Official Account or sent your account a message and have not blocked you. When making a GET request to the endpoint https://api.line.me/v2/bot/followers/ids, you will get the following:

1
2
3
4
5
6
7
8
{
   "userIds":[
      "U4af4980629...",
      "U0c229f96c4...",
      "U95afb1d4df..."
   ],
   "next":"yANU9IA..."
}

What do I do with it?
Once you have a list of Line IDs, send it to Braze as a custom attribute called line_id.

Step 2: Send to Braze as a Custom Attribute

Coordinate and share this with your developers to send the Line IDs to Braze as a custom attribute. Line IDs are strings that can be accessed by making an API call.

Step 3: Set Your Channel Access Token as a Content Block

For the Braze Line Templates to work, you will need to input your Line Official Accounts Channel Access Token into Braze as a Content Block. Once you’ve set the channel access token inside a content block, you will be able to use the Line Webhook Templates to send messages to users that have added your LINE Official Account as a friend.

Find your Channel Access Token

Your channel access token can be found in the Line Developer Console under the Messaging API tab.

Line Channel Access Token

Create Content Block

Once you’ve grabbed your Line Channel Access Token, you will need to create a Braze Content Block and name it LINE_Channel_AccessToken. Copy and paste your channel access token into the content block and save it. To access Content Blocks, go into the Content Blocks Library tab in the Templates & Media section of the Braze dashboard.

Line Content Block Token

Usage

Braze currently supports the following Line Messaging types:

  • Text
  • Sticker
  • Image
  • Carousel

Line Message types

These are what each Line message type will appear like for your users.

Text: Text Line messages are text-based messages that support emojis.

Text Type

Sticker: Stickers can be used to make your bot app more expressive and engaging for your users. To send a sticker, include the sticker’s package ID and sticker ID in a message object. For a list of stickers that can be sent with the Messaging API, see the List of available stickers.

Sticker Type

Image: To send images, include URLs of the original image and a smaller preview image in the message object. The preview image is displayed in the chat, and the full image is opened when the image is tapped. Note that the URLs must use HTTPS over TLS 1.2 or later.

Image Type

From Templates & Media, go to Webhook Templates and choose the Line Messenger Webhook Template.

  1. Enter your Template Name, add teams, and add tags.
  2. Enter your message, sticker ID, or image depending on the Line template type you select.
  3. The custom attribute Line ID should be templated in the message body’s To: field. If not, include the Line ID as a custom attribute. This can be done by using the blue and white + button in the corner of the Request Body box.

Previewing and Testing Your Webhook

Before you send your message, test your webhook. Make sure your Line ID is saved in Braze (or find it and test as a Customized User), and use the preview to send the test message:

Sending a message to yourself

If you receive the message successfully, you can start to configure its delivery settings.

Targeting Line Users

You should create a segment for all users for whom the Line ID exists as a custom attribute and turn on Analytics Tracking to track your Messenger subscription rates over time. If you choose not to create a specific segment for Messenger subscribers, make sure to include a filter for Line ID existing to avoid errors:

Segment filter for Line IDs

You may also use other segmentation to target your Line campaigns and the rest of the campaign creation process, just like any other campaign.

WAS THIS PAGE HELPFUL?
New Stuff!