LINENEW
Connect Sophon to LINE via the Messaging API.
Sophon connects to LINE using the official Messaging API. Inbound messages arrive at a Sophon webhook endpoint, and outbound messages are delivered through LINE's reply and push APIs. You'll create a Messaging API channel in the LINE Developers Console and paste two credentials into Sophon.
Prerequisites
- A LINE Developers account and a provider
- A Messaging API channel (the LINE "bot")
- A publicly reachable URL for your Sophon Gateway so LINE can deliver webhook events
Step-by-Step Setup
1. Create a Messaging API Channel
- Sign in to the LINE Developers Console
- Create (or select) a Provider
- Click Create a new channel and choose Messaging API
- Fill in the channel name, description, and category, then create it
2. Get Your Credentials
- Open the channel and go to the Basic settings tab
- Copy the Channel secret
- Go to the Messaging API tab
- Under Channel access token, issue a long-lived token and copy it
3. Configure in Sophon Dashboard
- Go to Channels and click Add Channel
- Select LINE
- Paste the Channel Access Token
- Paste the Channel Secret
- Click Test Connection — Sophon calls the LINE bot info endpoint to verify the token
- Click Activate
4. Set the Webhook URL
LINE pushes incoming messages to a webhook, so LINE must know where to reach your Sophon Gateway.
- In the Messaging API tab, set the Webhook URL to:
https://<your-sophon-host>/webhooks/line- Enable Use webhook
- Click Verify to confirm LINE can reach the endpoint
Each incoming event is validated against the X-Line-Signature header using your Channel Secret. If the secret is wrong or missing, events are rejected — make sure the value matches the one in the LINE console.
5. Test It
Add the channel as a friend (scan the QR code in the Messaging API tab) and send it a message. Sophon should reply in the same chat.
Configuration Reference
| Field | Type | Required | Description |
|---|---|---|---|
channelAccessToken | secret | Yes | Long-lived Channel Access Token from the LINE Messaging API tab |
channelSecret | secret | Yes | Channel Secret from the LINE Basic settings tab; used to verify webhook signatures |
channels.json Example
{
"id": "line-bot",
"type": "line",
"name": "Sophon LINE Bot",
"enabled": true,
"config": {
"channelAccessToken": "<encrypted>",
"channelSecret": "<encrypted>"
},
"routing": {
"agentId": "default",
"dmBehavior": "main-session",
"groupBehavior": "mention-only"
},
"status": "connected"
}Media Support
The LINE adapter currently processes text messages. Incoming non-text events (images, audio, video, files, stickers) are received by LINE but are not yet handled. Outbound replies are sent as text; an image caption, if present, is delivered as text.
| Type | Inbound | Outbound |
|---|---|---|
| Text | Yes | Yes |
| Images | No | Caption only (as text) |
| Audio | No | No |
| Video | No | No |
| Documents | No | No |
Troubleshooting
- Webhook verification fails in the LINE console — Confirm the URL is exactly
https://<your-sophon-host>/webhooks/lineand that the Gateway is publicly reachable over HTTPS. LINE does not accept plain HTTP. - Messages received but no reply — Make sure the channel is enabled in Sophon and that Use webhook is turned on. If signature verification fails, events are dropped silently; double-check the Channel Secret matches.
- "Test Connection" fails — The Channel Access Token is invalid or expired. Issue a new long-lived token in the Messaging API tab and re-paste it.
- Replies arrive late or stop working — LINE reply tokens are single-use and short-lived. If Sophon takes too long, it falls back to the push API, which requires a valid user ID. Confirm the user has added the bot as a friend.
- Push fails with a user ID error — Push messages require a LINE user ID (33 characters starting with
U). Group-only or unfriended recipients cannot be reached via push.
See also Telegram and Slack for other messaging integrations.