To deliver LINE messages through Engage Studio, each parent segment profile must have a LINE User ID stored as a profile attribute. This page explains what a LINE User ID is, how to obtain one, and how to store it in your parent segment.
A LINE User ID is a unique identifier assigned to each LINE user per provider. It is distinct from a user's display name or their LINE ID (username).
- Format:
U[0-9a-f]{32}— for example,U8189cf6745fc0d808977bdb0b9f22995 - Scope: Provider-specific. The same LINE user will have different user IDs across different LINE providers (channels).
- Stability: The user ID for a given user does not change for a given provider.
A LINE User ID (Uxxxxxxxx...) is not the same as a user's LINE ID (the human-readable username like @example). Only the user ID in U[0-9a-f]{32} format can be used for message delivery via the Messaging API.
When a user adds your LINE Official Account as a friend or sends a message to it, LINE sends a webhook event to your configured webhook URL. The event payload includes the user's LINE User ID.
Webhook event example (follow event):
{
"events": [
{
"type": "follow",
"source": {
"type": "user",
"userId": "U8189cf6745fc0d808977bdb0b9f22995"
},
"timestamp": 1625000000000
}
]
}To collect user IDs this way, set up the Streaming Ingress Connector (LINE Messaging API Webhook) in Treasure Data. Webhook events are delivered in real time and stored in your Treasure Data database, where the userId field can be mapped to a parent segment profile attribute.
Refer to the LINE Messaging API Webhook setup guide for configuration details.
LIFF is a web app platform that runs inside the LINE app. When a user opens a LIFF app, you can retrieve their LINE User ID using the LIFF SDK:
liff.init({ liffId: "YOUR_LIFF_ID" }).then(() => {
liff.getProfile().then(profile => {
console.log(profile.userId); // "U8189cf6745fc0d808977bdb0b9f22995"
});
});LIFF is well suited for collecting user IDs at a specific touchpoint — for example, when a user registers for a loyalty program or completes a purchase within the LINE environment. The retrieved user ID can then be sent to Treasure Data via the JavaScript SDK or a server-side API call.
LIFF login sessions are managed entirely in the browser and are completely independent from your website's authentication session and from LINE Login. This means:
- Even if a user is already logged in to your website via LINE Login,
liff.isLoggedIn()returnsfalse. - Calling
liff.login()on a regular website triggers an unexpected LINE login redirect, even for already-authenticated users — which is a poor UX. - Conversely, being logged in via LIFF does not establish a login session on your website.
Recommendation: Use LIFF only in web apps that run exclusively inside the LINE app (LINE Mini Apps). For regular websites, use the server-side approach described below.
For regular websites (recommended): Have your application server output the LINE User ID to the page (as a JavaScript variable, cookie, localStorage, or data layer), then use the Treasure Data JavaScript SDK tag to include both the td_ssc_id and LINE User ID in web event logs stored in Treasure Data. This approach requires server-side development but avoids the session isolation issues inherent to LIFF.
LINE Login allows users to log in to your website or app with their LINE account. Upon successful authentication, the LINE Login API returns the user's LINE User ID as part of the profile object.
This method is appropriate for web or app-based registration flows where you want to associate a user's LINE identity with their existing account in your system.
For verified or premium LINE Official Accounts, LINE provides an API endpoint to retrieve the user IDs of all users who have added your account as a friend:
This is useful for bulk imports of existing followers into Treasure Data. Note that this endpoint is paginated and subject to rate limits.
The Get Follower IDs API is available only for verified or premium LINE Official Accounts. Standard accounts cannot use this endpoint.
Treasure Data does not provide a built-in connector for the Get Follower IDs API. To use this method, you must implement a custom script that calls the LINE API, handles pagination, and writes the resulting user IDs into a Treasure Data table. This can be run as a Treasure Workflow task. Contact your Treasure account representative for implementation guidance.
Regardless of the collection method, LINE User IDs must be stored as an attribute in your parent segment profile before they can be used for campaign targeting in Engage Studio.
Recommended approach:
- Collect LINE User IDs using one of the methods above.
- Store the user ID in your parent segment master table as a dedicated column (for example,
line_user_id). - In Engage Studio, when configuring a LINE campaign, select the parent segment profile attribute that contains the LINE User ID as the delivery target identifier.
To check whether a stored LINE User ID is valid, use the Get profile endpoint. A response with HTTP status 200 confirms the user ID is valid and the user is still a friend of your account. Invalid or blocked user IDs will result in a delivery error, which is recorded in the delivery log.