docs/usage/channels/line.mdx
By connecting a LINE channel to your LobeHub agent, users can interact with the AI assistant through LINE direct messages, group chats, and multi-person rooms. The integration uses the official LINE Messaging API — there is no third-party broker between LINE and LobeHub.
Important change (since 2024-09-04): LINE no longer lets you create a Messaging API channel directly from the LINE Developers Console. You must first create a LINE Official Account and enable the Messaging API on it from LINE Official Account Manager — the channel then appears automatically in the Developers Console.
Open entry.line.biz and sign in with your LINE Business ID. Fill in the account name, business category, and region, then submit. Confirm the new account appears in LINE Official Account Manager.
Open the new account → Settings → Messaging API → click Enable Messaging API. You will be asked to:
Heads-up: the provider assignment is permanent. If you manage multiple unrelated services, give each one its own provider.
Sign in to LINE Developers Console with the same LINE Business ID, open the provider you just chose, and the Messaging API channel will appear automatically.
Open the Basic settings tab and copy the Channel secret — LobeHub uses it to verify webhook signatures in Step 4.
Note: the "Your user ID" field on the same tab is your own LINE user ID, not the bot's destination user ID. Both have the identical
U+ 32 hex format, but LobeHub needs the bot's, which is resolved automatically from the Channel Access Token in Step 4.
Then open the Messaging API tab and note:
@xxxx short ID users will search for.
</Steps>
Scroll to the bottom of the Messaging API tab. You will see a Channel access token section.
Click Issue under "Channel access token (long-lived)". Copy the token immediately — LINE only shows it once.
Important: The Channel Access Token and Channel Secret are sensitive credentials. Never commit them to source control or share them in screenshots.
</Steps>
By default the LINE Official Account Manager auto-replies to user messages and sends a greeting on first contact. These compete with LobeHub's responses, so they must be turned off.
<Steps> ### Open the LINE Official Account ManagerIn the Messaging API tab, click the LINE Official Account Manager link to open the management UI for the channel's Official Account.
Go to Settings → Messaging API (or Response settings) and set:
This leaves your bot to handle every inbound message itself. </Steps>
In LobeHub, navigate to your agent's settings, then select the Channels tab. Click LINE from the platform list.
Recommended order — paste the token first so LobeHub can auto-fill the Destination User ID:
GET /v2/bot/info with the token you just pasted and fills in the bot's userId (33 chars, starts with U) for you. You can also type/paste it manually if you already have it.Why the auto-fetch? The LINE Developers Console does not display the bot's destination user ID anywhere —
<details> <summary>Manual alternative (if the button is unavailable)</summary>/v2/bot/infois the only way to read it. The Fetch from LINE button removes the manualcurlstep.bashcurl -H "Authorization: Bearer <YOUR_CHANNEL_ACCESS_TOKEN>" \ https://api.line.me/v2/bot/infoCopy the
</details>userIdfield from the response into the Destination User ID field.
Click Save Configuration. LobeHub will encrypt your credentials, call GET /v2/bot/info once to verify the token works and that the bot user ID matches your Destination User ID, and surface a Webhook URL for the next step.
Note: Unlike Telegram, the LINE Messaging API does not allow programmatic webhook registration. LobeHub cannot wire the URL for you — you must paste it in the LINE Developers Console yourself in Step 5.
</Steps>
In LobeHub's LINE channel detail page, copy the Webhook URL displayed under the credentials section. It looks like https://app.lobehub.com/api/agent/webhooks/line/<your-destination-user-id>.
Back in the Messaging API tab of your channel:
POST with events: [] to LobeHub, which responds 200 if the Channel Secret matches.Open the Messaging API tab in the LINE Developers Console and scan the bot's QR code with your phone, or search for the Bot basic ID (e.g. @abc1234x) in LINE.
Send any message to the bot in LINE. Within a few seconds your LobeHub agent should reply.
Click Test Connection in LobeHub's channel settings to re-verify the token and the bot identity match. Errors are surfaced with the exact LINE error message. </Steps>
To use the bot in LINE group chats or multi-person rooms:
... → Invite).Note: Allowing your bot to join groups and rooms requires enabling "Allow bot to join group chats" in the LINE Official Account Manager (Response settings). It is off by default.
| Field | Required | Description |
|---|---|---|
| Destination User ID | Yes | The bot's user ID (U + 32 hex chars). LobeHub auto-fills this via the Fetch from LINE button (calls GET /v2/bot/info with the access token); the LINE Developers Console UI does not display the value. Used as the bot identity and webhook path segment. |
| Channel Access Token | Yes | Long-lived token issued from the Messaging API tab. Used as the bearer header on every LINE API call. |
| Channel Secret | Yes | From the Basic settings tab. Used to verify X-Line-Signature on every inbound webhook delivery. |
LINE's Messaging API has a few specifics that LobeHub maps as follows:
/v2/bot/message/push) rather than the reply API, because the reply token expires in ~60s while agent generation can take longer. Push messages count against your channel's monthly quota for paid plans; the free Developer Trial is unlimited.Authentication failed. on Save / Test Connection. Your Channel Access Token is invalid or expired. Re-issue the long-lived token in the Messaging API tab and paste the new value into LobeHub.Channel access token belongs to bot Uxxx, not Uyyy. The Destination User ID does not match the token. Easiest fix: clear the field and click Fetch from LINE to re-pull the correct userId. The Uxxx shown in the error is also the userId the token actually belongs to — you can paste it in directly. (Manual check: curl -H "Authorization: Bearer <token>" https://api.line.me/v2/bot/info.)401 Invalid signature. The Channel Secret in LobeHub doesn't match the one in LINE. Update LobeHub with the correct Channel Secret.