gfydfhcf/wechat-ilink-muse-bridge
把 Muse(Meta 个人 AI 助理)接进微信:腾讯官方 iLink 协议、长轮询秒级收消息、连发消息合并、主动推送、媒体断点续传
What it solves
This project lets you use Meta's Muse personal AI assistant inside WeChat. Instead of opening a separate app, you scan a QR code to authorize, and then Muse becomes a WeChat contact that can chat with you, send you proactive notifications (like package delivery, server alerts, or schedule reminders), and even send images, files, and videos. It solves the problem of having to switch between apps to talk to your AI assistant.
How it works
It uses Tencent's official iLink / ClawBot protocol (no reverse engineering or personal account risks). After scanning a QR code to log in, the bridge runs a long-polling loop that receives incoming messages from WeChat and forwards them to Muse. Muse's replies are sent back through the same channel. The bridge also supports proactive messages by caching a context token, so Muse can initiate conversations. Key technical pieces include:
- A minimalist client (
ilink.py) with no framework dependencies. - Two drivers: a sample daemon (
daemon.py) and a production-grade hook for the Muse runtime (examples/muse-hook/). Only one driver runs at a time, enforced by a lock file. - Handling tricky protocol details like merging consecutive messages into one reply, de-duplicating incoming messages, avoiding duplicate sends, and supporting media uploads with encryption and retry.
- An owner whitelist: only approved WeChat IDs can talk to the bot; unknown senders are logged and require manual approval.
- Built-in health checks, watchdog, auto-updates, and a set of operational commands (rollback, stats, smoke-test, etc.).
- The bridge also tries to make replies feel human: it splits long sentences, gives conclusions first, uses plain language, and self-checks tone and structure before sending.
Who it's for
This is for anyone who already uses Muse as a personal AI assistant and wants to access it from WeChat. It's also useful for developers who want to build their own WeChat-integrated AI bots using the official iLink protocol—the code is documented and battle-tested. Self-hosters can deploy it on a VPS or NAS via Docker.
Highlights
- Official protocol, QR login — no reverse engineering, no risk of account ban.
- Real-time long polling — server holds the connection up to 35 seconds; messages arrive in seconds.
- Merges consecutive messages — if you send several messages in a row, the bot replies once with the latest context instead of replying mechanically to each one.
- Supports images, files, videos — both in replies and proactive messages.
- Typing indicator — shows a "typing…" state while generating a reply.
- Proactive pushes — can send messages to the user without being asked first.
- Media download with resume — handles weak networks with HTTP Range retry.
- Duplicate prevention — both inbound and outbound, so no repeated replies or accidental double sends.
- Owner whitelist — only approved WeChat IDs can trigger the bot; unknown senders are quarantined for manual approval.
- Alert loop — notifies when authorization expires, when polling fails, and when things recover.
- Health self-check —
ilink.py healthgives a full status snapshot with exit codes for monitoring. - Human-like reply polish — avoids robotic phrasing, splits long responses, and self-checks before sending.
- Auto-update and rollback — can install new releases and roll back if something goes wrong.
- Known limitations documented honestly — e.g., cannot send voice messages, cannot send tool-call progress, and outbound replies cannot include quoted messages (all due to channel limits).
Related
- Project
- Project
- Project
- Project