微信官方接入 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

相关推荐
随性而行36016 小时前
企业微信 API 如何实现业务消息自动通知?接口应用场景解析
java·人工智能·后端·微信·机器人·企业微信
极客互动API20 小时前
企业微信二次开发 API:如何与 SCRM 打通外部联系人的消息发送
微信·企业微信·企微scrm·企业微信api·企微外部联系人
随性而行3606 天前
企业微信API调用案例:如何通过接口实现多账号统一管理与业务接入?
运维·微信·机器人·自动化·企业微信
随性而行3606 天前
企业微信API接口开发实战:如何实现消息回调接收与业务事件处理?
java·前端·python·微信·机器人·企业微信
Eddyp6 天前
涡街 电磁流量计、压力变送器,手操器组态实操要点
微信·微信公众平台·facebook·新浪微博·微信开放平台
后除7 天前
Go 实战: 使用 Wails v2.15 构建轻量级的桌面应用 - 仿微信登录界面
开发语言·微信·golang
GeWeAPI技术支持7 天前
个人微信API二次开发:如何给消息回调增加异常日志和排查线索
人工智能·微信
凡泰极客科技8 天前
如何让企业App像微信一样,运行短剧、外卖和小游戏?
微信
老三牛擦9 天前
业财一体化
微信