繁體中文 | English
The LINE channel runs a webhook server that receives messages from LINE and forwards them to Claude Code. All access control lives in ~/.claude/channels/line/access.json (or $LINE_STATE_DIR/access.json). The file is re-read on every inbound message, so changes take effect immediately without a restart.
| Default DM policy | allowlist (drop all DMs unless userId is in allowFrom) |
| User ID format | Starts with U — e.g. Uxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| Group ID format | Starts with C — e.g. C1234567890abcdef |
| Room ID format | Starts with R |
| Config file | ~/.claude/channels/line/access.json |
dmPolicy controls how direct messages from users not on the allowlist are handled.
| Policy | Behavior |
|---|---|
allowlist (default) |
Drop silently. Only users in allowFrom can reach the bot. |
disabled |
Kill switch. Drops every message from every source — DMs, groups, and rooms — regardless of allowFrom or groups. Use this to quickly disable the bot without editing other fields. |
LINE user IDs are not directly visible in the app. The easiest way to find them:
- Add the bot as a friend on LINE.
- Send a message to the bot.
- The server logs the unknown userId to
$LINE_STATE_DIR/unknown-dms.logif the ID is not in the allowlist — check that file. (Unknown group/room IDs go tounknown-groups.loginstead.) - Alternatively, use the LINE Developers Console → Messaging API → your channel → see incoming webhook logs.
{
"dmPolicy": "allowlist",
"allowFrom": [
"Uxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
],
"groups": {
"C1234567890abcdef": {
"requireMention": true,
"allowFrom": []
}
},
"mentionPatterns": ["^hey claude\\b"],
"textChunkLimit": 5000,
"chunkMode": "newline",
"fullAccess": false
}| Field | Type | Default | Description |
|---|---|---|---|
dmPolicy |
"allowlist" | "disabled" |
"allowlist" |
How to handle DMs |
allowFrom |
string[] |
[] |
User IDs allowed to DM the bot. Empty = allow all (when policy is allowlist) |
groups |
object |
{} |
Group/room policies keyed by group ID or room ID |
mentionPatterns |
string[] |
[] |
Regex patterns that count as a mention (applied to message text) |
textChunkLimit |
number |
5000 |
Max characters per LINE message chunk |
chunkMode |
"length" | "newline" |
"newline" |
How to split long messages |
fullAccess |
boolean |
false |
true = upload_file may access any path on the host; false = inbox directory only |
| Field | Type | Default | Description |
|---|---|---|---|
requireMention |
boolean |
true |
Only respond when the bot is @mentioned or message matches mentionPatterns |
allowFrom |
string[] |
[] |
If non-empty, only these user IDs in the group can trigger the bot |
Groups are opt-in. Add the group ID to groups with a policy:
"groups": {
"C1234567890abcdef": {
"requireMention": true,
"allowFrom": []
}
}To find a group ID: when the bot receives a message from an unknown group, the group ID is logged to $LINE_STATE_DIR/unknown-groups.log.
With requireMention: true, the bot responds when:
- The message contains a structured
@botnamemention - The message text matches any regex in
mentionPatterns
Example — respond to "claude" anywhere in the message:
"mentionPatterns": ["\\bclaude\\b"]| Tool | Purpose |
|---|---|
reply |
Send a text message to a LINE chat. Takes chat_id + text. Auto-chunks long messages. Uses the free Reply API when possible (within 25 s of the inbound message), falls back to Push API. |
get_content |
Download a LINE media message (image, video, audio, file) to the inbox directory. Returns the file path and, for images, an inline preview. |
send_image |
Send an image to a LINE chat using publicly accessible HTTPS URLs. |
upload_file |
Upload a file from the inbox directory only to gofile.io with a password and expiry. Returns the download link and password. |
fetch_messages |
Returns a note that LINE does not provide message history for bots. |
LINE's Reply API is free but requires using the reply token within 30 seconds of the inbound message. The plugin stores tokens with a 25-second TTL and always tries Reply first.
The Push API is used as a fallback (and for chunked messages after the first 5). Push messages count against your LINE plan's monthly quota.
upload_fileenforces that the file is inside the inbox directory ($LINE_STATE_DIR/inbox/). Claude cannot be instructed via LINE messages to upload arbitrary files from the host.- The webhook endpoint verifies LINE's HMAC-SHA256 signature using constant-time comparison to prevent timing attacks.
- The
.envfile is chmod'd to 0600 on startup. access.jsonis written atomically via a temp file + rename.