LINE Messaging API channel plugin for Claude Code
npx claudepluginhub nycu-chung/claude-line-channelConnect a LINE bot to Claude Code — receive and reply to LINE DMs and group chats
繁體中文 | 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.
curl -fsSL https://bun.sh/install | bash.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:
On the channel page in LINE Developers Console:
Back in LINE Official Account Manager, configure three pages under Settings:
Settings → Messaging API (/setting/messaging-api)
https://line-webhook.example.com/webhook)Settings → Account settings (/setting) — only needed for group support
Settings → Response settings (/setting/response)
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_DIRat 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.)