wangrongding /wechat-bot
🤖 Multi-platform IM AI Agent for Telegram, WhatsApp, Lark, and WeChat. Connects ChatGPT / Claude / Kimi / DeepSeek / Ollama / Pi for auto-replies, community analysis, contact management, and inactive-friend detection.
★ 11,522⑂ 1,308👁 63⑃ 48● 240▤ 2
+0
Daily
+0
Weekly
+84
Monthly
11,522
stars
1,308
forks
63
watchers
48
prs
240
issues
2
releases
README
WeChat Bot
English | Simplified Chinese
A WeChat / IM agent project based on Wechaty.
It can route IM messages received from WeChat QR-code login, Lark IM events, Telegram Bot API polling, or WhatsApp Cloud API webhooks to ChatGPT, DeepSeek, Ollama, Claude, Pi, and other services. It can also use OpenCLI wx-cli to access local WeChat chats, contacts, group members, favorites, and Moments cache, then run statistics or AI analysis for a group chat or a specific friend.
If you want to use Pi as the project agent and WeChat, Lark, Telegram, or WhatsApp as the external communication channel, start with Pi Agent + IM Guide.
Sponsors
AutoClaw · An AI agent that works for you, one click to connect WhatsApp / Telegram / Discord
Feature Overview
| Feature | Command entry | Status |
| --- | --- | --- |
| WeChat QR-code IM | wb agent --im wechat --agent pi / wb start --serve pi | Available. Logs in by QR code and replies to allowlisted messages |
| Pi as project agent | wb agent --im wechat/lark/telegram/whatsapp --agent pi | Available. Single-turn non-interactive replies by default |
| Local WeChat chats / contacts / group members | wb wx sessions, wb wx history, wb wx members | Integrated through OpenCLI wx-cli |
| Local Moments cache | wb wx sns-feed, wb wx sns-search | Integrated through OpenCLI wx-cli |
| Group / friend analysis | wb analyze --room "Group name", wb analyze --friend "Friend alias" | Supports local statistics and AI deep analysis |
| Lark IM | wb lark login, wb lark messages, wb lark send, wb lark agent | Supports login, read, search, send, and event-driven auto-replies |
| Telegram IM | wb telegram agent, wb telegram send | Supports Bot API long-polling receive and send |
| WhatsApp IM | wb whatsapp agent, wb whatsapp send | Supports WhatsApp Cloud API webhook receive and send |
| Multi-model replies | --serve ChatGPT/deepseek/ollama/pi/... | Reuses the existing provider mechanism |
Quick Start: Pi + WeChat IM
sh
npm i
cp .env.example .env
npm link
Configure at least the following values in .env:
env
BOT_NAME='@Your WeChat nickname'
ALIAS_WHITELIST='Friend alias allowed for private chat'
ROOM_WHITELIST='Group name allowed for access'
PI_BIN='pi'
PI_AGENT_ARGS='--print --no-session'
WECHAT_STORE_MESSAGES='true'
Start the agent:
sh
wb agent --im wechat --agent pi
When a QR code appears in the terminal, scan it with WeChat. The message pipeline is:
text
WeChat QR-code login - Wechaty receives message - local JSONL capture - Pi agent reply - WeChat IM sends reply
Trigger rules:
- Private chats: the sender alias or nickname must be in ALIAS_WHITELIST.
- Group chats: the group name must be in ROOM_WHITELIST, and the message must mention @BOT_NAME.
- Non-text messages are not automatically sent to the reply pipeline.
Note: WeChat Web protocols carry account risk, including warnings or bans. Use this only with accounts and scenarios where you explicitly accept the risk. Keep allowlists and u