Huo15 Openclaw Wechat Service
OpenClaw 微信服务号(公众号)渠道插件 v2.3.5 hotfix —— **修 errcode 45002 content size out of limit**:truncateForWechatText 改字节截断(微信限 2048 字节不是字符,中文 1 字 = 3 字节),默认 1900 字节留...
Rank
62
Safety
84
Downloads
1.5k
Updated
Oct 10, 2026
Version
2.3.5
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 10, 2026
- Adoption signal
- 1.5K downloadsadoption · observed Oct 10, 2026
- Latest release
- 2.3.5release · observed May 12, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17f6q72skfgyjycm2frgdc8dn83v5mk:huo15-openclaw-wechat-service- Install using `clawhub skill install s17f6q72skfgyjycm2frgdc8dn83v5mk:huo15-openclaw-wechat-service` in an isolated environment before connecting it to live workloads.
- No published capability contract is available yet, so validate auth and request/response behavior manually.
- Review the upstream CLAWHUB listing at https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service before using production credentials.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-zhaobod1-huo15-openclaw-wechat-service/snapshot"
Documentation
CLAWHUB
160,000 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: huo15-openclaw-wechat-service
description: "OpenClaw 微信服务号(公众号)渠道插件 v2.3.5 hotfix —— **修 errcode 45002 content size out of limit**:truncateForWechatText 改字节截断(微信限 2048 字节不是字符,中文 1 字 = 3 字节),默认 1900 字节留余量;保护 <a href> 标签不截在内部避免 XML 错乱;中文 / emoji / 混合场景全覆盖。症状:v2.3.0~v2.3.4 粉丝只收 placeholder 不收 LLM 真回复——根因 LLM 输出 > 600 中文字超 2048 字节被微信拒。承袭 v2.3.x 全部能力。287 vitest 用例全过。"
version: 2.3.5
homepage: https://cnb.cool/huo15/ai/huo15-openclaw-wechat-service
metadata: { "openclaw": { "emoji": "💬", "kind": "channel-plugin", "channelId": "wechat-service", "requires": { "bins": [] } } }
---
# huo15-openclaw-wechat-service v2.1.0
OpenClaw 微信服务号(公众号)渠道插件。
## 这是什么
把微信公众号接进 OpenClaw Agent 体系,让公众号粉丝可以直接和 LLM agent 聊天 / 接收通知 / 触发业务流程,覆盖**消息收发、内容发布、网页授权、数据分析、智能识别、卡券**六大维度。
## 安装
```bash
# 通过 OpenClaw 安装(推荐)
/install @huo15/wechat-service
# 或 npm
npm install @huo15/wechat-service
```
随后在 OpenClaw 里 `/setup wechat-service` 跑向导。
## 核心特性
### 🚀 一粉一会话动态 Agent
模仿 `@huo15/wecom` 的动态 Agent 框架:
```yaml
channels:
wechat-service:
dynamicAgents:
enabled: true
dmCreateAgent: true # 每个 openid 一个 agent
adminUsers: [oABC123xyz] # 管理员旁路走 main agent
```
每个粉丝的 openid 自动派生独立 agent(命名 `wechat-service-{accountId}-dm-{sanitized_openid}`),实现真正的一对一会话隔离。
### 🛠️ 12 个 Agent Tool / 60+ API
| Tool | 主要 action |
|------|-------------|
| `wechat_service_menu` | 自定义菜单(基础 + 个性化)|
| `wechat_service_message` | 客服消息 + 模板消息 + 公模板库 + 一次性订阅 + 长期订阅通知(25 个 actions)|
| `wechat_service_material` | 临时/永久素材 |
| `wechat_service_article` | 草稿箱 + freepublish 流水线 |
| `wechat_service_user` | 用户/标签/黑名单 |
| `wechat_service_qrcode` | 带参二维码 + short_key |
| `wechat_service_mass_send` | 按标签/openid/预览群发 |
| `wechat_service_jssdk` | wx.config 签名 |
| `wechat_service_oauth` | 网页授权 OAuth2.0 全流程 |
| `wechat_service_analytics` | datacube 17 项指标 |
| `wechat_service_intelligent` | OCR 7 类 + 图像处理 3 项 |
| `wechat_service_card` | 卡券精简(6 个 actions)|
### 🧠 多账号矩阵 + 知识库双写
- `accounts.<id>` 隔离 webhook 路径、access_token、agent 路由
- 每条对话自动同步本地 markdown(Karpathy 风格)+ Odoo `knowledge.article`
## 配置示例
完整 schema 见 npm 包根目录 [`README.md`](./README.md) 里的「配置 Schema」段落。
最小可用配置:
```yaml
channels:
wechat-service:
accounts:
main:
appId: wx1234567890abcdef
appSecret: ${WECHAT_SERVICE_APP_SECRET}
token: ${WECHAT_SERVICE_TOKEN}
encodingAESKey: ${WECHAT_SERVICE_AES_KEY}
encryptMode: safe
```
## 路线图(已收官)
```
v0.1.0 初始版本
v0.2.0 ✅ Phase 0 动态 Agent 框架
v0.3.0 ✅ Phase 1 通知能力补全
v0.4.0 ✅ Phase 2 OAuth + 数据统计
v1.0.0 ✅ Phase 3 智能开放 + 卡券(latest)
```
## 资源
- **npm**:https://www.npmjs.com/package/@huo15/wechat-service
- **源码**(cnb):https://cnb.cool/huo15/ai/huo15-openclaw-wechat-service
- **微信公众平台官方文档**:https://developers.weixin.qq.com/doc/service/guide/
- **OpenClaw**:https://docs.openclaw.ai/zh-CN
## 维护
青岛火一五信息科技有限公司(辉火云)· [email protected] · QQ 群 1093992108
ISC © jobzhaoREADME.md
# @huo15/wechat-service <hr> <p align="center"> <strong>打破信息孤岛,用一套系统驱动企业增长</strong><br> <strong>加速企业用户向全场景人工智能机器人转变</strong> </p> <table align="center" border="1" cellpadding="6"> <tr><td>🏫 教学机构</td><td>逸寻智库</td></tr> <tr><td>👨🏫 讲师</td><td>Job</td></tr> <tr><td>📧 联系方式</td><td>[email protected]</td></tr> <tr><td>💬 QQ群</td><td>1093992108</td></tr> <tr><td>📺 配套视频</td><td>B站视频:<a href="https://space.bilibili.com/400418085">https://space.bilibili.com/400418085</a></td></tr> </table> <p align="center"> <a href="https://www.npmjs.com/package/@huo15/wechat-service"><img src="https://img.shields.io/npm/v/@huo15/wechat-service?style=flat-square&logo=npm&color=blue" alt="npm" /></a> <a href="https://clawhub.ai/skills/huo15-openclaw-wechat-service"><img src="https://img.shields.io/badge/ClawHub-published-orange?style=flat-square" alt="ClawHub" /></a> <img src="https://img.shields.io/badge/OpenClaw-2026.3.23%2B-green?style=flat-square" alt="OpenClaw" /> <img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="License" /> <img src="https://img.shields.io/badge/Status-v2.3.x%20Stable-success?style=flat-square" alt="Stable" /> </p> <hr> ## 📖 正文内容 > **OpenClaw 微信服务号(公众号)渠道插件**:把微信公众号变成你的 AI 协作入口。 > 一粉一会话隔离 · 12 个 agent tool · 覆盖 60+ 个微信公众平台官方 API · 多账号矩阵路由 · 知识库双写 ``` @huo15/wechat-service v2.3.3 └─ 12 个 agent tool / 60+ 个 WeChat MP API / 架构按 @huo15/wecom 同构 ``` ### ✨ 能力总览 | 维度 | 说明 | |------|------| | **🚀 一粉一会话**(v2.3.0+ 默认开启) | 动态 Agent 派生:每个 openid 自动一个独立 agent + 独立 session / 记忆;管理员名单可旁路 | | **📨 消息全栈** | 客服消息(10 类)/ 模板消息(CRUD + 公模板库)/ 一次性 + **长期订阅通知** | | **📰 内容发布** | 素材管理 + 草稿箱 + `freepublish` 流水线 + 群发(按标签/openid,预览,撤回) | | **🔐 网页授权** | OAuth2.0 全流程(snsapi_base / snsapi_userinfo) + JS-SDK 签名 | | **📊 数据分析** | datacube 17 项指标(用户增减、图文阅读分享、消息分析、接口调用) | | **🤖 智能开放** | OCR 7 类(身份证/银行卡/驾驶证/行驶证/营业执照/车牌/通用) + 图像处理 3 项 | | **🎫 卡券精简** | create / get / batchget / delete / consume / decrypt encrypt_code | | **🧠 多账号矩阵** | `accounts.<id>` 隔离 webhook 路径、access_token、agent 路由 | | **🛡️ 权限控制**(v2.1.0+) | `permissionMode=admin-only` / `role-based`(5 级角色) + AI 对话护栏(v2.2.0) | | **💾 知识库双写** | 本地 markdown(Karpathy 风格)+ Odoo `knowledge.article` 同步;同时支持 `~/.openclaw/kb/shared/wiki/` 共享 KB 跨 agent 检索 | | **🤖 内置 persona 预设**(v2.3.0+) | 开箱即用 system instructions:`it-support` 通用 IT 客服 / `huo15-customer` 火一五·逸寻智库专属客服(含 6 产品 4 服务转化路径) | | **🪄 菜单事件短路**(v2.3.0+) | CLICK / VIEW / scancode_* / pic_* 等 8 类菜单事件默认不入 agent(粉丝不被骚扰),仅 `routing.events.<key>` 显式配置时走 | | **✍️ Markdown 自动降级**(v2.3.0+) | LLM 输出的 `**bold**` `# 标题` `- list` `[txt](url)` 自动转成微信 text 友好排版(公众号 text 不渲染原生 markdown)。下沉到 `sendCustomerServiceMessage` 底层,5 条 outbound 路径全覆盖(v2.3.1) | | **🔁 自动回复**(v2.2.0+ / v2.3.3 强化) | 关注欢迎语 `welcomeText` + 关键词触发 `keywords`(**v2.3.3 新增 glob 通配** `*xx*` / `prefix*` / `*suffix`)+ 业务时间 `businessHours` | --- ### 📦 安装 ```bash # 通过 OpenClaw 安装(推荐) /install @huo15/wechat-service # 或直接 npm npm install @huo15/wechat-service ```
_meta.json
{
"ownerId": "kn7byevkn40d6z4p7ghdb097z983tj33",
"slug": "huo15-openclaw-wechat-service",
"version": "2.3.5",
"publishedAt": 1778603601213
}CHANGELOG.md
# Changelog
## 2.3.5 — 2026-05-13(hotfix:errcode 45002 — 字节 vs 字符截断)
### 触发
用户截图反馈:升级 v2.3.x 之后粉丝在公众号发消息**只收到 placeholder「收到,正在为你处理...」**,**收不到 LLM 真回复**(agent 第二条消息丢失)。
### 根因诊断
Gateway log 出现关键错误:
```
[wechat-service] customer_service_send failed accountId=default:
API cgi-bin/message/custom/send failed:
errcode=45002 errmsg=content size out of limit
```
**errcode 45002 是「消息内容超长」**——微信公众号客服消息 `cgi-bin/message/custom/send` 的 `text.content` 字段限制是 **UTF-8 字节 2048**,**不是字符 2048**。
我在 v2.3.0 写的渲染器:
```ts
truncateForWechatText(rendered, 2000) // ← 按字符截 2000
```
中文 1 字在 UTF-8 占 **3 字节**:2000 中文字 = 6000 字节,远超 2048 字节限制。LLM 用 `huo15-customer` persona + KB 答得稍微详细一点(≥ 700 中文字),整段被微信拒绝下发。
placeholder 是另一条独立的被动回复 XML,不走这条路径,所以粉丝先收到 placeholder 后**第二条客服消息静默丢失**——这是最难诊断的失败模式。
### 改动
#### 1) `truncateForWechatText` 改字节截断 — `src/shared/markdown-to-wechat.ts`
```ts
// v2.3.5+ 改成按 UTF-8 字节截断
export function truncateForWechatText(text: string, maxBytes = 1900): string {
const encoder = new TextEncoder();
const bytes = encoder.encode(text);
if (bytes.length <= maxBytes) return text;
// 二分找最大 char index 使 utf-8 bytes <= maxBytes - 3
let lo = 0, hi = text.length;
while (lo < hi) {
const mid = (lo + hi + 1) >>> 1;
if (encoder.encode(text.slice(0, mid)).length <= maxBytes - 3) lo = mid;
else hi = mid - 1;
}
let cut = lo;
// 不截在 <a href> 标签内部(避免 XML 错乱)
const prefix = text.slice(0, cut);
const lastOpen = prefix.lastIndexOf("<");
const lastClose = prefix.lastIndexOf(">");
if (lastOpen > lastClose) cut = lastOpen;
return text.slice(0, cut) + "…";
}
```
默认值 **1900 字节**(留 148 字节余量给 envelope 开销 / `<a href>` 标签)。实际可用区间:
- 纯中文:≤ 600 汉字
- 纯英文:≤ 1900 字符
- 中英混合:取中间
- emoji(4 字节)也正确处理
#### 2) `dispatcher.ts` + `customer-service.ts` 去掉硬编码 `2000`
两处调用都不再传 maxChars,让函数走默认 1900 字节。
#### 3) 测试
新增 6 个用例覆盖:
- 纯英文按字节截断
- 纯中文按字节截断
- emoji(4 字节 UTF-8)正确处理
- 默认 maxBytes=1900:600 汉字(1800 字节)原样返回
- 默认 maxBytes=1900:700 汉字(2100 字节)会被截
- `<a href>` 标签不被截在内部(开闭标签数对齐)
**287/287 全绿**(v2.3.4 的 282 + 5 个新增)。
### 兼容性
- 零 API breaking:`truncateForWechatText(text)` 直接调(不传 maxBytes 用新默认 1900 字节)
- 老调用 `truncateForWechatText(text, 2000)` 参数语义变了(之前是字符数,现在是字节数)—— **重要变化**,但只有 plugin 内部调用,外部用户不会传这个参数
- LLM 输出超过 600 中文字现在能正常下发(之前直接被微信拒)
### 升级(强烈建议)
v2.3.0 ~ v2.3.4 都有这个 bug。升级路径:
```bash
openclaw plugins install @huo15/[email protected]
openclaw gateway restart
```
升级后验证:
- 给公众号发个消息触发 LLM 答详细一点(≥ 600 中文字的回答)
- 看 gateway log:`grep "customer_service_send\|errcode=45002" /tmp/openclaw/openclaw-$(date +%F).log`
- 不再出现 `errcode=45002` 即成功
### 教训
微信 / 企微 / 飞书等 IM 平台的消息长度限制**几乎都是字节不是字符**:
| 平台 | 限制 | 备注 |
|------|------|------|
| 微信公众号客服 text | 2048 字节 | `errcode 45002` |
| 微信公众号被动回复 XML | 2048 字节 | |
| 企业微信 markdown_v2 | 4096 字节 | |
| 企微 text | 2048 字节 | |
| 飞书 text | 2048 字节 | |
中文 1 字 = UTF-8 3 字节是基础常识但容易在写代码时遗忘——尤其是 JavaScript 的 `string.length` 是 UTF-16 code units 数,跟 UTF-8 字节数无关。已沉淀 memory `feedback_wechat_text_byte_limit_not_cCLAUDE.md
# @huo15/wechat-service — 火一五·微信服务号插件 OpenClaw 渠道插件,接入微信服务号(公众号),实现消息收发、菜单管理、客服/模板/订阅消息、素材/图文发布、标签群发、JS-SDK、多账号多 Agent 隔离与知识库双写。 ## 架构 ``` index.ts # 插件入口:注册 channel / webhook 路由 / agent tools src/ ├── channel.ts # ChannelPlugin 装配(config/outbound/gateway/status) ├── types.ts # 所有类型定义(WechatServiceConfig / ResolvedAccount / DynamicAgents 等) ├── runtime.ts # 运行时模块 re-export ├── monitor.ts # 公共入口 re-export ├── dynamic-agent.ts # 动态 Agent 派生(一粉一会话) ├── outbound.ts # 主动消息下发 ├── access-token.ts # Access Token 管理与自动刷新 ├── http-client.ts # HTTP 客户端(含重试/代理) ├── crypto.ts # 微信加解密(SHA1/AES) ├── auto-reply.ts # 自动回复:关键词匹配 / 业务时间 / 欢迎语模板 ├── config/ │ ├── accounts.ts # 账号解析(多账号矩阵) │ ├── derived-paths.ts # Webhook 路径推导 │ └── index.ts ├── app/ │ ├── account-runtime.ts # 账号状态机类 │ └── index.ts ├── shared/ │ ├── authorization.ts # 权限控制(open / admin-only / role-based) │ ├── roles.ts # 角色权限系统(resolveUserRole / checkRoleAuthorization) │ ├── guard.ts # AI 对话护栏(角色感知 system prompt 生成) │ ├── xml-parser.ts # XML 解析与被动回复构造 │ └── *.test.ts # 对应测试文件 ├── runtime/ │ └── dispatcher.ts # 消息分发:inbound → agent → 客服回复 ├── transport/webhook/ │ ├── handler.ts # HTTP webhook 入口(GET 校验 / POST 接收) │ ├── normalize.ts # XML → UnifiedInboundEvent │ ├── registry.ts # Webhook 目标注册表 │ └── common.ts # 通用 HTTP 工具 ├── api/ # 微信公众平台 API 封装(20+ 个) │ ├── customer-service.ts # 客服消息 (text/image/voice/video/news/mpnews/menu/miniprogram) │ ├── template-message.ts # 模板消息 CRUD + 公模板库 │ ├── subscribe-message.ts # 长期订阅通知 │ ├── menu.ts # 自定义菜单(基础 + 个性化) │ ├── material.ts # 临时/永久素材 │ ├── draft.ts # 草稿箱 + freepublish │ ├── user.ts # 用户信息/标签/黑名单 │ ├── user-tag.ts # 用户标签管理 │ ├── mass-send.ts # 群发(按标签/openid/预览/撤回) │ ├── oauth.ts # 网页授权 OAuth2.0 │ ├── jssdk.ts # JS-SDK 签名 │ ├── qrcode.ts # 带参二维码 │ ├── analytics.ts # 数据统计(datacube 17 项指标) │ ├── intelligent.ts # 智能开放(OCR 7 类 + 图像处理 3 项) │ ├── card.ts # 卡券精简(6 个 actions) │ └── *.test.ts ├── tools/ # Agent Tool 注册(12 个 tool / 60+ actions) │ ├── index.ts # registerWechatServiceTools() │ ├── shared.ts # 公共:resolveToolAccount / assertAuthorized / buildToolResult │ ├── menu-tool.ts # wechat_service_menu │ ├── message-tool.ts # wechat_service_message(25 actions) │ ├── material-tool.ts # wechat_service_material │ ├── article-tool.ts # wechat_service_article │ ├── user-tool.ts # wechat_service_user │ ├── qrcode-tool.ts # wechat_service_qrcode │ ├── mass-send-tool.ts # wechat_service_mass_send │ ├── jssdk-tool.ts
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/zhaobod1/skills/huo15-openclaw-wechat-service",
"sourceUrl": "https://clawhub.ai/zhaobod1/skills/huo15-openclaw-wechat-service",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T09:54:29.490Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-zhaobod1-huo15-openclaw-wechat-service/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-zhaobod1-huo15-openclaw-wechat-service/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T09:54:29.490Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.5K downloads",
"href": "https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service",
"sourceUrl": "https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T09:54:29.490Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "2.3.5",
"href": "https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service",
"sourceUrl": "https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-12T16:33:21.213Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-zhaobod1-huo15-openclaw-wechat-service/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-zhaobod1-huo15-openclaw-wechat-service/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 2.3.5",
"description": "v2.3.5 hotfix: 修复 LLM 回复被微信拒收的问题 - truncateForWechatText 改为按字节截断,严格适配微信 2048 字节限制(而非字符),默认保留 1900 字节安全余量 - 避免在 <a href> 标签中间截断,确保 XML 合法性 - 全面适配中文、emoji、混合文本场景,防止内容超长被 errcode 45002 拒绝 - 粉丝现可正常收到 LLM 回复,不再只收 placeholder - 通过 287 条 vitest 测试用例,承袭 v2.3.x 全部能力",
"href": "https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service",
"sourceUrl": "https://clawhub.ai/zhaobod1/huo15-openclaw-wechat-service",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-12T16:33:21.213Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
