Skip to content

LINE setup

This article covers how to set up the LINE channel in Braze, including how to set up users, reconcile user IDs, and create LINE test users in Braze.

Prerequisites

You’ll need the following to integrate LINE with Braze:

Sending LINE messages from Braze will draw from your account’s Message Credits.

Types of LINE accounts

Required account type

To sync followers into Braze, your LINE account needs to be verified or premium. When you create an account, its default status will be unverified. You’ll need to request account verification.

Applying for a verified LINE account

  1. On the LINE Official Account page, select Settings.
  2. Under Information Disclosure Verification Status, select Request Account Verification.
  3. Enter the required information.
  4. Wait for a notification with the review results.

Integrating LINE

To set up consistent user updates, bring over existing users’ LINE IDs, and sync them all to LINE’s subscription states:

  1. Import or update existing known users
  2. Integrate the LINE channel
  3. Reconcile user IDs
  4. Change user update methods
  5. (Optional) Merge user profiles

Step 1: Import or update existing LINE users

This step is necessary if you have an existing and identified LINE user, as Braze will later automatically pull their subscription state and update the correct user profile. If you haven’t previously reconciled users with their LINE ID, skip this step.

You can import or update users using any of the methods that Braze supports, including the /users/track endpoint, CSV import, or Cloud Data Ingestion.

Regardless of the method you use, update the native_line_id to provide the user’s LINE ID. To learn more the native_line_id, see User setup.

Step 2: Integrate LINE channel

After the integration process completes, Braze will automatically pull that channel’s LINE followers into Braze. For any LINE IDs that are already associated with a Braze user profile, each profile will be updated with the “subscribed” status, and any LINE IDs that are remaining will generate anonymous users. Additionally, new followers of your LINE channel will have unidentified user profiles created when they follow the channel.

Step 2.1: Edit webhook settings

  1. In LINE, go the Messaging API tab and edit your Webhook settings:
    • Set the Webhook URL to https://anna.braze.com/line/events.
      • Braze will automatically change this to a different URL when integrating, based on your dashboard cluster.
    • Turn on Use webhook and Webhook redelivery.

      Webhook settings page to verify or edit the webhook URL, toggling on or off "Use webhook", "Webhook redelivery", and "Error statistics aggregation".
  2. Take note of the following information in the Providers tab:
  1. Go to your Settings page > Response settings and do the following:
    • Turn off Greeting message. This can be handled in Braze via trigger on follow.
    • Turn off Auto-response messages. All triggered messaging should be through Braze. This won’t prevent you from sending directly from the LINE console.
    • Turn on Webhooks.

Response settings page with toggles for how your account will handle chats.

Step 2.2: Generate LINE subscription groups in Braze

  1. Go to the Braze Technology Partners page for LINE and input the information you noted from your LINE Providers tab:
    • Provider ID
    • Channel ID
    • Channel secret
    • Channel access token

LINE messaging integration page with LINE integration section.

  1. After connecting, Braze will automatically generate a Braze subscription group for each LINE integration that’s successfully added to your workspace.

    Any changes to your followers list (such as new followers or unfollowers) will be automatically pushed into Braze.

LINE subscription groups section displaying one subscription group for the "LINE" channel.

Step 3: Reconcile user IDs

Combine your users’ LINE IDs with their existing Braze user profiles by following the steps in User ID reconciliation.

Step 4: Change your user update methods

Assuming you already have a method to provide user updates to Braze, you’ll need to update that to include the new field native_line_id so that subsequent user updates sent to Braze will include that field.

Unidentified user profiles with a native_line_id may exist in Braze that were created as part of the subscription status sync process, or when a new follower followed your channel.

When a LINE user is identified in your application through user reconciliation or other means, you can target a potential unidentified user profile in Braze using the /users/identify endpoint. Every unidentified user profile with a native_line_id also has a user alias line_id that can be used to target the user profile to identify.

Here is an example payload to /users/identify that targets an unidentified user profile by the user alias line_id:

1
2
3
4
5
6
7
8
9
10
11
{
   "aliases_to_identify": [
       {
           "external_id": "known_external_id_from_your_application",
           "user_alias": {
               "alias_name": "U89f4a626548ccd48482f529a482f138b",
               "alias_label": "line_id"
           }
       }
   ]
}

If no existing user profile exists for your provided external_id, it will be added to the unidentified user profile, making it identified. If a user profile does exist for the external_id, all attributes that are exclusively on the unidentified user profile will be copied to the known user profile, including native_line_id and the user’s subscription status.

You can update LINE users that are known in your application through the /users/track endpoint by passing their external identifiers and native_line_id. If an unidentified user profile already exists for a user and the same native_line_id is added to a different user profile through /users/track, it will inherit all the subscription states of the unidentified user profile. However, duplicate user profiles will exist with the same native_line_id. Any subsequent subscription updates from event updates will update all profiles accordingly.

Here is an example payload to /users/track that updates a user profile by the external user ID to add a native_line_id:

1
2
3
4
5
6
7
8
9
{
   "attributes": [
       {
           "external_id": "known_external_id_from_your_application",
           "native_line_id": "U89f4a626548ccd48482f529a482f138b",
           "other": "attribute"
       }
   ]
}

Step 5: Merge profiles (optional)

As described above, there’s a possibilty for multiple user profiles to exist with the same native_line_id. If your update methods create duplicate user profiles, you can merge unidentified user profiles to identified user profiles with the /user/merge endpoint.

Here’s an example payload to /users/merge that targets an unidentified user profile by user alias line_id:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
 "merge_updates": [
   {
     "identifier_to_merge": {
       "user_alias": {
         "alias_name": "U89f4a626548ccd48482f529a482f138b",
         "alias_label": "line_id"
       }
     },
     "identifier_to_keep": {
       "external_id": "known_external_id_from_your_application"
     }
   }
 ]
}

User setup

LINE is the source of truth for user subscription states. Even if you have the LINE ID for a user (native_line_id), if that user hasn’t followed the LINE channel you’re sending from, LINE won’t deliver messages to the user.

To help manage this, Braze offers tooling and logic that supports a well-integrated user base, including subscription syncing and event updates for LINE follows and unfollows.

Subscription syncing and event logic

  1. Subscription sync tool: This tool is automatically deployed after a successful LINE channel integration. Use it to update existing profiles and create new profiles.

    All Braze user profiles that have a native_line_id that follows the LINE channel will be updated to have a subscription group status of subscribed. Any follower of the LINE channel that doesn’t have a Braze user profile with the native_line_id will have:

    - An anonymous user profile created with native_line_id set to the user LINE ID following the channel
    - A user alias line_id set to the user LINE ID following the channel
    - A subscription group status of subscribed
  1. Event updates: These are used to update a user’s subscription status. When Braze receives user event updates for the integrated LINE channel and the event is a follow, the user profile will have a subscription group status of subscribed. If the event is an unfollow, the user profile will have a subscription group status of unsubscribed.

    - All Braze user profiles with a matching native_line_id will be automatically updated.
    - If no matching user profile exists for an event, Braze will create an anonymous user.

Use cases

These are use cases of how users can be updated after you follow the setup steps above.

Existing Braze user profile already follows LINE channel
  1. The Braze user profile is updated with a native_line_id attribute. Its default subscription status is unsubscribed.
  2. The subscription sync tool is run, finds that the user is following the LINE channel, and then updates the user profile with the subscription status subscribed.
  3. If any subscription status changes occur (such as the user blocks, unfriends, or refollows the channel), Braze receives the update from LINE and updates the user profile with the native_line_id accordingly.
Existing user profile has blocked, unfriended, or unfollowed LINE channel
  1. The Braze user profile is updated with a native_line_id attribute. Its default subscription status is unsubscribed.
  2. The subscription sync tool doesn’t find that the user is following the LINE channel and the user’s subscription status remains as unsubscribed.
  3. If the user later follows the channel, Braze receives the update from LINE and updates the user profile with the subscription status subscribed.
User profile creation occurs after LINE follow
  1. The channel gets a new LINE follower.
  2. Braze creates an anonymous user profile with the native_line_id attribute set to be the follower’s LINE ID, and a user alias of line_id set to be the follower’s LINE ID. The profile has a subscription status of subscribed.
  3. The user is identified as having the LINE ID through user reconciliation.
1
2
3
4
5
6
7
8
9
10
11
{
   "aliases_to_identify": [
       {
           "external_id": "known_external_id_from_your_application",
           "user_alias": {
               "alias_name": "U89f4a626548ccd48482f529a482f138b",
               "alias_label": "line_id"
           }
       }
   ]
}
  • A new user profile can be created (through the /users/track endpoint, CSV import, or Cloud Data Ingestion) by setting the native_line_id. This new profile will inherit the subscription status state of the existing anonymous user profile. Note that this will result in multiple profiles sharing the same native_line_id. These can be merged at any time using the /users/merge endpoint in the process outlined in Step 5.
User profile creation occurs before LINE follow
  1. You acquire a new user and send the information to Braze. A new user profile is created (profile 1).
  2. The user follows your LINE account.
  3. Braze receives a follow event and creates an anonymous user profile (profile 2).
  4. The user is identified as having the LINE ID through user reconciliation.
  5. You update profile 1 to set the native_line_id attribute. This profile inherits the subscription status state of profile 2.
    • Now there are two user profiles with the same native_line_id. These can be merged at any time using the /users/merge endpoint in the process outlined in Step 5.

User ID reconciliation

LINE IDs are automatically received by Braze when a user follows your channel, or when you use the one-time “sync followers” workflow. LINE IDs are also specific to the channel that users follow, so it’s unlikely that users can provide their LINE IDs.

There are two ways to combine a LINE ID with an existing Braze user profile:

LINE Login

This method uses social media logins for reconciliation. When a user logs into your app, they’re given the option to use LINE Login to create a user account or log in.

  1. Go to the LINE Developer Console and request permission to obtain the email addresses of users who log into your app through LINE Login.

  2. Follow the appropriate steps provided by LINE to implement LINE Login:

  1. Use the Verify ID token call to acquire the user’s email.

  2. Save the user’s LINE ID (native_line_id) to the user’s profile with a matching email in your database, or create a new user profile with the user’s email and LINE ID.

  3. Send the new or updated user information to Braze using the /user/track endpoint, CSV import, or Cloud Data Ingestion.

Workflows

Existing follower uses LINE Login

Scenario: An anonymous user was created during initial subscriber sync or after integration through a “follow” event.

  1. The user logs into your app using LINE Login.
  2. LINE provides you the user’s email.
  3. You send Braze the updated user (the existing user profile with that email to add the LINE ID) or you update the anonymous user with the email.
New follower uses LINE Login

Scenario: No user profile exists in Braze with the user’s LINE ID.

  1. The user logs into your app using LINE Login.
  2. LINE provides you with the user’s email.
  3. You either:
    • Update an existing user profile with that email to also have the user’s LINE ID.
    • Create a new user profile with the email and LINE ID.
  4. When the user follows your LINE Official Account, Braze receives a follow event and updates the user’s subscription status to subscribed.

User account linking

This method allows users to link their LINE account to your app’s user account. You can then use Liquid in Braze, such as {{line_id}}, to create a personalized URL for the user that passes the user’s LINE ID back to your website or app, which can then be associated with a known user.

  1. Create an action-based Canvas that is based on a subscription state change and triggers when a user subscribes to your LINE channel.
  2. Create a message incentivizing users to log into your website or app, passing the user’s LINE ID as a query parameter (through Liquid), such as:
1
Thanks for following Flash n' Thread on LINE! For personalized offers and 20% off your next purchase, sign-in to your account: https://flashandthread.com/sign_in?line_user_id=
  1. Create a follow-up message that delivers the coupon code.
  2. (Optional) Create an action-based campaign or Canvas that triggers when the LINE user is identified to send the user their coupon code.

How it works

After the user logs in, a change is made on your website or app so that the user ID is sent back to Braze to associate it with the LINE ID that was passed as part of the URL, with example code such as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const currentUrl = new URL(window.location.href)
const queryParams = new URLSearchParams(currentUrl.search);
const lineUserId = queryParams.get("line_user_id")

if (user && isLoggedIn && lineUserId) {
  post(
   "https://rest.iad-03.braze.com	/users/identify",
   {
     "aliases_to_identify": [
       {
   "external_id": user.getUserId(),
   "user_alias": {
     "alias_name": lineUserId,
     "alias_label": "line_id"
   }
 }
      ]
    }
  )
  braze.logCustomEvent("identified_line_user_for_promotion");
}

Workflows

Existing user follows your LINE channel

Scenario: An existing user in Braze follows your channel on LINE.

  1. LINE sends Braze a follow event.
  2. Braze creates an anonymous user profile with the LINE ID, line_id user alias, and LINE subscription group status of subscribed.
  3. The user receives a LINE message with a link to your website and app and logs in. Their user profile is now known.
  4. The anonymous user profile that was created is identified and is merged through the /users/identify endpoint onto the user’s known user profile. The known user profile now contains the LINE ID and has a subscription status of subscribed.
  5. (Optional) The user receives a LINE message with the coupon code and Braze logs the send to the Braze user profile.

Creating LINE test users in Braze

You can test your LINE channel before setting up user reconciliation by creating a “Who am I” Canvas or campaign.

  1. Set up a Canvas that returns a user’s Braze user ID on a specific trigger word.

    Example trigger

    Trigger to send the campaign to users who sent an inbound LINE to a specific subscription group.

    Example message

    LINE message stating the Braze user ID.

  2. In Braze, you can use the Braze ID to search for specific users and modify them as needed.

HOW HELPFUL WAS THIS PAGE?
New Stuff!