docs/book/src/channels/line.md
ZeroClaw supports LINE via the Messaging API — receiving messages through an embedded webhook server and replying via the Reply API (with Push API fallback when the reply token has expired).
channel-line feature on the zeroclaw-channels crate).Configure the LINE channel under [channels.line] with at minimum channel_access_token and channel_secret. See the Config reference for the full field index, defaults, and the dm_policy / group_policy enums (whose user-facing semantics are also covered in §6 below).
If you prefer not to store credentials in the config file, omit the token fields and export them as environment variables instead:
export LINE_CHANNEL_ACCESS_TOKEN="your-channel-access-token"
export LINE_CHANNEL_SECRET="your-channel-secret"
Environment variables take precedence over empty config fields.
LINE delivers messages by posting to your webhook URL. The embedded server listens on the configured webhook_port.
For local development (ngrok):
ngrok http 8443
Copy the https:// URL ngrok provides (e.g. https://abc123.ngrok.io).
For production: expose port 8443 (or the port you configured) behind an HTTPS reverse proxy (nginx, Caddy, etc.) or deploy directly on a server with a TLS certificate.
https://your-domain.com/line/webhook../target/release/zeroclaw --config zeroclaw.toml
Or via daemon mode:
zeroclaw daemon
Startup log signal:
LINE: webhook server listening on http://0.0.0.0:8443/line/webhook
dm_policy| Value | Behaviour |
|---|---|
pairing (default) | The bot ignores all DMs until the user sends /bind <code>. A pairing code is displayed in the ZeroClaw log at startup. |
open | The bot responds to every DM immediately. |
allowlist | The bot responds only to LINE user IDs listed in allowed_users. |
Pairing workflow:
/bind <code>.group_policy| Value | Behaviour |
|---|---|
mention (default) | The bot responds only when explicitly @mentioned. |
open | The bot responds to every message in the group. |
disabled | The bot ignores all group messages entirely. |
When transcription is enabled (via the global [transcription] config — see Config reference), LINE audio message events are automatically downloaded from the LINE Content API and transcribed before being passed to the model.
The maximum accepted audio size is 25 MB. Larger files are silently skipped with a log warning.
| Symptom | Likely cause | Action |
|---|---|---|
| LINE Verify fails | ZeroClaw not running, or port not reachable | Confirm the process is up and the port is accessible from the internet |
| Bot does not reply to DMs | dm_policy = pairing and user has not run /bind | User must send /bind <code> first, or switch to dm_policy = open |
| Bot does not reply in groups | group_policy = mention and message has no @mention | @mention the bot, or switch to group_policy = open |
| Reply arrives as a push message | Reply token expired (~30 s window) | Expected fallback behaviour — no action required |
| Audio messages ignored | [transcription] not configured | Add [transcription] block with enabled = true |
| Signal | Log message |
|---|---|
| Startup healthy | LINE: webhook server listening on http://0.0.0.0:<port>/line/webhook |
| Signature rejected | LINE: invalid X-Line-Signature |
| Unauthorized DM | LINE: DM from <userId> rejected by policy |
| Pairing required | LINE: unpaired user <userId>; ignoring until /bind |
| Audio ignored (no transcription) | LINE: audio message ignored (transcription not configured) |
| Audio transcription failed | LINE: transcription failed for <messageId>: |