Bridge WeChat ClawBot messages to a local claude CLI session via the official WeChat ilink API — no Claude development channels required.
把微信 ClawBot 消息桥接到本地
claude命令行,无需依赖 Claude development channels。
WeChat User
│
▼
WeChat ClawBot (ilink API)
│ long-poll (getupdates)
▼
wechat-channel.ts ◄──── this project
│ spawn
▼
claude CLI (-p, --session-id)
│
▼
Current working directory / tools
│
▼
Reply text ──► WeChat user
Each WeChat sender gets an isolated Claude session. Sessions, chat history, and long-term summaries are persisted under ~/.claude/channels/wechat/.
- Bun >= 1.0
claudeCLI installed and working locally (claude --version)- A WeChat account eligible for ClawBot
git clone https://github.com/majiabin2020/Claude-Code-WeChat-Gateway.git
cd Claude-Code-WeChat-Gateway
bun installRun the setup tool to authenticate via QR code:
bun setup.tsScan the QR code with WeChat. Credentials are saved to:
~/.claude/channels/wechat/account.json
Re-run bun setup.ts if the bot token expires.
bun run startThe gateway will:
- Long-poll the WeChat ilink API for incoming messages
- Maintain a separate Claude session per WeChat sender
- Call the local
claude -pCLI directly - Send Claude's reply back to WeChat
Send any message to your WeChat ClawBot. The gateway forwards it to Claude and replies in the chat.
Built-in commands:
| Command | Effect |
|---|---|
/reset |
Clear context, session, and history for your user |
/clear |
Same as /reset |
清空上下文 |
Same as /reset (Chinese alias) |
重置上下文 |
Same as /reset (Chinese alias) |
| Path | Content |
|---|---|
~/.claude/channels/wechat/account.json |
WeChat bot credentials |
~/.claude/channels/wechat/cli_sessions.json |
Per-sender Claude session IDs |
~/.claude/channels/wechat/chat_history.json |
Recent message history |
~/.claude/channels/wechat/chat_summary.json |
Long-term conversation summaries |
| Symptom | Check |
|---|---|
| No reply at all | Is claude runnable in the terminal? |
No WeChat polling started. in logs |
Check credentials / re-run bun setup.ts |
Claude processing failed |
Local Claude CLI call failed — check claude config |
WeChat reply failed |
ilink API error — check network / token expiry |
| Session expired error | Re-run bun setup.ts to refresh the bot token |
├── wechat-channel.ts # Main gateway: WeChat polling + Claude CLI bridge
├── setup.ts # WeChat QR login tool
├── package.json
├── tsconfig.json
└── bun.lock
MIT