π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
LINE Messaging API β Bot Integration Notes
Quick orientation map for engineers working on the LINE adapter. Authoritative documentation:
- Messaging API overview: https://developers.line.biz/en/docs/messaging-api/
- Webhook reference: https://developers.line.biz/en/reference/messaging-api/#webhooks
- Get bot info: https://developers.line.biz/en/reference/messaging-api/#get-bot-info
- Send push message: https://developers.line.biz/en/reference/messaging-api/#send-push-message
- Display loading indicator: https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator
- Get content: https://developers.line.biz/en/reference/messaging-api/#get-content
Credentials
| Field | Source | Notes |
|---|---|---|
applicationId |
GET https://api.line.me/v2/bot/info β userId |
The bot's destination user ID (U + 32 hex chars), also the destination field on every webhook payload. The LINE Developers Console UI does not surface this value β the "Your user ID" on the channel's Basic settings tab is the operator's own LINE user ID, not the bot's. Operators must call the API (or rely on validateCredentials echoing the correct value back in the Channel access token belongs to bot Uxxx error). |
channelAccessToken |
LINE Developers Console β Messaging API tab β "Issue token" | Long-lived. Bearer header for every API call. |
channelSecret |
LINE Developers Console β Basic settings tab | Used to validate X-Line-Signature on every inbound POST. Required, no fallback. |
Webhook lifecycle
- No GET handshake. LINE Developers Console verifies the webhook URL by
sending a
POSTwith{ destination, events: [] }when the operator clicks the "Verify" button. We accept that ping (200 OK) once the signature checks out β the emptyeventsarray is what makes it harmless. - POST notification β LINE sends a JSON body with
destinationand one or moreevents[]. We only handleevent.type === "message". - Signature validation β every POST must carry an
X-Line-Signatureheader equal to base64(HMAC-SHA256(rawBody, channelSecret)). Note the base64 encoding (WhatsApp uses hex withsha256=prefix). Mismatched or missing signatures get a 401 and are dropped.
Payload shape (inbound)
{
"destination": "U<bot-user-id>",
"events": [
{
"type": "message",
"mode": "active",
"timestamp": 1700000000000,
"source": { "type": "user", "userId": "Uabc..." },
"webhookEventId": "01H...",
"deliveryContext": { "isRedelivery": false },
"replyToken": "...",
"message": { "type": "text", "id": "1000", "text": "hi bot" },
},
],
}
source.type β user / group / room. We encode the platform thread id
as line:<type>:<sourceId> where sourceId is userId / groupId /
roomId respectively. The thread id determines whether typing indicators
are available (only user).
Media messages (image, video, audio, file) carry only id β
no caption, no inline mime. file additionally carries fileName and
fileSize. Bytes are fetched on demand by the platform client's
extractFiles via GET <data-host>/v2/bot/message/<id>/content with the
bearer header.
replyToken is single-use and expires in ~60 seconds. We always use
the push API instead because the agent's response can take longer than
that. Push messages count against the channel's monthly quota for paid
plans; for the free Developer Trial it's effectively unlimited.
Outbound
POST /v2/bot/message/push with
{
"messages": [{ "type": "text", "text": "β¦" }],
"to": "<wa_id>"
}
to is the recipient's userId / groupId / roomId, decoded from the
platform thread id.
Capabilities
- No edit / no delete β Messaging API has no edit endpoint. The platform
definition sets
supportsMessageEdit: false; the bridge therefore skips per-step progress edits and only emits the final reply. - Markdown β LINE renders text as plain text only. The platform client's
formatMarkdownrunsstripMarkdownto strip emphasis / heading / list markers before sending. - Typing indicator β
POST /v2/bot/chat/loading/startwith{ chatId, loadingSeconds }. Only valid for 1:1 user chats βgroupandroomthreads silently no-op. - Reactions β LINE does not let bots send reactions; the messenger's reaction methods are no-ops.
Operator-facing setup
Webhook URL must be configured manually in the LINE Developers Console
(Messaging API β Webhook settings β Webhook URL). After pasting it the
operator presses "Verify" β that fires a signed POST with events: []
to our endpoint. Operator must also enable "Use webhook" and disable the
LINE Official Account Manager "Auto-reply messages" / "Greeting messages"
to prevent the platform from competing with our bot's responses.