Multi-platform IM AI Agent for Telegram, WhatsApp, Lark, and WeChat. Connects ChatGPT / Claude / Kimi / DeepSeek / Ollama / Pi for auto-replies, community an
Multi-platform IM AI Agent for Telegram, WhatsApp, Lark, and WeChat. Connects ChatGPT / Claude / Kimi / DeepSeek / Ollama / Pi for auto-replies, community an
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.
| 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 |
npm i
cp .env.example .env
npm linkConfigure at least the following values in .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:
wb agent --im wechat --agent piWhen a QR code appears in the terminal, scan it with WeChat. The message pipeline is:
WeChat QR-code login -> Wechaty receives message -> local JSONL capture -> Pi agent reply -> WeChat IM sends replyTrigger rules:
ALIAS_WHITELIST.ROOM_WHITELIST, and the message must mention @BOT_NAME.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 usage scope narrow.
PRs for more AI services, better integrations, and stronger implementations are welcome.
WeChat has recently become very strict about this type of usage. The default protocol can trigger WeChat warnings or account bans. Use it carefully. The author of the padlocal protocol is no longer maintaining it, so switch to a more stable protocol yourself if needed.
If you only use wb wx ... to access local WeChat data, or only use wb lark ... to operate Lark IM, you do not need to configure an LLM.
If you want automatic WeChat replies or wb analyze deep analysis, choose a --serve service. Current options include ChatGPT, doubao, deepseek, Kimi, Xunfei, deepseek-free, 302AI, dify, ollama, tongyi, claude, and pi.
pi
Pi is suitable as the project agent and can communicate through WeChat, Lark, Telegram, or WhatsApp IM:
PI_BIN='pi'
PI_NPM_PACKAGE='@earendil-works/pi-coding-agent'
PI_AGENT_ARGS='--print --no-session'If your machine does not have a global pi command, leave PI_BIN empty. The project will start Pi through npx --yes @earendil-works/pi-coding-agent.
deepseek
Get your api key from the DeepSeek platform, then put it in .env:
DEEPSEEK_FREE_TOKEN='your key'ChatGPT
Get your api key from OpenAI API keys.
This is a paid service. If requests fail, make sure your terminal proxy works and your OpenAI account has billing available.
# Copy .env.example to .env
cp .env.example .env
# Fill in .env
OPENAI_API_KEY='your key'Doubao
Doubao Seed 1.6 supports image input and deep thinking. After registering and logging in to Volcano Engine, select a Doubao model, choose API access, and get an API key.
# Copy .env.example to .env
cp .env.example .env
# Fill in .env
DOUBAO_API_KEY='your key'
# Test whether the API works
node src/doubao/__test__.jsTongyi Qianwen
Tongyi Qianwen is an AI service from Alibaba Cloud. After getting your API key, fill in .env:
# Copy .env.example to .env
cp .env.example .env
# Fill in .env
# Tongyi URL, including the URI path
TONGYI_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1"
# Tongyi API key
TONGYI_API_KEY = ''
# Tongyi model
TONGYI_MODEL='qwen-plus'Xunfei
Apply for a key from Xunfei. Be careful not to mix up the several Xunfei configuration keys. For service errors, see issues/170 and issues/180.
Kimi
Get a key from Kimi API keys. Kimi is currently integrated at a basic level. PRs for file upload and other improvements are welcome.
dify
Create an app at dify, get your API key, and fill in .env. Self-hosted Dify deployments are also supported.
# Copy .env.example to .env
cp .env.example .env
# Fill in .env
DIFY_API_KEY='your key'
# For self-hosted Dify, update the following value in .env
# DIFY_URL='https://[your self-hosted URL]'ollama
Ollama is a local AI service. Its API is close to OpenAI's API, but configuration differs from cloud services.
# Copy .env.example to .env
cp .env.example .env
# Fill in .env
OLLAMA_URL='http://127.0.0.1:11434/api/chat'
OLLAMA_MODEL='qwen2.5:7b'
OLLAMA_SYSTEM_MESSAGE='You are a personal assistant.'302.AI
302.AI is an AI aggregation platform. Add an API from 302.AI APIs, then configure the API key in .env:
_302AI_API_KEY = 'xxxx'
_302AI_MODEL= 'gpt-4o-mini'You can choose the model yourself. Users should evaluate platform cost, payment flow, and service quality before using it.
claude
Register on the Anthropic Console, get an API key, then configure:
# Copy .env.example to .env if it does not already exist
cp .env.example .env
# Edit .env and add Claude settings
CLAUDE_API_VERSION = '2023-06-01'
CLAUDE_API_KEY = 'your API key'
CLAUDE_MODEL = 'claude-3-5-sonnet-latest'
# System prompt
CLAUDE_SYSTEM = ''Other
In theory, APIs compatible with OpenAI's format can be used by configuring the corresponding API key, model, and proxy URL in .env.
Make sure your development environment has nodejs installed. The required version is Node.js >= v18.0. Older versions can fail at runtime. An LTS version is recommended.
For users in mainland China, switching to the Taobao npm mirror before installing dependencies may help:
npm config set registry https://registry.npmmirror.comFor flexible registry switching, you can use prm-cli.
npm i
# Optional: register wb as a local command
npm linkIf you do not want to run npm link, replace every wb ... command below with:
npm run start -- ....envcp .env.example .envMinimum usable configuration:
BOT_NAME='@Your WeChat nickname'
ALIAS_WHITELIST='Friend alias 1,Friend nickname 2'
ROOM_WHITELIST='Group name 1,Group name 2'
AUTO_REPLY_PREFIX=''
WECHAT_DATA_DIR='.data/wechat'
WECHAT_STORE_MESSAGES='true'
PI_BIN='pi'
PI_AGENT_ARGS='--print --no-session'Pi agent mode:
wb agent --im wechat --agent piEquivalent commands:
wb start --serve pi
npm run agent
npm run start -- start --serve piTraditional model reply mode:
wb start --serve ollama
wb start --serve ChatGPT
wb start --serve deepseekAfter startup, a QR code appears in the terminal. Scan it to log in to WeChat. After login, received WeChat messages are appended to:
.data/wechat/messages.jsonlOpenCLI wx-cli is passed through by wb wx ... and is used to access local WeChat cache:
wb wx init
wb wx sessions
wb wx history
wb wx search
wb wx contacts
wb wx members
wb wx stats
wb wx favorites
wb wx sns-feed
wb wx sns-search
wb wx sns-notifications
wb wx helpCommon flows:
# Initialize local WeChat data access
wb wx init
# View recent sessions and chat history
wb wx sessions
wb wx history
# View group members and chat statistics
wb wx members
wb wx stats
# View Moments cache and search Moments text
wb wx sns-feed
wb wx sns-searchCommand-line analysis:
# Local statistics only, without calling AI
wb analyze --room "Group name" --stats-only
wb analyze --friend "Friend alias" --stats-only
# Call a selected service for deep analysis
wb analyze --room "Group name" --serve pi
wb analyze --friend "Friend alias" --serve ollamaBuilt-in commands in WeChat chats only work for allowlisted contacts or allowlisted groups by default:
/stats group GroupName
/analyze friend FriendAlias/stats only reads local JSONL and does not call AI. /analyze sends recent message samples to the current serve service or agent. For private chats, prefer a local model or local Pi configuration.
Lark IM is integrated through lark-cli:
# Generate a device-flow authorization link / QR-code info
wb lark login --no-wait
# Check authorization status
wb lark status
# Read / search / send messages
wb lark messages --chat-id oc_xxx
wb lark search --query "keyword"
wb lark send --chat-id oc_xxx --text "hello"To let Pi or another provider reply to Lark messages through the event stream, configure:
LARK_AGENT_IDENTITY='bot'
LARK_AGENT_EVENT_KEY='im.message.receive_v1'
LARK_AGENT_CHAT_TYPES='p2p,group'
LARK_AGENT_MESSAGE_TYPES='text,post'
LARK_AGENT_CHAT_WHITELIST=''
LARK_AGENT_USER_WHITELIST=''
LARK_AGENT_REPLY_PREFIX=''
LARK_AGENT_GROUP_MENTION_NAME=''
LARK_AGENT_GROUP_AUTO_REPLY='false'Then start:
wb agent --im lark --agent pi
# or
wb lark agent --agent piThe Lark event path uses lark-cli event consume im.message.receive_v1 --as bot. Private chats are replied to by default unless you set a chat or user allowlist. Group chats require LARK_AGENT_CHAT_WHITELIST and one of these triggers: LARK_AGENT_REPLY_PREFIX, LARK_AGENT_GROUP_MENTION_NAME, or LARK_AGENT_GROUP_AUTO_REPLY=true.
Before using event replies, make sure the Lark app has enabled the im.message.receive_v1 event in the developer console and
[合作邀请] 共同定义跨微信、飞书、Telegram、WhatsApp 的人物与回复上下文
您好请问机器人支持微信群聊吗,是个微不是企业微信
不要轻易运行,立马封号
使用该功能,今天收到微信使用第三方插件提醒,你们有收到信息吗
[商务合作] 台湾甲方 微信bot/AI Agent 跨境專案 求合作團隊
不要轻易运行,立马封号
微信就是一坨大的。靠着先发优势占据生态位后逼你吃这坨大的。
怎么调用其他功能?定时发送?获取好友列表?
Socket 出错: 11200 AppIdNoAuthError
希望支持gemini