Sophon Docs
Channels

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

  1. Sign in to the LINE Developers Console
  2. Create (or select) a Provider
  3. Click Create a new channel and choose Messaging API
  4. Fill in the channel name, description, and category, then create it

2. Get Your Credentials

  1. Open the channel and go to the Basic settings tab
  2. Copy the Channel secret
  3. Go to the Messaging API tab
  4. Under Channel access token, issue a long-lived token and copy it

3. Configure in Sophon Dashboard

  1. Go to Channels and click Add Channel
  2. Select LINE
  3. Paste the Channel Access Token
  4. Paste the Channel Secret
  5. Click Test Connection — Sophon calls the LINE bot info endpoint to verify the token
  6. Click Activate

4. Set the Webhook URL

LINE pushes incoming messages to a webhook, so LINE must know where to reach your Sophon Gateway.

  1. In the Messaging API tab, set the Webhook URL to:
https://<your-sophon-host>/webhooks/line
  1. Enable Use webhook
  2. 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

FieldTypeRequiredDescription
channelAccessTokensecretYesLong-lived Channel Access Token from the LINE Messaging API tab
channelSecretsecretYesChannel 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.

TypeInboundOutbound
TextYesYes
ImagesNoCaption only (as text)
AudioNoNo
VideoNoNo
DocumentsNoNo

Troubleshooting

  • Webhook verification fails in the LINE console — Confirm the URL is exactly https://<your-sophon-host>/webhooks/line and 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.