OpenClaw 通过腾讯外部插件 @tencent-weixin/openclaw-weixin 连接微信。状态:外部插件,支持私聊和媒体,不支持群聊。

命名约定

  • WeChat — 文档中的用户侧名称
  • Weixin — Tencent 包名和插件 ID 使用的名称
  • openclaw-weixin — OpenClaw channel ID(CLI 命令和配置路径中使用)
  • @tencent-weixin/openclaw-weixin — npm 包名

工作原理

微信代码不在 OpenClaw 核心仓库中,通过外部插件合约接入:

  1. openclaw plugins install 安装 @tencent-weixin/openclaw-weixin
  2. Gateway 发现插件 manifest 并加载插件入口
  3. 插件注册 channel ID openclaw-weixin
  4. openclaw channels login --channel openclaw-weixin 启动 QR 登录
  5. 插件将账号凭证存储在 OpenClaw 状态目录下
  6. Gateway 启动时,插件为每个配置的账号启动微信监控
  7. 入站微信消息通过 channel 合约规范化,路由到 agent,再通过插件出站路径发送

安装

# 快速安装
npx -y @tencent-weixin/openclaw-weixin-cli install
 
# 手动安装
openclaw plugins install "@tencent-weixin/openclaw-weixin"
openclaw config set plugins.entries.openclaw-weixin.enabled true
 
# 重启 gateway
openclaw gateway restart

登录

openclaw channels login --channel openclaw-weixin

用手机微信扫描 QR 码并确认登录。添加多个账号时,建议隔离 DM 会话:

openclaw config set session.dmScope per-account-channel-peer

访问控制

openclaw pairing list openclaw-weixin
openclaw pairing approve openclaw-weixin <CODE>

版本兼容性

插件版本OpenClaw 版本npm tag
2.x>=2026.3.22latest
1.x>=2026.1.0 <2026.3.22legacy

版本过旧时安装 legacy 版本:

openclaw plugins install @tencent-weixin/openclaw-weixin@legacy

故障排查

# 检查安装和状态
openclaw plugins list
openclaw channels status --probe
openclaw --version
 
# 确认插件已启用
openclaw config set plugins.entries.openclaw-weixin.enabled true
openclaw gateway restart

若 Gateway 反复重启,更新 OpenClaw 和插件:

openclaw plugins install "@tencent-weixin/openclaw-weixin" --force
openclaw gateway restart

相关链接