@openduo/channel-wechat
v0.1.3
Published
WeChat channel plugin for duoduo
Readme
@openduo/channel-wechat
WeChat channel plugin for duoduo — connects WeChat (via ilink bot API) to your duoduo agent.
How it works
- Clone this repo, install dependencies, and start the adapter
- If no valid session exists, the process outputs:
QRCODE_READY:/path/to/qrcode.png - A Feishu Agent (duoduo) reads this signal, fetches the PNG, and sends it to the user via Feishu
- The user scans the QR code with WeChat
- The process outputs:
WECHAT_CONNECTED:<botId>— the channel is live - All WeChat messages are forwarded to the openduo daemon and responses are sent back
The entire onboarding flow happens inside Feishu — no terminal access required.
Install
duoduo channel install @openduo/channel-wechatFor a local tarball:
npm pack
duoduo channel install ./openduo-channel-wechat-0.1.0.tgzQuickstart
gh repo clone winfred5432/channel-wechat
cd channel-wechat
npm ci
npm run build:plugin
cp .env.example .env
# edit .env if needed
npm startThe agent monitors stdout for QRCODE_READY: and WECHAT_CONNECTED: signals.
For stdio or TTY workflows, render the current pending QR code as terminal characters without parsing logs:
duoduo-wechat qrcode-terminal --state-dir ~/.aladuo/channel-wechatIf you are running from a source checkout or package root:
node dist/plugin.js qrcode-terminal --state-dir ~/.aladuo/channel-wechatEnvironment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| ALADUO_DAEMON_URL | http://127.0.0.1:20233 | openduo daemon RPC URL |
| WECHAT_API_BASE | https://ilinkai.weixin.qq.com | ilink bot API base URL |
| WECHAT_DM_POLICY | open | open (all users) or allowlist |
| WECHAT_ALLOW_FROM | — | Comma-separated WeChat userIds (allowlist mode only) |
| WECHAT_STATE_DIR | ~/.aladuo/channel-wechat | Persisted token and sync cursor |
| WECHAT_LOG_LEVEL | info | error | warn | info | debug |
| WECHAT_BOT_AGENT | Duoduo/<package-version> | Self-declared UA-style bot agent sent as base_info.bot_agent for WeChat backend attribution |
Architecture
WeChat (ilink bot API)
│
▼
[channel-wechat]
┌─────────────────────────────────────┐
│ auth.ts — QR login state machine │
│ wechat.ts — ilink HTTP client │
│ gateway.ts — ingress + pull loops │
│ daemon.ts — openduo RPC client │
└─────────────────────────────────────┘
│
▼
openduo daemon ←→ Claude / AgentState Directory
Default: ~/.aladuo/channel-wechat/
| File | Description |
|------|-------------|
| credentials.json | Auth token (chmod 600) |
| sync-buf.txt | Message cursor for getupdates |
| qrcode.png | Temporary — deleted after scan |
| qrcode.txt | Temporary raw QR payload for qrcode-terminal |
Development
npm ci
npm run dev # run with tsx (hot reload friendly)
npm test # vitest unit tests
npm run test:coverage # coverage report
npm run build # bundle dist/plugin.jsLicense
MIT
