LINE Channel for Claude Code
繁體中文 | English
Claude Code's channel system lets messaging platforms connect directly to a Claude Code session. This plugin adds LINE support — the only third-party LINE channel plugin available. Official support currently covers only Discord and Telegram.
Connect a LINE bot to your Claude Code with an MCP server. When someone messages the bot, the server forwards the message to Claude and provides tools to reply. Claude can respond to DMs and group chats, download media, and send images — all from within a Claude Code session.
Prerequisites
- Bun — the MCP server runs on Bun. Install with
curl -fsSL https://bun.sh/install | bash.
- A publicly accessible HTTPS endpoint for the webhook (e.g. behind nginx or Caddy).
Quick Setup
Single-user DM setup. See ACCESS.md for groups and multi-user setups.
1. Create a LINE Official Account and enable Messaging API.
As of September 2024, Messaging API channels can no longer be created directly from the LINE Developers Console. The new flow:
- Sign in to LINE Official Account Manager and create a LINE Official Account.
- In the account settings, find Messaging API and click Enable. Select or create a Provider when prompted.
- Open LINE Developers Console and navigate to the channel that was automatically created under your Provider.
On the channel page in LINE Developers Console:
- Basic settings tab → copy the Channel secret
- Messaging API tab → click Issue to generate a Channel access token (long-lived) and copy it
Back in LINE Official Account Manager, configure three pages under Settings:
Settings → Messaging API (/setting/messaging-api)
- Set the Webhook URL to your public HTTPS endpoint (e.g.
https://line-webhook.example.com/webhook)
- Click Save
Settings → Account settings (/setting) — only needed for group support
- Under Feature toggles, set Join groups and multi-person chats to Accept invitations
Settings → Response settings (/setting/response)
- Webhook: ON (enables LINE to deliver events to your webhook URL)
- Chat response method: set to Manual chat (not "Manual chat + Auto-response")
- Greeting message: turn OFF — Claude handles the follow event via webhook instead
2. Install the plugin.
These are Claude Code commands — run claude to start a session first.
Add the plugin marketplace:
claude plugin marketplace add NYCU-Chung/claude-line-channel
Install the plugin:
claude plugin install line@claude-line-channel
3. Configure credentials.
mkdir -p ~/.claude/channels/line
cat > ~/.claude/channels/line/.env << 'EOF'
LINE_CHANNEL_ACCESS_TOKEN=<your long-lived access token>
LINE_CHANNEL_SECRET=<your channel secret>
LINE_WEBHOOK_PORT=3456
EOF
chmod 600 ~/.claude/channels/line/.env
To run multiple bots on one machine (different tokens, separate allowlists), point LINE_STATE_DIR at a different directory per instance.
4. Expose the webhook.
Use nginx, Caddy, or any reverse proxy to forward HTTPS to http://localhost:<LINE_WEBHOOK_PORT>. Example nginx config:
server {
listen 443 ssl;
server_name line-webhook.example.com;
# ... SSL certificate config ...
location /webhook {
proxy_pass http://localhost:3456/webhook;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Line-Signature $http_x_line_signature;
}
}
After deploying, go back to Settings → Messaging API in LINE Official Account Manager, paste the URL, and click Save. Then use the Verify button in LINE Developers Console to confirm it returns HTTP 200.
5. Set up a session CLAUDE.md (recommended).
Copy the included template to your working directory. Claude will read it on startup and know how to behave as a LINE bot — including reading history.log for context after restarts.
cp ~/.claude/plugins/cache/claude-line-channel/line/*/examples/CLAUDE.md ~/my-line-bot/CLAUDE.md
Customize it to fit your use case (persona, language, rules, etc.).
6. Relaunch with the channel flag.
The server won't connect without this — exit your session and start a new one:
cd ~/my-line-bot
claude --dangerously-load-development-channels server:line
7. Allow your LINE user ID.
Create ~/.claude/channels/line/access.json:
{
"dmPolicy": "allowlist",
"allowFrom": ["Uxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"],
"groups": {}
}
To find your LINE user ID: add the bot as a friend and send it any message. Check ~/.claude/channels/line/unknown-dms.log — your user ID appears there on first contact. Add it to allowFrom and message again. (Unknown group IDs go to unknown-groups.log instead.)