{"_id":"@agent-wechat/agent-wechat","_rev":"2-7f968e9b674de6c006297dac31a69a18","name":"@agent-wechat/agent-wechat","dist-tags":{"latest":"0.12.0"},"versions":{"0.11.15":{"name":"@agent-wechat/agent-wechat","version":"0.11.15","_id":"@agent-wechat/agent-wechat@0.11.15","maintainers":[{"name":"thisnick","email":"wiseyu@gmail.com"}],"homepage":"https://github.com/thisnick/agent-wechat#readme","bugs":{"url":"https://github.com/thisnick/agent-wechat/issues"},"dist":{"shasum":"31864179d297bd7e70d28c19585f93e7b36b8e54","tarball":"https://registry.npmjs.org/@agent-wechat/agent-wechat/-/agent-wechat-0.11.15.tgz","fileCount":4,"integrity":"sha512-OKQhY/1LVzSAmK8xQ0CIp57IsLxc+LQ6HE0iIhZXgJWK7dbD/U9H6ov7KtCh+XiOQqsuKPquZ55K7/TlAG6wbg==","signatures":[{"sig":"MEYCIQCE0bummfIsHfWjl1PsQ5ink1mfg67kWfzx6gINhWeHYQIhAORoEEypSbCdjKpyUydGoXwhBKOfgfYb9D5GYrZkdGqK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":245832},"type":"module","gitHead":"9111d005852aa764fd18ea88f74a2f356abef94f","scripts":{"test":"node --test --experimental-strip-types src/*.test.ts","build":"esbuild index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --external:openclaw","typecheck":"tsc --noEmit"},"_npmUser":{"name":"thisnick","email":"wiseyu@gmail.com"},"openclaw":{"channel":{"id":"agent-wechat","label":"WeChat","order":80,"selectionLabel":"WeChat (微信)"},"install":{"npmSpec":"@agent-wechat/agent-wechat"},"extensions":["./dist/index.js"],"channelConfigs":{"agent-wechat":{"label":"WeChat","schema":{"type":"object","properties":{"token":{"type":"string"},"groups":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"allowFrom":{"type":"array","items":{"type":"string"}},"groupPolicy":{"enum":["open","allowlist","disabled"],"type":"string"},"requireMention":{"type":"boolean"}}}},"enabled":{"type":"boolean"},"dmPolicy":{"enum":["open","allowlist","disabled"],"type":"string"},"allowFrom":{"type":"array","items":{"type":"string"}},"serverUrl":{"type":"string"},"groupPolicy":{"enum":["open","allowlist","disabled"],"type":"string"},"groupAllowFrom":{"type":"array","items":{"type":"string"}},"pollIntervalMs":{"type":"integer","minimum":100},"authPollIntervalMs":{"type":"integer","minimum":1000}},"additionalProperties":false},"description":"WeChat messaging via agent-wechat container."}}},"repository":{"url":"git+https://github.com/thisnick/agent-wechat.git","type":"git","directory":"packages/openclaw-extension"},"_npmVersion":"11.12.1","description":"OpenClaw channel plugin for WeChat. Connects your OpenClaw bot to WeChat using [agent-wechat](https://github.com/thisnick/agent-wechat).","directories":{},"_nodeVersion":"26.0.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.25.0","openclaw":"^2026.8.1","typescript":"^5.4.5","@types/node":"^22","@agent-wechat/shared":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/agent-wechat_0.11.15_1788188231610_0.9784385370225033","host":"s3://npm-registry-packages-npm-production"}},"0.12.0":{"name":"@agent-wechat/agent-wechat","version":"0.12.0","type":"module","devDependencies":{"@types/node":"^22","esbuild":"^0.25.0","openclaw":"^2026.8.1","typescript":"^5.4.5","@agent-wechat/shared":"0.1.0"},"openclaw":{"extensions":["./dist/index.js"],"channel":{"id":"agent-wechat","label":"WeChat","selectionLabel":"WeChat (微信)","order":80},"install":{"npmSpec":"@agent-wechat/agent-wechat"},"channelConfigs":{"agent-wechat":{"label":"WeChat","description":"WeChat messaging via agent-wechat container.","schema":{"type":"object","additionalProperties":false,"properties":{"enabled":{"type":"boolean"},"serverUrl":{"type":"string"},"token":{"type":"string"},"dmPolicy":{"type":"string","enum":["open","allowlist","disabled"]},"allowFrom":{"type":"array","items":{"type":"string"}},"groupPolicy":{"type":"string","enum":["open","allowlist","disabled"]},"groupAllowFrom":{"type":"array","items":{"type":"string"}},"groups":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"requireMention":{"type":"boolean"},"groupPolicy":{"type":"string","enum":["open","allowlist","disabled"]},"allowFrom":{"type":"array","items":{"type":"string"}}}}},"pollIntervalMs":{"type":"integer","minimum":100},"authPollIntervalMs":{"type":"integer","minimum":1000}}}}}},"publishConfig":{"access":"public","provenance":true},"repository":{"type":"git","url":"git+https://github.com/thisnick/agent-wechat.git","directory":"packages/openclaw-extension"},"scripts":{"build":"esbuild index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --external:openclaw","typecheck":"tsc --noEmit","test":"node --test --experimental-strip-types src/*.test.ts"},"_id":"@agent-wechat/agent-wechat@0.12.0","description":"OpenClaw channel plugin for WeChat. Connects your OpenClaw bot to WeChat using [agent-wechat](https://github.com/thisnick/agent-wechat).","bugs":{"url":"https://github.com/thisnick/agent-wechat/issues"},"homepage":"https://github.com/thisnick/agent-wechat#readme","_integrity":"sha512-1cIp29NZEYVrqoW9fz3nz0H6K3sFunyZOXvPnI4IOU4aPhISNSEjssvgv+0VRTylLTYMC0ATkZFud8wrm32EiA==","_resolved":"/tmp/f5f32238cb1fa7d564bb37ae85e2a2d9/agent-wechat-agent-wechat-0.12.0.tgz","_from":"file:agent-wechat-agent-wechat-0.12.0.tgz","_nodeVersion":"22.23.2","_npmVersion":"11.12.1","dist":{"integrity":"sha512-1cIp29NZEYVrqoW9fz3nz0H6K3sFunyZOXvPnI4IOU4aPhISNSEjssvgv+0VRTylLTYMC0ATkZFud8wrm32EiA==","shasum":"d8fa823b09a0085cc55e6c442d4336f5af62ff96","tarball":"https://registry.npmjs.org/@agent-wechat/agent-wechat/-/agent-wechat-0.12.0.tgz","fileCount":4,"unpackedSize":245824,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-wechat%2fagent-wechat@0.12.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD4tuLoRfBl4r7zIFZoo4IIxrTe+R1supMc7PHM8/zGJAIhALpOPDeuLpYxNqfDshIQzKDGlj3lHWAHCJoPhe/QvBdY"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6b653adf-076e-4117-8393-a1e2499c49cc"}},"directories":{},"maintainers":[{"name":"thisnick","email":"wiseyu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agent-wechat_0.12.0_1788189862365_0.23896464908842896"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-31T14:57:11.334Z","modified":"2026-08-31T15:24:22.905Z","0.11.15":"2026-08-31T14:57:11.753Z","0.12.0":"2026-08-31T15:24:22.509Z"},"bugs":{"url":"https://github.com/thisnick/agent-wechat/issues"},"homepage":"https://github.com/thisnick/agent-wechat#readme","repository":{"type":"git","url":"git+https://github.com/thisnick/agent-wechat.git","directory":"packages/openclaw-extension"},"description":"OpenClaw channel plugin for WeChat. Connects your OpenClaw bot to WeChat using [agent-wechat](https://github.com/thisnick/agent-wechat).","maintainers":[{"name":"thisnick","email":"wiseyu@gmail.com"}],"readme":"# @agent-wechat/agent-wechat\n\nOpenClaw channel plugin for WeChat. Connects your OpenClaw bot to WeChat using [agent-wechat](https://github.com/thisnick/agent-wechat).\n\n**[Documentation](https://thisnick.github.io/agent-wechat/integrations/openclaw/setup/)**\n\n## Prerequisites\n\n- **A WeChat account logged in on your phone** — This account will be used by the bot. You must keep it logged in on your phone at all times. If you log out on the phone, the bot loses its connection.\n\n- **A second screen** — WeChat login requires scanning a QR code with your phone camera. You'll need the QR code displayed on a screen separate from the phone running WeChat (e.g., a computer monitor, tablet, or another phone).\n\n- **An agent-wechat server** — Either self-hosted via Docker or provided by someone else. You'll need the server URL and authentication token.\n\n> **Note:** The agent-wechat container requires `SYS_PTRACE` and `seccomp=unconfined` (ptrace access to the WeChat desktop process). It cannot run in serverless or restricted container environments (AWS Fargate, Cloud Run, etc.) — use a VM or bare-metal Docker host.\n\n## Setup\n\n### 1. Start the agent-wechat Server\n\nIf you need to run the server yourself:\n\n**Option A: CLI** (quickest for local use)\n\n```bash\nnpm install -g @agent-wechat/cli\nwx up\n```\n\n**Option B: Docker Compose** (production / networked)\n\n```yaml\nservices:\n  agent-wechat:\n    image: ghcr.io/thisnick/agent-wechat:latest\n    container_name: agent-wechat\n    security_opt:\n      - seccomp=unconfined\n    cap_add:\n      - SYS_PTRACE\n    ports:\n      - \"6174:6174\"\n    volumes:\n      - agent-wechat-data:/data\n      - agent-wechat-home:/home/wechat\n      - ~/.config/agent-wechat/token:/data/auth-token:ro\n    restart: unless-stopped\n\nvolumes:\n  agent-wechat-data:\n  agent-wechat-home:\n```\n\nGenerate a token before starting:\n\n```bash\nmkdir -p ~/.config/agent-wechat\nopenssl rand -hex 32 > ~/.config/agent-wechat/token\nchmod 600 ~/.config/agent-wechat/token\ndocker compose up -d\n```\n\nIf running alongside OpenClaw on the same Docker network, set `serverUrl` to `http://agent-wechat:6174` in the channel config.\n\n### 2. Install the extension\n\n```bash\nopenclaw plugins install @agent-wechat/agent-wechat\n```\n\n### 3. Configure the channel\n\n```bash\n# Uses defaults (localhost:6174, token from ~/.config/agent-wechat/token)\nopenclaw channels add --channel agent-wechat\n\n# Override server URL and token\nopenclaw channels add --channel agent-wechat --url <url> --token <token>\n```\n\nOr edit `~/.openclaw/openclaw.json` directly:\n\n```json\n{\n  \"channels\": {\n    \"agent-wechat\": {\n      \"enabled\": true,\n      \"serverUrl\": \"http://localhost:6174\",\n      \"dmPolicy\": \"open\",\n      \"groupPolicy\": \"open\"\n    }\n  }\n}\n```\n\n> **Upgrading from ≤0.11.x?** The channel id changed from `wechat` to `agent-wechat` (OpenClaw's official plugin registry now reserves `wechat`/`weixin` as aliases of Tencent's `openclaw-weixin` plugin, which hijacked this channel's id). Rename the `channels.wechat` key to `channels.agent-wechat` and any `plugins.entries.wechat` key to `plugins.entries.agent-wechat` in `openclaw.json`, then restart the gateway. Allowlist entries and group settings carry over unchanged.\n\nFor local setups, the token is automatically read from `~/.config/agent-wechat/token` (shared with the CLI and container), so you don't need to set it in the config. When connecting to a remote server, add the `token` field.\n\n### 4. Restart the gateway\n\nRestart your OpenClaw gateway so it picks up the new channel config:\n\n```bash\nopenclaw gateway restart\n```\n\n### 5. Log in to WeChat\n\nAsk your bot to log in to WeChat:\n\n> \"Log in to WeChat\"\n\nYour bot should generate a QR code image. Alternatively, use the CLI:\n\n```bash\nopenclaw channels login --channel agent-wechat\n```\n\n### 6. Scan the QR code\n\nDisplay the QR code on a screen separate from the phone running WeChat. WeChat's login QR scanner uses the camera only — it cannot scan from the phone's photo gallery.\n\nScan the QR code using WeChat's built-in scanner (tap **+** > **Scan**) with the account you want the bot to use. Then tap **Login** on the confirmation screen.\n\nYou only need to do this once — the session persists across container restarts.\n\n### 7. Configure DM and group policies\n\nOnce connected, configure how the bot handles direct messages and group chats. You can ask your bot to help you, or edit the config directly. See the Configuration Reference below.\n\n## Limitations\n\n- **The WeChat account must stay logged in on your phone.** Logging out on the phone disconnects the bot. One workaround: after the bot is logged in, you can uninstall and reinstall WeChat on your phone — the bot session persists. On Android, you can also run WeChat in a separate profile (Work Profile or Private Space) to keep the bot account isolated.\n\n- **Only one desktop session.** Once the bot is logged in as a \"desktop\" client, you cannot simultaneously use WeChat on another computer or WeChat Web.\n\n- **Infrastructure updates disconnect the bot.** If the agent-wechat server restarts or updates, the bot will be disconnected. When this happens, ask your bot to log in again. If the disconnection was brief, you may not need a new QR code scan.\n\n## Configuration Reference\n\nAll config lives under `channels.agent-wechat` in OpenClaw's config file:\n\n| Key | Type | Default | Description |\n|-----|------|---------|-------------|\n| `enabled` | boolean | `false` | Enable the WeChat channel |\n| `serverUrl` | string | — | agent-wechat REST API URL |\n| `token` | string | — | Auth token (auto-read from `~/.config/agent-wechat/token` for local setups) |\n| `dmPolicy` | `\"open\" \\| \"allowlist\" \\| \"disabled\"` | `\"disabled\"` | Who can DM the bot |\n| `allowFrom` | string[] | `[]` | wxid allowlist for DMs (when policy is `allowlist`) |\n| `groupPolicy` | `\"open\" \\| \"allowlist\" \\| \"disabled\"` | `\"disabled\"` | Group message policy |\n| `groupAllowFrom` | string[] | `[]` | Global allowlist of group sender IDs (`wxid_...`) |\n| `groups` | object | `{}` | Per-group overrides (e.g. `{ \"id@chatroom\": { \"requireMention\": false, \"enabled\": true, \"groupPolicy\": \"allowlist\", \"allowFrom\": [\"wxid_...\"] } }`) |\n| `pollIntervalMs` | integer | `1000` | Message polling interval |\n| `authPollIntervalMs` | integer | `30000` | Auth status check interval |\n\n## Development\n\n### Build from source\n\n```bash\ngit clone https://github.com/thisnick/agent-wechat.git\ncd agent-wechat\npnpm install && pnpm build\n```\n\n### Link for local development\n\n```bash\nopenclaw plugins install -l ./packages/openclaw-extension\n```\n\nThis symlinks the extension so changes are picked up without reinstalling. Rebuild with `pnpm build` after making changes, then restart the gateway.\n\n## Architecture\n\n```\nOpenClaw Gateway\n  └── WeChat Monitor (polling loop)\n        │\n        │  GET /api/chats          (list chats with unreads)\n        │  POST /api/chats/{id}/open  (open chat, clear unreads)\n        │  GET /api/messages/{id}  (fetch new messages)\n        │  GET /api/messages/{id}/media/{localId}  (download media)\n        │  POST /api/messages/send (send reply)\n        │\n        ▼\n  agent-wechat container (port 6174)\n        │\n        ▼\n  WeChat Desktop (in Xvfb)\n```\n\nThe monitor polls for chats with unread messages, fetches new messages, resolves routing/session via OpenClaw's runtime, and dispatches replies back through the agent-wechat API.\n","readmeFilename":"README.md"}