微信官方接入 OpenClaw?我 10 分钟搞定了,但过程中这几个坑你必须知道

微信官方接入 OpenClaw?我 10 分钟搞定了,但过程中这几个坑你必须知道

看到微信官方支持接入 OpenClaw(龙虾),我心想:这不就是一行命令的事?结果...


事情是这样的

作为 OpenClaw 的老用户,我一直在等微信官方接入。看到文档更新那天,我立刻打开终端:

bash 复制代码
npx -y @tencent-weixin/openclaw-weixin-cli@latest install

啪!报错:

csharp 复制代码
[openclaw-weixin] 未找到 openclaw,请先安装...

我愣了一下------openclaw -V 明明能跑啊?

作为资深 Windows 用户,我秒懂:这脚本有 Unix 偏见。


坑 1:安装脚本的"Unix 优越感"

扒开脚本源码,检测逻辑是这样的:

javascript 复制代码
function which(bin) {
  try {
    return execSync(`which ${bin}`, { encoding: "utf-8" }).trim();
  } catch {
    return null;  // Windows 用户直接进这里
  }
}

which 是 Linux/Mac 的命令,PowerShell 不认识。脚本直接判定"你没装 OpenClaw"。

解决: 不跟它较劲,手动安装更可控。

bash 复制代码
cd C:\Users\Administrator\.openclaw\extensions
npm init -y
npm install @tencent-weixin/openclaw-weixin-cli
openclaw plugins install "@tencent-weixin/openclaw-weixin"

坑 2:依赖失踪案

插件装完,重启 Gateway,心想稳了。

啪!报错:

lua 复制代码
[plugins] openclaw-weixin failed to load: Error: Cannot find module 'zod'

openclaw plugins install 只拉代码,依赖不管。就像买了电视,遥控器得自己配。

解决:

bash 复制代码
cd C:\Users\Administrator\.openclaw\extensions\openclaw-weixin
npm install

坑 3:路径配置盲区

依赖装完,重启,又报错:

css 复制代码
[plugins] openclaw-weixin failed to load from .openclaw-install-stage-xxx

两个问题:

  1. 临时目录残留------安装时创建的临时目录没删,Gateway 先加载了它
  2. 路径未配置 ------openclaw.json 里 plugins.load.paths 没加微信插件路径

解决:

Step 1:清临时目录

powershell 复制代码
Remove-Item -Recurse -Force C:\Users\Administrator\.openclaw\extensions\.openclaw-install-stage-*

Step 2:加加载路径

json 复制代码
{
  "plugins": {
    "load": {
      "paths": [
        "...\\feishu",
        "C:\\Users\\Administrator\\.openclaw\\extensions\\openclaw-weixin"
      ]
    }
  }
}

坑 4:权限配置的隐形门槛

终于!二维码出来了!扫码!登录成功!

我在微信上发了条测试消息,然后...

沉默。

查配置发现:QQ 有 "allowFrom": ["*"],飞书有 "dmPolicy": "open",微信啥都没有。

Gateway 的默认策略是拒绝,必须显式配置权限。

解决:

json 复制代码
{
  "channels": {
    "openclaw-weixin": {
      "enabled": true,
      "allowFrom": ["*"]
    }
  }
}

完整流程(Windows 专用)

bash 复制代码
# 1. 进入扩展目录
cd C:\Users\Administrator\.openclaw\extensions

# 2. 安装 CLI 和插件
npm init -y
npm install @tencent-weixin/openclaw-weixin-cli
openclaw plugins install "@tencent-weixin/openclaw-weixin"

# 3. 装依赖(关键!)
cd openclaw-weixin && npm install && cd ..

# 4. 清临时目录
Remove-Item -Recurse -Force .openclaw-install-stage-*

编辑 ~/.openclaw/openclaw.json:

json 复制代码
{
  "plugins": {
    "load": {
      "paths": [
        "...",
        "C:\\Users\\Administrator\\.openclaw\\extensions\\openclaw-weixin"
      ]
    }
  },
  "channels": {
    "openclaw-weixin": {
      "enabled": true,
      "allowFrom": ["*"]
    }
  }
}

重启并登录:

bash 复制代码
openclaw gateway restart
openclaw channels login --channel openclaw-weixin
# 扫码,搞定

坑点速查表

坑 症状 原因 解决
坑 1 说找不到 openclaw which 不兼容 Windows 手动安装
坑 2 缺 zod 模块 依赖未自动安装 手动 npm install
坑 3 加载失败/找临时目录 路径未配置+残留目录 加路径+清残留
坑 4 扫码成功但不回复 缺 allowFrom 加通道配置

写在最后

整个过程其实就 10 分钟,但如果不了解这些坑,可能得折腾几小时。

微信官方接入 OpenClaw 是个好消息,希望这篇文章能帮你少走弯路。

你的 AI 助手,现在可以接管微信了。


作者:老石
OpenClaw 资深用户,专注踩坑与填坑
2026-03-22

相关推荐
苏琢玉6 天前
从 dsh-im 到微信:我做了个 PHP 包,让微信变成 AI 的消息入口
微信·php·composer
ZhengEnCi8 天前
微信用SQLite为什么还要WCDB:聊天记录加密并发与坏库修复的工程真相
数据库·微信·sqlite
wechatbot88810 天前
企业微信语音通话实战:基于极客互动 API 打通语音拨通、接收与挂断全链路
微信·企业微信·企业微信scrm·企业微信api·企业微信sdk·企微ipad协议
用户861941772074112 天前
uni-app 鸿蒙端提现点不动?我用 UTS 插件补上了微信"确认收款"
微信·harmonyos
wechatbot88812 天前
企业微信外部群聊自动回复机器人开发实战
微信·机器人·企业微信·企业微信scrm·企业微信二次开发·企业微信api
极客互动API12 天前
企业微信外部联系人消息群发控制台效果展示
微信·企业微信·企微scrm·企业微信api·企微外部联系人
Dumbness16 天前
关键词回复里写了 {订单号},群机器人整条消息都炸了
python·微信
Dumbness21 天前
群里 @ 机器人发"查订单",指令一条都没命中:微信群机器人在路由前漏掉的几步归一化
python·微信
玩泥巴的1 个月前
把AI编码从自由生成到受约束声明:微信生态 .NET SDK 中用源生成器压制 AI 编码幻觉的工程实践
微信·.net·aot·roslyn
连接池1 个月前
Java 微信二次开发2个坑:多实例回调路由 + 消息分发策略(附 Spring Boot 代码)
微信