npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wecom-aibot

v0.1.0

Published

OpenClaw channel plugin for WeCom AI Bot (WebSocket long connection)

Readme

wecom-aibot(OpenClaw Channel Plugin)

把 OpenClaw 接入企业微信「智能机器人」的 WebSocket 长连接通道。

本项目基于 @wecom/aibot-node-sdk,在 OpenClaw 侧实现一个 wecom-aibot 渠道插件:

  • 企业微信 ⇄(WebSocket)⇄ 本插件 ⇄ OpenClaw Agent/Models

能做到什么

  • 接收企业微信机器人推送的 文本消息(单聊/群聊)。
  • 将入站消息转换为 OpenClaw 的标准上下文,交由默认/绑定的 agent 处理。
  • 将 OpenClaw 的回复以 Markdown 文本回发到企业微信(通过 WebSocket 回复通道)。
  • 支持 流式输出:当 OpenClaw 对当前模型/路由产生 block 分段时,本插件会用同一个 streamId 持续刷新内容,并在本轮结束时 finish=true 完成流式消息。
  • 支持多账号配置(channels.wecom-aibot.accounts)。
  • 支持基础 allowlist(allowFrom)。

还没做到什么(已知限制)

  • 受限于@wecom/[email protected]目前的能力,未实现理想的流式传输
  • 实现了 文本 入站与文本/markdown 出站;图片/文件/语音/图文混排目前未接入。
  • 未实现企业微信侧的模板卡片(Template Card)与交互事件回调。
  • 群聊的更细粒度权限(比如群里 @ 提及才响应)未做专门适配,依赖 OpenClaw 的通用群策略/路由能力。

安装方式(OpenClaw)

方式 A:从 npm 安装(推荐用于部署/服务器)

openclaw plugins install wecom-aibot@latest --pin
openclaw plugins enable wecom-aibot

方式 B:从本地目录安装(会拷贝文件)

openclaw plugins install /path/to/wecom-aibot
openclaw plugins enable wecom-aibot

方式 C:开发模式(link,不拷贝,适合迭代)

openclaw plugins install -l /path/to/wecom-aibot
openclaw plugins enable wecom-aibot

修改代码后:

npm run build

然后重启 openclaw gateway

配置(openclaw.json)

编辑 ~/.openclaw/openclaw.json

单账号

{
  "channels": {
    "wecom-aibot": {
      "enabled": true,
      "botId": "YOUR_BOT_ID",
      "secret": "YOUR_BOT_SECRET",
      "defaultTo": "DEFAULT_CHATID",
      "allowFrom": ["*"]
    }
  }
}

多账号

{
  "channels": {
    "wecom-aibot": {
      "accounts": {
        "default": { "botId": "BOT1", "secret": "SECRET1", "allowFrom": ["*"] },
        "bot2": { "botId": "BOT2", "secret": "SECRET2", "defaultTo": "CHATID2" }
      }
    }
  }
}

字段说明:

  • botId / secret:企业微信智能机器人凭据。
  • allowFrom:允许的 userid 列表;包含 "*" 表示放行全部。
  • defaultTo:当 OpenClaw 主动出站且未指定目标时使用的 chatid(仅用于主动发送)。

运行

openclaw gateway

如果看到 OpenClaw 提示 plugins.allow is empty,建议显式加白名单:

{
  "plugins": {
    "allow": ["wecom-aibot"],
    "entries": { "wecom-aibot": { "enabled": true } }
  }
}

代码结构

  • src/wecom/channel.ts:ChannelPlugin 定义、配置 schema、出站发送、streaming 能力声明
  • src/wecom/gateway.ts:WebSocket 客户端管理、入站处理、会话与流式回复桥接
  • src/wecom/config.tschannels.wecom-aibot 配置解析与多账号解析