OpenClaw 接微信 ClawBot 配置指南
如果你用 OpenClaw 做过 Discord 或 Telegram bot,你会发现微信是个完全不同的世界——没有 Bot API、没有 Webhook、企业号门槛高。2026 年 3 月,腾讯通过 OpenClaw 平台开放了微信个人账号的 Bot 接入能力,底层协议为 iLink(ilinkai.weixin.qq.com)。这意味着你可以将 OpenClaw 的 AI Agent 直接接入微信私聊,无需第三方代理或企业账号。
本文详细介绍将 OpenClaw 加入微信的完整过程,以及踩坑经验。
前提条件
- OpenClaw >= 2026.3.22 已安装
- 微信客户端版本 >= 8.0.70(低于此版本无法使用 ClawBot 功能)
接入方案对比
| 方案 | 来源 | 是否需要代理 | 费用 | 维护状态 |
|---|---|---|---|---|
@tencent-weixin/openclaw-weixin | 腾讯官方 | 否,直连 iLink | 免费 | 活跃,跟随 OpenClaw 版本更新 |
@canghe/openclaw-wechat | 社区(freestylefly) | 是,需自架代理 | 需购买 API Key | 社区维护,更新频率不定 |
| 直接调 iLink API | 自研 | 否 | 免费,但需自己实现 | 自行维护 |
推荐官方插件:无额外依赖,标准 OpenClaw channel plugin,维护有保障。
版本兼容性
| 插件版本 | OpenClaw 版本 |
|---|---|
| 2.0.x(latest) | >= 2026.3.22 |
| 1.0.x(legacy) | >= 2026.1.0, < 2026.3.22 |
安装
一键安装(推荐)
npx -y @tencent-weixin/openclaw-weixin-cli install
安装脚本会自动完成以下步骤:
- 安装插件
- 启用插件
- 弹出二维码供扫码登录
- 重启 gateway
手动安装
openclaw plugins install "@tencent-weixin/openclaw-weixin"
openclaw config set plugins.entries.openclaw-weixin.enabled true
openclaw channels login --channel openclaw-weixin
openclaw gateway restart
绑定到 Agent
这是最容易踩坑的地方。
⚠️ accountId 不是 "default"
微信账号的 accountId 是动态生成的哈希值(如 2b7df0dad638-im-bot),不是 default。如果用 accountId: "default" 配置 binding,消息会路由失败,回落到默认 agent。
正确做法:从日志获取真实 accountId
journalctl --user -u openclaw-gateway.service | grep 'weixin monitor started'
# 输出示例:
# [openclaw-weixin] weixin monitor started (..., account=2b7df0dad638-im-bot)
然后用 CLI 绑定:
openclaw agents bind --agent <your-agent-id> --bind openclaw-weixin:2b7df0dad638-im-bot
多账号支持
每次执行 openclaw channels login --channel openclaw-weixin 会新增一个账号,支持多个微信号同时在线,分别绑定到不同 agent:
# 登录第二个账号
openclaw channels login --channel openclaw-weixin
# 查找新 accountId
journalctl --user -u openclaw-gateway.service | grep 'weixin monitor started' | tail -5
# 绑定
openclaw agents bind --agent <agent-id> --bind openclaw-weixin:<new-accountId>
当前限制
- 仅支持私聊:目前不支持群聊
- 个人账号模型:微信 iLink 基于个人账号扫码登录,每个 bot 本质上是一个微信号。这与 Discord/Telegram 的平台级 bot 不同——后者一个 bot 可以被任意多用户添加,而微信 iLink 是"一个微信号和另一个微信号聊天"的模式
- 多用户场景:如果需要多个用户分别与 bot 交互,需要为每个用户创建独立的 bot 账号(即登录多个微信号),每个账号绑定到对应的 agent
- Token 续期:iLink token 有效期 24 小时,插件自动处理续期,无需手动操作
- dmPolicy:默认接受所有私聊消息,可通过
channels.openclaw-weixin.dmPolicy配置限制
隐私说明
通过 iLink 接入的 Bot 消息经由腾讯服务器中转。微信没有端对端加密,所有消息都经过腾讯服务器——这是微信平台本身的特性,并非 iLink 特有。
不同地区用户的数据管辖存在差异:
- 大陆用户(+86 手机号):数据存储在中国大陆,受中国法律管辖
- 海外用户:数据存储在新加坡和香港服务器,适用不同隐私政策
如果对话内容涉及敏感信息,建议评估是否适合通过微信渠道传输。