{"id":"7535b260-3b9e-4def-99bf-b8959b910bf9","entityType":"agent","slug":"clawhub-noaheleven-weixinclawbot","name":"Weixinclaw Proactive Push","canonicalUrl":"https://www.xpersona.co/agent/clawhub-noaheleven-weixinclawbot","canonicalPath":"/agent/clawhub-noaheleven-weixinclawbot","generatedAt":"2026-10-12T12:06:31.801Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-12T00:50:21.454Z","emptyReason":null},"description":"通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。 Skill: Weixinclaw Proactive Push Owner: noaheleven Summary: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。 Tags: clawbot:1.0.3, latest:1.0.3, push:1.0.3, wechat:1.0.3, weixin:1.0.3 Version history: v1.0.3 | 2026-09-02T08:06:30.","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 965 downloads reported by the source. Last updated 10/12/2026.","installCommand":"clawhub skill install s176ns2k88htgg2h6v9myyxg7x83q8k1:weixinclawbot","sourceUrl":"https://clawhub.ai/noaheleven/weixinclawbot","homepage":"https://clawhub.ai/noaheleven/skills/weixinclawbot","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/noaheleven/weixinclawbot","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/noaheleven/skills/weixinclawbot","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-12T00:50:21.454Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T00:50:21.454Z","emptyReason":null},"stars":null,"forks":null,"downloads":965,"likes":null,"task":null,"library":null,"packageName":null,"latestVersion":"1.0.3","tractionLabel":"965 downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-12T00:50:21.354Z","emptyReason":null},"lastUpdatedAt":"2026-10-12T00:50:21.454Z","lastCrawledAt":"2026-10-12T00:50:21.354Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-13T00:50:21.354Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.3","createdAt":"2026-09-02T08:06:30.275Z","changelog":"同步 weixinclaw-proactive-push 0.1.2：2026-08-28 微信通道实测修正（会话过期后文本/媒体均 ret:-2，协议内无自激活，唯一激活=用户发消息）。","fileCount":5,"zipByteSize":18451},{"version":"1.0.2","createdAt":"2026-08-07T06:35:58.621Z","changelog":"本地最新版原样同步","fileCount":5,"zipByteSize":17820},{"version":"1.0.1","createdAt":"2026-07-10T01:14:15.953Z","changelog":"weixinclawbot v1.0.1 - 移除 init-host-persist.cjs 文件，删除 host 注入和 token 后台自动落盘的相关机制。 - 发送脚本现仅需直接调用 send.js，去除对 host 注入的依赖。 - 文本消息 context_token 使用空串即可，无需激活/无需 cursor 文件，流程简化。 - 富媒体 context_token 自动从游标 cursor 读取，改为纯代码实现，无需后台进程与守护。 - SKILL.md 完整重写，详细更新使用说明、关键机制、坑点解释以及凭证读取方式。","fileCount":4,"zipByteSize":16004}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s176ns2k88htgg2h6v9myyxg7x83q8k1:weixinclawbot","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-12T12:06:31.800Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-noaheleven-weixinclawbot/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-12T00:50:21.454Z","emptyReason":null},"readme":"Skill: Weixinclaw Proactive Push\n\nOwner: noaheleven\n\nSummary: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。\n\nTags: clawbot:1.0.3, latest:1.0.3, push:1.0.3, wechat:1.0.3, weixin:1.0.3\n\nVersion history:\n\nv1.0.3 | 2026-09-02T08:06:30.275Z | user\n\n同步 weixinclaw-proactive-push 0.1.2：2026-08-28 微信通道实测修正（会话过期后文本/媒体均 ret:-2，协议内无自激活，唯一激活=用户发消息）。\n\nv1.0.2 | 2026-08-07T06:35:58.621Z | user\n\n本地最新版原样同步\n\nv1.0.1 | 2026-07-10T01:14:15.953Z | user\n\nweixinclawbot v1.0.1\n\n- 移除 init-host-persist.cjs 文件，删除 host 注入和 token 后台自动落盘的相关机制。\n- 发送脚本现仅需直接调用 send.js，去除对 host 注入的依赖。\n- 文本消息 context_token 使用空串即可，无需激活/无需 cursor 文件，流程简化。\n- 富媒体 context_token 自动从游标 cursor 读取，改为纯代码实现，无需后台进程与守护。\n- SKILL.md 完整重写，详细更新使用说明、关键机制、坑点解释以及凭证读取方式。\n\nArchive index:\n\nArchive v1.0.3: 5 files, 18451 bytes\n\nFiles: README.md (3014b), send.js (19955b), skill-card.md (2444b), SKILL.md (16841b), _meta.json (132b)\n\nFile v1.0.3:SKILL.md\n\n---\nname: weixinclaw-proactive-push\ndescription: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。\n---\n\n> 📦 **本 skill 源码仓库**：https://github.com/NoahEleven/weixinclaw-proactive-push （公开，欢迎 clone / 提 Issue）\n>\n> 🔒 **隐私红线（务必遵守）**：本 skill 运行时**只读本机凭据、不写出任何密钥、日志不打印 token 明文**。\n> 分享 / 备份 / 提交时，**严禁**携带以下文件（含 bot 完整凭证 / 老板微信 id）：\n> - `~/.workbuddy/settings.json`（含完整 `botToken`、`userId`）\n> - `~/.workbuddy/claw-state/weixin/`（cursor 游标内含 bot 凭证镜像 `get_updates_buf`）\n> 本仓库**只含 `SKILL.md` + `send.js`**，接收方用自己的 `settings.json` 即可，无需你提供任何密钥。\n\n# 微信(ClawBot)主动推送（weixinClawBot / ilink bot）\n\n## 背景\nWorkBuddy 迁移自 OpenClaw。微信主动推送能力其实**一直活着**，藏在\n`~/.workbuddy/settings.json` 的 `claw/users/<uid>/channels/weixinClawBot` 里——\n它是 ClawBot 的微信 bot 通道（ilink bot，polling 模式），对接 `https://ilinkai.weixin.qq.com`。\n\n> ⚠️ **这不是微信客服号**：微信客服号走公众平台客服消息 API（48 小时会话限制），\n> 而本通道是 WorkBuddy / ClawBot 内置的 bot 通道，走 ilink bot API，可随时主动推送，不受客服号限制。\n\n协议实现**严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`**\n（npm 包，含 `src/api/api.ts`、`src/api/types.ts`、`src/messaging/*`、`src/cdn/*`）。\n关键常量、请求头、item 结构、AES 加密、错误码检查均与官方保持一致。\n\n> ⚠️ `openclaw-weixin-cli` 不需要装（那是 OpenClaw 的通道安装器，对 WorkBuddy 无用）。\n\n## 何时用\n- \"通过 ClawBot 主动推一条消息给老板\"（文本默认空 context_token，无需激活；详见下方机制专节）\n- \"微信主动推送测试\"\"给老板发条微信 bot 消息\"\n- \"发张图/发个文件/发段视频给老板\"（context_token 自动读取，详见机制专节）\n- 定时任务把结果主动推到老板微信（ClawBot bot 消息，非对话气泡）\n\n## 怎么跑\n脚本自动读 `settings.json` 取凭据与收件人，向老板微信发消息：\n\n```bash\nNODE=\"C:/Users/<USER>/.workbuddy/binaries/node/versions/22.22.2/node.exe\"   # 将 <USER> 换成你的 Windows 用户名\nSKILL=\"C:/Users/<USER>/.workbuddy/skills/weixinclaw-proactive-push/send.js\"  # ⚠️ 必须指到 send.js；只传目录会 MODULE_NOT_FOUND（无 package.json main）\n\n# 文本（默认空 context_token，无需激活；详见下方机制专节）\n\"$NODE\" \"$SKILL\" \"🦐 你的消息内容\"\n\n# 从文件读长文本\n\"$NODE\" \"$SKILL\" --text-file 内容.txt\n\n# 图片 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --image 截图.png --caption \"看这张图\"\n\n# 文件 + 文件名 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --file 报告.pdf --name \"周报.pdf\" --caption \"请查阅\"\n\n# 视频（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --video clip.mp4\n\n# 显式指定 token（极端兜底：手动传入一个已知有效的 context_token）\n\"$NODE\" \"$SKILL\" \"回复内容\" --context <context_token>\n```\n\n- 不传参数 → 发送默认测试文案（文本）。\n- 跑的时候若因沙箱拦截网络，加 `dangerouslyDisableSandbox: true`（或在弹窗点允许）。\n- 成功标志：终端打印 `[weixinclaw] OK`，老板微信里会收到一条 **ClawBot bot 消息**（不是对话气泡）。\n\n## 凭据从哪来（settings.json）\n```\nclaw/users/<uid>/channels/weixinClawBot = {\n  \"enabled\": true,\n  \"channelId\": \"<你的 bot channelId，从你的 settings.json 读取>\",\n  \"botToken\":  \"<完整 botToken 串，含 accountId: 前缀；脚本自动从你的 settings.json 读取，无需手填>\",  // 完整 token = Bearer 凭据\n  \"baseUrl\":   \"https://ilinkai.weixin.qq.com\",                                // apiBaseUrl\n  \"accountId\": \"<你的 bot accountId，从你的 settings.json 读取>\",\n  \"userId\":    \"<老板的 im.wechat id = to_user_id；脚本自动从你的 settings.json 读取>\",                       // 老板的 im.wechat id = to_user_id\n  \"connectionMode\": \"polling\"\n}\n```\n\n> 🔒 以上字段均为接收方**自己**的 `settings.json` 内容，无需分享者提供。脚本只读取、不写出。\n\n## 🔴 关键机制：context_token（2026-07-09 定稿）\n\n### 文本默认空 token；只有媒体才带 cursor buf\n- **⚠️ 2026-08-28 实测修正**：服务端行为已收紧——**会话过期后，连空 token 的文本也会 `ret:-2 \"prepare failed\"`**。\n  \"文本无需激活\" 的旧结论已失效；激活后文本/媒体在当天会话窗口内都正常。\n- **文本推送**：`msg.context_token` 默认传【空串】（会话存活时即可发送）。\n- **媒体推送（图片 / 文件 / 视频）**：**必须**带非空 `context_token`，\n  唯一来源是 cursor 游标里的 `get_updates_buf`（见下）。空 token 发媒体会 `ret:-2`。\n- **任何被拒（`ret:-2`）都要激活**：需要老板/用户在微信给 ClawBot 发消息激活后重跑（详见排错表）。\n\n### 协议层自激活：已验证无解（2026-08-28 全端点实测）\n- 真正的 `context_token` 是**每条收到的消息自带**的（官方 inbound.js：*\"contextToken is issued per-message\n  by the Weixin getupdates API and must be echoed verbatim in every outbound send\"*），\n  服务端用它校验**用户侧下行会话**（约 1 天无用户消息即过期），这是微信 bot 反骚扰设计，客户端无法绕过。\n- 以下手段**全部无效**（都能调通但救不活会话）：\n  - `ilink/bot/msg/notifystart`（生命周期通知，ret:0，无效果）\n  - `ilink/bot/getconfig` + `ilink/bot/sendtyping`（typing_ticket 可正常拿到、sendtyping ret:0，无效果）\n  - 先发文本再发媒体（文本自身也被拒，无效果）\n  - 重复调 `getupdates` / 重读 cursor buf（buf 凭证本身有效，死的是会话，不是凭证）\n- **不受会话校验的端点**：`getupdates`、`getuploadurl`、CDN 上传、`getconfig`、`sendtyping`、`notifystart` 都能通；\n  唯一卡 `sendmessage` 的 \"prepare\"（下行会话准备）这一步。\n- 唯一激活方式 = **用户在微信给 ClawBot 发一条消息**（可用 PC 微信 UI 自动化代发，属协议外手段）。\n\n### 媒体的 context_token 来源：cursor 游标里的 `get_updates_buf`\n\n- host 实时把 ilink 接收会话游标写进\n  `~/.workbuddy/claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 的 `get_updates_buf` 字段。\n- 该字段值是 **base64 编码的 protobuf**；我们**把整段 base64 串原样**当作 `context_token` 用\n  （不是解码出来的 botToken 串，也不是里面的 accountId 段）。\n\n> ✅❌ **读取铁律（违反任何一条都会 ret:-2，这是\"编码读取方式\"的要害）**\n> 1. **以 UTF-8 文本**读 `cursor.json` → ② `JSON.parse` → ③ 取 `get_updates_buf` 字段的【字符串值】 →\n>    ④ **原样**作为 `context_token`。\n> 2. ❌ 严禁对这串做任何变换：**base64 解码、重新编码、trim、URL-decode、转义、换行、截断、大小写改写**。\n>    base64 串里全是 `A-Za-z0-9+/=` 字符，JSON 安全，**直接原样塞进 `context_token` 字段即可**。\n> 3. ❌ 不要\"聪明地\"解析 / 改写 / 重组这个串——它就是个不透明令牌，服务端的校验逻辑你是看不见的，任何本地变换都只会让它失效。\n> 4. ✅ 直接用本仓库的 `send.js`（已封装以上全部），**不要手工拼请求**——手工拼最容易在读取这步翻车。\n\n- **凭证稳定、不要误判**：`botToken` / `accountId` 段（形如 `<ACCOUNT_ID>`）约 **1 天**才轮换一次，期间**一直有效、不变是正常的**，它**不是**失效信号，别拿它判断 buf 是否过期。\n- **文本无需激活**：文本走空 token，会话闲置多久都能发（实测跨十几小时）；只有出现 `ret:-2` 时才需激活。\n- **媒体激活一次可长期使用**：媒体带 cursor buf，只要此前已激活过且没收到 `ret:-2`，就可持续推送，**不需要每次推送前都重新发消息**。\n- **文本被拒 = id 变了，也要激活**：文本平时空 token 能发；一旦文本 `ret:-2`，大概率底层 bot id 轮换，**同样**先发消息激活再重跑。\n- ⚠️ **未激活时反复直接重跑必定再次 `ret:-2`**——请务必先完成\"发消息激活\"这个动作，再重跑命令。\n- 实测：媒体用 buf 当 `context_token` + 完整 `botToken` 当 Bearer ⇒ `{}` 成功，且不读 context-token.json、无需轮询。\n- 编码细节：`get_updates_buf` 解码后为约 78 字节 protobuf，含 `botId`(varint) + 账号标识 +\n  botToken 明文段（`accountId@im.bot:secret`）。\n\n> 🔒 `get_updates_buf` 内嵌了 bot 凭证副本，**绝不要**把它粘贴到聊天、Issue、或随仓库提交。\n\n### `im.bot.cursor.json` 文件的更新机制（务必分清\"文件刷新\"和\"buf 轮换\"两件事）\n\n文件路径：`~/.workbuddy/claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json`\n（`<ACCOUNT_ID>` = bot accountId 段，如同一个 bot 换了凭证/会话，文件名的这段会变，会出现新的一份 cursor 文件）。\n\n**① 文件何时被创建**\n- 该文件由 host（WorkBuddy 后台的 ilink bot 长轮询）维护。**通道必须先建立过会话**才会有这个文件——\n  即老板/用户曾在微信给 ClawBot 发过消息、host 侧建立了接收游标。\n- 若目录里没有任何 `*_im.bot.cursor.json`：让老板/用户**先在微信给 ClawBot 发一条消息**，host 才会写出该文件。\n\n**② 文件 mtime（修改时间）——host 实时刷新，别拿它当判断依据**\n- host 在**每一轮长轮询写盘游标**时都会更新该文件的 mtime，非常频繁，且**与你是否发消息无关**（是 host 侧实时行为，不是你触发的）。\n- ⚠️ 因此 **绝不能用 mtime（\"多久没变 / 刚变过\"）来判断 buf 是否新鲜、是否需要刷新**——mtime 一直在变，但 `get_updates_buf` 的值**未必**跟着变。这是最容易误判的点。\n\n**③ `get_updates_buf` 内容（真正的 token）——稳定，靠\"激活\"刷新，不靠时间猜**\n- 这才是我们要的 token。它在 bot 凭证/会话有效期内**保持稳定**（`accountId` 段约 1 天轮换一次，期间不变属正常）。\n  - 判断是否需要刷新，**唯一依据是「实际推送是否被服务端拒绝（`ret:-2`）」**：\n    - 被拒＝当前 buf 暂时不可发送 → **让老板/用户在微信给 ClawBot 发一条消息激活**（host 随即刷新游标），再重跑 `send.js` 自动读最新 buf 重发即可。\n    - 只要不被拒，**激活一次即可在较长时间内反复推送**（实测跨十几小时仍能成功），不需要每次推送前都发消息激活。\n    - ⚠️ **不要**把 mtime 变化、或\"buf 值有没有变\"当成判断条件——这两者都不决定可发送性，纯属干扰。\n- `send.js` 收到 `-2` 会【清晰报错并退出】，不内置轮询等待（\"等待刷新\"退步逻辑已彻底删除）；由你手动激活后重跑命令即可。\n\n### send.js 的取值优先级\n```\n文本：ctx = --context 显式传入 ＞ 【空串】（默认，无需 cursor / 激活）\n媒体：ctx = --context 显式传入 ＞ 读最新 <ACCOUNT_ID>_im.bot.cursor.json 的 get_updates_buf（默认走这条）\n```\n（媒体的 `get_updates_buf` 为空、或任何推送被拒 `ret:-2`（含文本被拒＝id 变了）时：\n**先让老板/用户自己在微信给 ClawBot 发一条消息激活**（host 随即刷新游标），再重跑 `send.js`；\n仍失败再走 `--context <token>` 显式兜底。）\n\n## 🔴 关键坑（必看，否则必失败）\n1. **Bearer token 必须用完整 `botToken` 串**（含 `accountId:` 前缀），即\n   `<完整 botToken 串（含 accountId: 前缀），从你的 settings.json 读取>`。\n   只取冒号后的短串会返回 `errcode:-14 session timeout`，推送失败。\n2. **协议常量对齐官方 `@tencent-weixin/openclaw-weixin@2.4.6`**（不要再用旧值）：\n   - `channel_version = \"2.4.6\"`（早期实现误用 `cbc-1.0.0`，现已对齐官方）\n   - `iLink-App-ClientVersion = 132102`（= `buildClientVersion(\"2.4.6\")`）\n   - `iLink-App-Id = \"bot\"`，`bot_agent = \"OpenClaw\"`\n3. **文本默认空 `context_token` 即可**；**媒体推送必须带有效 `context_token`**（见上节），否则 `ret:-2` 拒收。文本若也被拒 `ret:-2`，大概率 bot id 轮换，需激活。\n\n## 发送契约（对齐官方 ilink bot 协议）\n- 端点：`POST {baseUrl}/ilink/bot/sendmessage`\n- 请求头（完整，缺一不可）：\n  - `Authorization: Bearer <完整botToken>`\n  - `AuthorizationType: ilink_bot_token`\n  - `X-WECHAT-UIN: <随机4字节uint32的base64>`\n  - `iLink-App-Id: bot`\n  - `iLink-App-ClientVersion: 132102`\n  - `Content-Type: application/json`\n- Body（文本）：\n```json\n{\n  \"msg\": {\n    \"from_user_id\": \"\",\n    \"to_user_id\": \"<boss的im.wechat id>\",\n    \"client_id\": \"<16位随机hex>\",\n    \"message_type\": 2,\n    \"message_state\": 2,\n    \"item_list\": [{ \"type\": 1, \"text_item\": { \"text\": \"消息内容\" } }],\n    \"context_token\": \"<从 cursor 读取的 get_updates_buf>\"\n  },\n  \"base_info\": { \"channel_version\": \"2.4.6\", \"bot_agent\": \"OpenClaw\" }\n}\n```\n- `item_list` 类型：`1=文本` / `2=图片` / `4=文件` / `5=视频`（text 超 4000 字自动分片）。\n- 成功判定：`sendmessage` 返回 `{}`（host 视 `ret` 缺失为成功）；`ret` 非零（如 `-2`）即失败。\n- 会话存活自检：`POST {baseUrl}/ilink/bot/getupdates` 返回无 `errcode` 即健康。\n\n## 富媒体流程（图片/文件/视频）\n0. **context_token 自动从 cursor 游标读取**（详见上方机制专节），无需手动准备。没有会 `ret:-2`。\n1. 生成 16 字节随机 AES 密钥 `aesKey`，`aesKeyHex = aesKey.toString('hex')`。\n2. `POST /ilink/bot/getuploadurl`，body：`filekey, media_type(1=IMAGE/2=VIDEO/3=FILE), to_user_id, rawsize, rawfilemd5, filesize(密文长), aeskey(aesKeyHex), no_need_thumb`。\n3. 取响应 `upload_full_url`（或旧版 `upload_param` 拼 `https://novac2c.cdn.weixin.qq.com/c2c/upload?encrypted_query_param=...&filekey=...`）。\n4. `POST` 密文（AES-128-ECB(PKCS7) 加密后的文件）到该 URL，`Content-Type: application/octet-stream`。\n5. 取响应头 `x-encrypted-param` 作为下载令牌 `encrypt_query_param`。\n6. 构造 item：`media = { encrypt_query_param, aes_key: base64(aesKeyHex), encrypt_type: 1 }`，\n   图片加 `mid_size`，文件加 `file_name`+`len`，视频加 `video_size`。\n7. `POST /ilink/bot/sendmessage`，`msg.context_token` = 有效 token。\n\n## 排错\n| 现象 | 原因 | 解决 |\n|------|------|------|\n| `errcode:-14 session timeout` | 用了短 token | 改用完整 `botToken` 串 |\n| `FAILED: API ret=-2` (errmsg `prepare failed`) | **用户侧下行会话过期**（约 1 天无用户消息即失效，2026-08-28 实测文本/媒体都受此校验，协议内无自激活手段，见上方专节） | **【必须】先到微信给 ClawBot 发一条任意消息**（激活下行会话），**激活后再重跑本命令**，`send.js` 自动读最新 buf 重发。⚠️ 未激活时反复直接重跑必定再次 `ret:-2`；不要拿 mtime 或\"buf 值变没变\"当判断条件；`send.js` 收到 `-2` 会清晰报错并退出（不内置轮询）；仍失败再显式 `--context <token>` 兜底 |\n| 网络超时 / fetch 失败 | 默认沙箱拦截出网 | 加 `dangerouslyDisableSandbox: true` 或点允许 |\n| 通道找不到 | settings.json 路径/字段变了 | 按上文\"凭据从哪来\"手动核对路径 |\n| 走错通道 | 误用 MCP 的 weixin/wecom | 确认用 `weixinClawBot`（ClawBot），不是 MCP connector |\n| 富媒体上传失败 | `getuploadurl` 未返回 url / CDN 缺 `x-encrypted-param` | 检查 botToken 完整、网络可达 CDN |\n| 文本类文件（.txt/.md）中文乱码 | 源文件 UTF-8 无 BOM，微信/Windows 按 GBK 解码 | send.js 已自动为文本类文件补 UTF-8 BOM，无需手动处理 |\n| `文件不存在: ...` | 传入的媒体路径错误 | 检查 `--image/--file/--video` 指向的文件路径 |\n| `缺少 botToken` / `缺少 userId` | settings.json 的 weixinClawBot 配置不完整 | 按\"凭据从哪来\"补全字段 |\n\nFile v1.0.3:README.md\n\n# weixinclaw-proactive-push\n\n通过 WorkBuddy 已连接的 **ClawBot 微信 bot 通道**（`weixinClawBot` / ilink bot，**非微信客服号**）主动向老板微信推送 **文本 / 图片 / 文件 / 视频**。\n\n协议严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`（`src/api` + `src/messaging` + `src/cdn`）。\n\n> 本 skill 源码即本仓库：clone 后放入 `~/.workbuddy/skills/weixinclaw-proactive-push/` 即可使用。\n\n## 文件说明\n\n| 文件 | 作用 |\n|---|---|\n| `SKILL.md` | 完整使用文档（通道原理、token 获取、推送、排错） |\n| `send.js` | 推送主脚本：文本 / 图片 / 文件 / 视频 |\n\n## 核心机制（2026-07-09 定稿）\n\n| 推送类型 | `context_token` | 是否需要激活 |\n|----------|------------------|--------------|\n| **文本** | 默认**空串**，长期有效 | ❌ 不需要 |\n| **媒体**（图片 / 文件 / 视频）| **必须**带 → 读 `claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 的 `get_updates_buf`（原样，零变换） | 读不到 / 被拒才激活 |\n| **任意类型被拒 `ret:-2`** | — | ✅ 都要激活（文本被拒通常是底层 bot id 轮换，同样需激活） |\n\n- **文本免激活的原因**：空 `context_token` 对文本长期有效，因此闲置十几小时仍能推文字。\n- **媒体必须带 token**：图片 / 文件 / 视频接口强制要求非空 `context_token`，从宿主刷新的 cursor 游标文件读取。\n- **唯一需要激活的时刻 = 实际被拒（`ret:-2`）**：先到微信给 ClawBot 发一条任意消息激活，再重跑 `send.js` 自动读最新游标重发。\n\n### 协议常量（官方 `@tencent-weixin/openclaw-weixin@2.4.6`）\n\n- `Authorization: Bearer <完整 botToken，含 accountId: 前缀>`\n- 6 个请求头：`Content-Type`、`AuthorizationType: ilink_bot_token`、`X-WECHAT-UIN`、`Authorization`、`iLink-App-Id: bot`、`iLink-App-ClientVersion: 132102`\n- `base_info`：`{ channel_version: \"2.4.6\", bot_agent: \"OpenClaw\" }`\n- 发送接口：`POST {baseUrl}/ilink/bot/sendmessage`，`baseUrl = https://ilinkai.weixin.qq.com`\n\n### 🔴 隐私红线\n\n- `claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 内含 bot 凭证镜像，**禁止随仓库提交 / 分享**。\n- 本 skill 仅**只读**本机凭据（从 `settings.json` 与本地 cursor 文件读取），不向任何文件写入密钥。\n- 日志只打印 token 长度，绝不打印明文。\n\n## 快速开始\n\n```bash\n# 0. 依赖：Node 18+（推荐 WorkBuddy managed node 22）\n# 1. 确保 settings.json 已配置 weixinClawBot 通道（凭据自动读取，无需手填）\n\n# 2. 推送文本（context_token 默认空，免激活）\nnode send.js \"你好，老板 🦐\"\n\n# 3. 推送图片 / 文件 / 视频（自动读 cursor 游标当 context_token）\nnode send.js --image ./pic.png\nnode send.js --file  ./report.pdf\nnode send.js --video ./clip.mp4\n\n# 4. 显式覆盖 context_token（一般情况不需要）\nnode send.js \"文本\" --context \"<token>\"\n```\n\n详见 `SKILL.md`。\n\nFile v1.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn769gn5we5rgv7bfhb9ztd8j983p8qc\",\n  \"slug\": \"weixinclawbot\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1788336390275\n}\n\nFile v1.0.3:skill-card.md\n\n## Description:\n\nSends proactive text, image, file, and video messages through a locally configured WorkBuddy ClawBot WeChat bot channel.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[noaheleven](https://clawhub.ai/user/noaheleven)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent operators use this skill when an agent needs to send proactive WeChat notifications or media to a configured recipient through the user's local WorkBuddy ClawBot account.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can send real WeChat messages and files through the user's local WorkBuddy ClawBot account.\n\nMitigation: Use it only for intentional outbound notifications to the configured recipient, and add an explicit confirmation step before routine or automated sends.\n\nRisk: Local bot tokens, cursor files, context tokens, message contents, and recipient IDs are sensitive.\n\nMitigation: Keep settings and cursor files local, avoid sharing them, and redact recipient identifiers and token-derived values from logs or transcripts.\n\nRisk: Credentials could be sent to an unexpected endpoint if local configuration is altered.\n\nMitigation: Verify that ~/.workbuddy/settings.json uses the official Weixin iLink base URL before running the skill.\n\nRisk: Broad sandbox bypasses increase the chance of unintended network access.\n\nMitigation: Avoid disabling sandboxing broadly; grant only the network access needed for the intended WeChat send workflow.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/noaheleven/skills/weixinclawbot)\n- [Publisher profile](https://clawhub.ai/user/noaheleven)\n- [Weixin iLink endpoint](https://ilinkai.weixin.qq.com)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Plain text or Markdown guidance with shell commands; runtime sends WeChat bot text or media messages]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can send text, images, files, or videos using local WorkBuddy ClawBot credentials.]\n\n## Skill Version(s):\n\n1.0.3 (source: ClawHub release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.0.2: 5 files, 17820 bytes\n\nFiles: README.md (3014b), send.js (19853b), skill-card.md (2375b), SKILL.md (15631b), _meta.json (132b)\n\nFile v1.0.2:SKILL.md\n\n---\nname: weixinclaw-proactive-push\ndescription: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。\n---\n\n> 📦 **本 skill 源码仓库**：https://github.com/NoahEleven/weixinclaw-proactive-push （公开，欢迎 clone / 提 Issue）\n>\n> 🔒 **隐私红线（务必遵守）**：本 skill 运行时**只读本机凭据、不写出任何密钥、日志不打印 token 明文**。\n> 分享 / 备份 / 提交时，**严禁**携带以下文件（含 bot 完整凭证 / 老板微信 id）：\n> - `~/.workbuddy/settings.json`（含完整 `botToken`、`userId`）\n> - `~/.workbuddy/claw-state/weixin/`（cursor 游标内含 bot 凭证镜像 `get_updates_buf`）\n> 本仓库**只含 `SKILL.md` + `send.js`**，接收方用自己的 `settings.json` 即可，无需你提供任何密钥。\n\n# 微信(ClawBot)主动推送（weixinClawBot / ilink bot）\n\n## 背景\nWorkBuddy 迁移自 OpenClaw。微信主动推送能力其实**一直活着**，藏在\n`~/.workbuddy/settings.json` 的 `claw/users/<uid>/channels/weixinClawBot` 里——\n它是 ClawBot 的微信 bot 通道（ilink bot，polling 模式），对接 `https://ilinkai.weixin.qq.com`。\n\n> ⚠️ **这不是微信客服号**：微信客服号走公众平台客服消息 API（48 小时会话限制），\n> 而本通道是 WorkBuddy / ClawBot 内置的 bot 通道，走 ilink bot API，可随时主动推送，不受客服号限制。\n\n协议实现**严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`**\n（npm 包，含 `src/api/api.ts`、`src/api/types.ts`、`src/messaging/*`、`src/cdn/*`）。\n关键常量、请求头、item 结构、AES 加密、错误码检查均与官方保持一致。\n\n> ⚠️ `openclaw-weixin-cli` 不需要装（那是 OpenClaw 的通道安装器，对 WorkBuddy 无用）。\n\n## 何时用\n- \"通过 ClawBot 主动推一条消息给老板\"（文本默认空 context_token，无需激活；详见下方机制专节）\n- \"微信主动推送测试\"\"给老板发条微信 bot 消息\"\n- \"发张图/发个文件/发段视频给老板\"（context_token 自动读取，详见机制专节）\n- 定时任务把结果主动推到老板微信（ClawBot bot 消息，非对话气泡）\n\n## 怎么跑\n脚本自动读 `settings.json` 取凭据与收件人，向老板微信发消息：\n\n```bash\nNODE=\"C:/Users/<USER>/.workbuddy/binaries/node/versions/22.22.2/node.exe\"   # 将 <USER> 换成你的 Windows 用户名\nSKILL=\"C:/Users/<USER>/.workbuddy/skills/weixinclaw-proactive-push/send.js\"  # ⚠️ 必须指到 send.js；只传目录会 MODULE_NOT_FOUND（无 package.json main）\n\n# 文本（默认空 context_token，无需激活；详见下方机制专节）\n\"$NODE\" \"$SKILL\" \"🦐 你的消息内容\"\n\n# 从文件读长文本\n\"$NODE\" \"$SKILL\" --text-file 内容.txt\n\n# 图片 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --image 截图.png --caption \"看这张图\"\n\n# 文件 + 文件名 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --file 报告.pdf --name \"周报.pdf\" --caption \"请查阅\"\n\n# 视频（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --video clip.mp4\n\n# 显式指定 token（极端兜底：手动传入一个已知有效的 context_token）\n\"$NODE\" \"$SKILL\" \"回复内容\" --context <context_token>\n```\n\n- 不传参数 → 发送默认测试文案（文本）。\n- 跑的时候若因沙箱拦截网络，加 `dangerouslyDisableSandbox: true`（或在弹窗点允许）。\n- 成功标志：终端打印 `[weixinclaw] OK`，老板微信里会收到一条 **ClawBot bot 消息**（不是对话气泡）。\n\n## 凭据从哪来（settings.json）\n```\nclaw/users/<uid>/channels/weixinClawBot = {\n  \"enabled\": true,\n  \"channelId\": \"<你的 bot channelId，从你的 settings.json 读取>\",\n  \"botToken\":  \"<完整 botToken 串，含 accountId: 前缀；脚本自动从你的 settings.json 读取，无需手填>\",  // 完整 token = Bearer 凭据\n  \"baseUrl\":   \"https://ilinkai.weixin.qq.com\",                                // apiBaseUrl\n  \"accountId\": \"<你的 bot accountId，从你的 settings.json 读取>\",\n  \"userId\":    \"<老板的 im.wechat id = to_user_id；脚本自动从你的 settings.json 读取>\",                       // 老板的 im.wechat id = to_user_id\n  \"connectionMode\": \"polling\"\n}\n```\n\n> 🔒 以上字段均为接收方**自己**的 `settings.json` 内容，无需分享者提供。脚本只读取、不写出。\n\n## 🔴 关键机制：context_token（2026-07-09 定稿）\n\n### 文本默认空 token；只有媒体才带 cursor buf\n- **文本推送**：`msg.context_token` 默认传【空串】即可发送，**无需读 cursor、无需激活**。\n  这就是为什么会话闲置十几小时（例如昨晚到今早）文本仍能正常推送——空 token 对文本长期有效。\n- **媒体推送（图片 / 文件 / 视频）**：**必须**带非空 `context_token`，\n  唯一来源是 cursor 游标里的 `get_updates_buf`（见下）。空 token 发媒体会 `ret:-2`。\n- **任何被拒（`ret:-2`）都要激活**：文本平时用空 token 就能发，一旦**文本也被拒**，\n  大概率是底层 bot id / 凭证已轮换，**同样需要**先给 ClawBot 发消息激活后重跑（详见排错表）。\n\n### 媒体的 context_token 来源：cursor 游标里的 `get_updates_buf`\n\n- host 实时把 ilink 接收会话游标写进\n  `~/.workbuddy/claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 的 `get_updates_buf` 字段。\n- 该字段值是 **base64 编码的 protobuf**；我们**把整段 base64 串原样**当作 `context_token` 用\n  （不是解码出来的 botToken 串，也不是里面的 accountId 段）。\n\n> ✅❌ **读取铁律（违反任何一条都会 ret:-2，这是\"编码读取方式\"的要害）**\n> 1. **以 UTF-8 文本**读 `cursor.json` → ② `JSON.parse` → ③ 取 `get_updates_buf` 字段的【字符串值】 →\n>    ④ **原样**作为 `context_token`。\n> 2. ❌ 严禁对这串做任何变换：**base64 解码、重新编码、trim、URL-decode、转义、换行、截断、大小写改写**。\n>    base64 串里全是 `A-Za-z0-9+/=` 字符，JSON 安全，**直接原样塞进 `context_token` 字段即可**。\n> 3. ❌ 不要\"聪明地\"解析 / 改写 / 重组这个串——它就是个不透明令牌，服务端的校验逻辑你是看不见的，任何本地变换都只会让它失效。\n> 4. ✅ 直接用本仓库的 `send.js`（已封装以上全部），**不要手工拼请求**——手工拼最容易在读取这步翻车。\n\n- **凭证稳定、不要误判**：`botToken` / `accountId` 段（形如 `<ACCOUNT_ID>`）约 **1 天**才轮换一次，期间**一直有效、不变是正常的**，它**不是**失效信号，别拿它判断 buf 是否过期。\n- **文本无需激活**：文本走空 token，会话闲置多久都能发（实测跨十几小时）；只有出现 `ret:-2` 时才需激活。\n- **媒体激活一次可长期使用**：媒体带 cursor buf，只要此前已激活过且没收到 `ret:-2`，就可持续推送，**不需要每次推送前都重新发消息**。\n- **文本被拒 = id 变了，也要激活**：文本平时空 token 能发；一旦文本 `ret:-2`，大概率底层 bot id 轮换，**同样**先发消息激活再重跑。\n- ⚠️ **未激活时反复直接重跑必定再次 `ret:-2`**——请务必先完成\"发消息激活\"这个动作，再重跑命令。\n- 实测：媒体用 buf 当 `context_token` + 完整 `botToken` 当 Bearer ⇒ `{}` 成功，且不读 context-token.json、无需轮询。\n- 编码细节：`get_updates_buf` 解码后为约 78 字节 protobuf，含 `botId`(varint) + 账号标识 +\n  botToken 明文段（`accountId@im.bot:secret`）。\n\n> 🔒 `get_updates_buf` 内嵌了 bot 凭证副本，**绝不要**把它粘贴到聊天、Issue、或随仓库提交。\n\n### `im.bot.cursor.json` 文件的更新机制（务必分清\"文件刷新\"和\"buf 轮换\"两件事）\n\n文件路径：`~/.workbuddy/claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json`\n（`<ACCOUNT_ID>` = bot accountId 段，如同一个 bot 换了凭证/会话，文件名的这段会变，会出现新的一份 cursor 文件）。\n\n**① 文件何时被创建**\n- 该文件由 host（WorkBuddy 后台的 ilink bot 长轮询）维护。**通道必须先建立过会话**才会有这个文件——\n  即老板/用户曾在微信给 ClawBot 发过消息、host 侧建立了接收游标。\n- 若目录里没有任何 `*_im.bot.cursor.json`：让老板/用户**先在微信给 ClawBot 发一条消息**，host 才会写出该文件。\n\n**② 文件 mtime（修改时间）——host 实时刷新，别拿它当判断依据**\n- host 在**每一轮长轮询写盘游标**时都会更新该文件的 mtime，非常频繁，且**与你是否发消息无关**（是 host 侧实时行为，不是你触发的）。\n- ⚠️ 因此 **绝不能用 mtime（\"多久没变 / 刚变过\"）来判断 buf 是否新鲜、是否需要刷新**——mtime 一直在变，但 `get_updates_buf` 的值**未必**跟着变。这是最容易误判的点。\n\n**③ `get_updates_buf` 内容（真正的 token）——稳定，靠\"激活\"刷新，不靠时间猜**\n- 这才是我们要的 token。它在 bot 凭证/会话有效期内**保持稳定**（`accountId` 段约 1 天轮换一次，期间不变属正常）。\n  - 判断是否需要刷新，**唯一依据是「实际推送是否被服务端拒绝（`ret:-2`）」**：\n    - 被拒＝当前 buf 暂时不可发送 → **让老板/用户在微信给 ClawBot 发一条消息激活**（host 随即刷新游标），再重跑 `send.js` 自动读最新 buf 重发即可。\n    - 只要不被拒，**激活一次即可在较长时间内反复推送**（实测跨十几小时仍能成功），不需要每次推送前都发消息激活。\n    - ⚠️ **不要**把 mtime 变化、或\"buf 值有没有变\"当成判断条件——这两者都不决定可发送性，纯属干扰。\n- `send.js` 收到 `-2` 会【清晰报错并退出】，不内置轮询等待（\"等待刷新\"退步逻辑已彻底删除）；由你手动激活后重跑命令即可。\n\n### send.js 的取值优先级\n```\n文本：ctx = --context 显式传入 ＞ 【空串】（默认，无需 cursor / 激活）\n媒体：ctx = --context 显式传入 ＞ 读最新 <ACCOUNT_ID>_im.bot.cursor.json 的 get_updates_buf（默认走这条）\n```\n（媒体的 `get_updates_buf` 为空、或任何推送被拒 `ret:-2`（含文本被拒＝id 变了）时：\n**先让老板/用户自己在微信给 ClawBot 发一条消息激活**（host 随即刷新游标），再重跑 `send.js`；\n仍失败再走 `--context <token>` 显式兜底。）\n\n## 🔴 关键坑（必看，否则必失败）\n1. **Bearer token 必须用完整 `botToken` 串**（含 `accountId:` 前缀），即\n   `<完整 botToken 串（含 accountId: 前缀），从你的 settings.json 读取>`。\n   只取冒号后的短串会返回 `errcode:-14 session timeout`，推送失败。\n2. **协议常量对齐官方 `@tencent-weixin/openclaw-weixin@2.4.6`**（不要再用旧值）：\n   - `channel_version = \"2.4.6\"`（早期实现误用 `cbc-1.0.0`，现已对齐官方）\n   - `iLink-App-ClientVersion = 132102`（= `buildClientVersion(\"2.4.6\")`）\n   - `iLink-App-Id = \"bot\"`，`bot_agent = \"OpenClaw\"`\n3. **文本默认空 `context_token` 即可**；**媒体推送必须带有效 `context_token`**（见上节），否则 `ret:-2` 拒收。文本若也被拒 `ret:-2`，大概率 bot id 轮换，需激活。\n\n## 发送契约（对齐官方 ilink bot 协议）\n- 端点：`POST {baseUrl}/ilink/bot/sendmessage`\n- 请求头（完整，缺一不可）：\n  - `Authorization: Bearer <完整botToken>`\n  - `AuthorizationType: ilink_bot_token`\n  - `X-WECHAT-UIN: <随机4字节uint32的base64>`\n  - `iLink-App-Id: bot`\n  - `iLink-App-ClientVersion: 132102`\n  - `Content-Type: application/json`\n- Body（文本）：\n```json\n{\n  \"msg\": {\n    \"from_user_id\": \"\",\n    \"to_user_id\": \"<boss的im.wechat id>\",\n    \"client_id\": \"<16位随机hex>\",\n    \"message_type\": 2,\n    \"message_state\": 2,\n    \"item_list\": [{ \"type\": 1, \"text_item\": { \"text\": \"消息内容\" } }],\n    \"context_token\": \"<从 cursor 读取的 get_updates_buf>\"\n  },\n  \"base_info\": { \"channel_version\": \"2.4.6\", \"bot_agent\": \"OpenClaw\" }\n}\n```\n- `item_list` 类型：`1=文本` / `2=图片` / `4=文件` / `5=视频`（text 超 4000 字自动分片）。\n- 成功判定：`sendmessage` 返回 `{}`（host 视 `ret` 缺失为成功）；`ret` 非零（如 `-2`）即失败。\n- 会话存活自检：`POST {baseUrl}/ilink/bot/getupdates` 返回无 `errcode` 即健康。\n\n## 富媒体流程（图片/文件/视频）\n0. **context_token 自动从 cursor 游标读取**（详见上方机制专节），无需手动准备。没有会 `ret:-2`。\n1. 生成 16 字节随机 AES 密钥 `aesKey`，`aesKeyHex = aesKey.toString('hex')`。\n2. `POST /ilink/bot/getuploadurl`，body：`filekey, media_type(1=IMAGE/2=VIDEO/3=FILE), to_user_id, rawsize, rawfilemd5, filesize(密文长), aeskey(aesKeyHex), no_need_thumb`。\n3. 取响应 `upload_full_url`（或旧版 `upload_param` 拼 `https://novac2c.cdn.weixin.qq.com/c2c/upload?encrypted_query_param=...&filekey=...`）。\n4. `POST` 密文（AES-128-ECB(PKCS7) 加密后的文件）到该 URL，`Content-Type: application/octet-stream`。\n5. 取响应头 `x-encrypted-param` 作为下载令牌 `encrypt_query_param`。\n6. 构造 item：`media = { encrypt_query_param, aes_key: base64(aesKeyHex), encrypt_type: 1 }`，\n   图片加 `mid_size`，文件加 `file_name`+`len`，视频加 `video_size`。\n7. `POST /ilink/bot/sendmessage`，`msg.context_token` = 有效 token。\n\n## 排错\n| 现象 | 原因 | 解决 |\n|------|------|------|\n| `errcode:-14 session timeout` | 用了短 token | 改用完整 `botToken` 串 |\n| `FAILED: API ret=-2` | 会话已失效 / 底层 bot id 已轮换。文本平时用空 token 可长期发送，一旦文本也 `-2` 大概率是 id 变了；媒体则是 cursor buf 失效 | **【必须】先到微信给 ClawBot 发一条任意消息**（激活 host 的发送游标），**激活后再重跑本命令**，`send.js` 自动读最新 buf 重发。⚠️ 未激活时反复直接重跑必定再次 `ret:-2`，请务必先完成激活动作；不要拿 mtime 或\"buf 值变没变\"当判断条件；`send.js` 收到 `-2` 会清晰报错并退出（不内置轮询）；仍失败再显式 `--context <token>` 兜底 |\n| 网络超时 / fetch 失败 | 默认沙箱拦截出网 | 加 `dangerouslyDisableSandbox: true` 或点允许 |\n| 通道找不到 | settings.json 路径/字段变了 | 按上文\"凭据从哪来\"手动核对路径 |\n| 走错通道 | 误用 MCP 的 weixin/wecom | 确认用 `weixinClawBot`（ClawBot），不是 MCP connector |\n| 富媒体上传失败 | `getuploadurl` 未返回 url / CDN 缺 `x-encrypted-param` | 检查 botToken 完整、网络可达 CDN |\n| 文本类文件（.txt/.md）中文乱码 | 源文件 UTF-8 无 BOM，微信/Windows 按 GBK 解码 | send.js 已自动为文本类文件补 UTF-8 BOM，无需手动处理 |\n| `文件不存在: ...` | 传入的媒体路径错误 | 检查 `--image/--file/--video` 指向的文件路径 |\n| `缺少 botToken` / `缺少 userId` | settings.json 的 weixinClawBot 配置不完整 | 按\"凭据从哪来\"补全字段 |\n\nFile v1.0.2:README.md\n\n# weixinclaw-proactive-push\n\n通过 WorkBuddy 已连接的 **ClawBot 微信 bot 通道**（`weixinClawBot` / ilink bot，**非微信客服号**）主动向老板微信推送 **文本 / 图片 / 文件 / 视频**。\n\n协议严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`（`src/api` + `src/messaging` + `src/cdn`）。\n\n> 本 skill 源码即本仓库：clone 后放入 `~/.workbuddy/skills/weixinclaw-proactive-push/` 即可使用。\n\n## 文件说明\n\n| 文件 | 作用 |\n|---|---|\n| `SKILL.md` | 完整使用文档（通道原理、token 获取、推送、排错） |\n| `send.js` | 推送主脚本：文本 / 图片 / 文件 / 视频 |\n\n## 核心机制（2026-07-09 定稿）\n\n| 推送类型 | `context_token` | 是否需要激活 |\n|----------|------------------|--------------|\n| **文本** | 默认**空串**，长期有效 | ❌ 不需要 |\n| **媒体**（图片 / 文件 / 视频）| **必须**带 → 读 `claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 的 `get_updates_buf`（原样，零变换） | 读不到 / 被拒才激活 |\n| **任意类型被拒 `ret:-2`** | — | ✅ 都要激活（文本被拒通常是底层 bot id 轮换，同样需激活） |\n\n- **文本免激活的原因**：空 `context_token` 对文本长期有效，因此闲置十几小时仍能推文字。\n- **媒体必须带 token**：图片 / 文件 / 视频接口强制要求非空 `context_token`，从宿主刷新的 cursor 游标文件读取。\n- **唯一需要激活的时刻 = 实际被拒（`ret:-2`）**：先到微信给 ClawBot 发一条任意消息激活，再重跑 `send.js` 自动读最新游标重发。\n\n### 协议常量（官方 `@tencent-weixin/openclaw-weixin@2.4.6`）\n\n- `Authorization: Bearer <完整 botToken，含 accountId: 前缀>`\n- 6 个请求头：`Content-Type`、`AuthorizationType: ilink_bot_token`、`X-WECHAT-UIN`、`Authorization`、`iLink-App-Id: bot`、`iLink-App-ClientVersion: 132102`\n- `base_info`：`{ channel_version: \"2.4.6\", bot_agent: \"OpenClaw\" }`\n- 发送接口：`POST {baseUrl}/ilink/bot/sendmessage`，`baseUrl = https://ilinkai.weixin.qq.com`\n\n### 🔴 隐私红线\n\n- `claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 内含 bot 凭证镜像，**禁止随仓库提交 / 分享**。\n- 本 skill 仅**只读**本机凭据（从 `settings.json` 与本地 cursor 文件读取），不向任何文件写入密钥。\n- 日志只打印 token 长度，绝不打印明文。\n\n## 快速开始\n\n```bash\n# 0. 依赖：Node 18+（推荐 WorkBuddy managed node 22）\n# 1. 确保 settings.json 已配置 weixinClawBot 通道（凭据自动读取，无需手填）\n\n# 2. 推送文本（context_token 默认空，免激活）\nnode send.js \"你好，老板 🦐\"\n\n# 3. 推送图片 / 文件 / 视频（自动读 cursor 游标当 context_token）\nnode send.js --image ./pic.png\nnode send.js --file  ./report.pdf\nnode send.js --video ./clip.mp4\n\n# 4. 显式覆盖 context_token（一般情况不需要）\nnode send.js \"文本\" --context \"<token>\"\n```\n\n详见 `SKILL.md`。\n\nFile v1.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn769gn5we5rgv7bfhb9ztd8j983p8qc\",\n  \"slug\": \"weixinclawbot\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1786084558621\n}\n\nFile v1.0.2:skill-card.md\n\n## Description:\n\nSends proactive text, image, file, and video messages through a WorkBuddy-connected ClawBot WeChat bot channel using local WorkBuddy credentials.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[noaheleven](https://clawhub.ai/user/noaheleven)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and WorkBuddy users use this skill to have an agent send intentional WeChat bot messages or media to a configured contact through the local ClawBot channel. It is intended for explicit push requests such as sending text, images, files, or videos.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill reads local WorkBuddy bot credentials and cursor data that can authorize outbound WeChat messages.\n\nMitigation: Install and run it only when that behavior is intended; keep WorkBuddy settings and cursor files local, and do not paste, share, or commit credential material.\n\nRisk: Outbound text, image, file, or video pushes may send unintended content to the configured contact.\n\nMitigation: Use explicit ClawBot-specific prompts and confirm the recipient, message content, and media paths before executing the send command.\n\nRisk: Disabling sandbox protections for network access increases exposure during message or media upload.\n\nMitigation: Keep sandbox protections enabled where possible; if network access must be allowed, use a controlled environment limited to the required WeChat and Tencent endpoints.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/noaheleven/skills/weixinclawbot)\n- [Artifact README](artifact/README.md)\n- [Artifact skill instructions](artifact/SKILL.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown guidance with inline shell commands and optional message content]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May result in outbound WeChat bot messages or media uploads when the local send script is executed.]\n\n## Skill Version(s):\n\n1.0.2 (source: server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.0.1: 4 files, 16004 bytes\n\nFiles: send.js (19853b), skill-card.md (2310b), SKILL.md (15631b), _meta.json (132b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: weixinclaw-proactive-push\ndescription: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。\n---\n\n> 📦 **本 skill 源码仓库**：https://github.com/NoahEleven/weixinclaw-proactive-push （公开，欢迎 clone / 提 Issue）\n>\n> 🔒 **隐私红线（务必遵守）**：本 skill 运行时**只读本机凭据、不写出任何密钥、日志不打印 token 明文**。\n> 分享 / 备份 / 提交时，**严禁**携带以下文件（含 bot 完整凭证 / 老板微信 id）：\n> - `~/.workbuddy/settings.json`（含完整 `botToken`、`userId`）\n> - `~/.workbuddy/claw-state/weixin/`（cursor 游标内含 bot 凭证镜像 `get_updates_buf`）\n> 本仓库**只含 `SKILL.md` + `send.js`**，接收方用自己的 `settings.json` 即可，无需你提供任何密钥。\n\n# 微信(ClawBot)主动推送（weixinClawBot / ilink bot）\n\n## 背景\nWorkBuddy 迁移自 OpenClaw。微信主动推送能力其实**一直活着**，藏在\n`~/.workbuddy/settings.json` 的 `claw/users/<uid>/channels/weixinClawBot` 里——\n它是 ClawBot 的微信 bot 通道（ilink bot，polling 模式），对接 `https://ilinkai.weixin.qq.com`。\n\n> ⚠️ **这不是微信客服号**：微信客服号走公众平台客服消息 API（48 小时会话限制），\n> 而本通道是 WorkBuddy / ClawBot 内置的 bot 通道，走 ilink bot API，可随时主动推送，不受客服号限制。\n\n协议实现**严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`**\n（npm 包，含 `src/api/api.ts`、`src/api/types.ts`、`src/messaging/*`、`src/cdn/*`）。\n关键常量、请求头、item 结构、AES 加密、错误码检查均与官方保持一致。\n\n> ⚠️ `openclaw-weixin-cli` 不需要装（那是 OpenClaw 的通道安装器，对 WorkBuddy 无用）。\n\n## 何时用\n- \"通过 ClawBot 主动推一条消息给老板\"（文本默认空 context_token，无需激活；详见下方机制专节）\n- \"微信主动推送测试\"\"给老板发条微信 bot 消息\"\n- \"发张图/发个文件/发段视频给老板\"（context_token 自动读取，详见机制专节）\n- 定时任务把结果主动推到老板微信（ClawBot bot 消息，非对话气泡）\n\n## 怎么跑\n脚本自动读 `settings.json` 取凭据与收件人，向老板微信发消息：\n\n```bash\nNODE=\"C:/Users/<USER>/.workbuddy/binaries/node/versions/22.22.2/node.exe\"   # 将 <USER> 换成你的 Windows 用户名\nSKILL=\"C:/Users/<USER>/.workbuddy/skills/weixinclaw-proactive-push/send.js\"  # ⚠️ 必须指到 send.js；只传目录会 MODULE_NOT_FOUND（无 package.json main）\n\n# 文本（默认空 context_token，无需激活；详见下方机制专节）\n\"$NODE\" \"$SKILL\" \"🦐 你的消息内容\"\n\n# 从文件读长文本\n\"$NODE\" \"$SKILL\" --text-file 内容.txt\n\n# 图片 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --image 截图.png --caption \"看这张图\"\n\n# 文件 + 文件名 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --file 报告.pdf --name \"周报.pdf\" --caption \"请查阅\"\n\n# 视频（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --video clip.mp4\n\n# 显式指定 token（极端兜底：手动传入一个已知有效的 context_token）\n\"$NODE\" \"$SKILL\" \"回复内容\" --context <context_token>\n```\n\n- 不传参数 → 发送默认测试文案（文本）。\n- 跑的时候若因沙箱拦截网络，加 `dangerouslyDisableSandbox: true`（或在弹窗点允许）。\n- 成功标志：终端打印 `[weixinclaw] OK`，老板微信里会收到一条 **ClawBot bot 消息**（不是对话气泡）。\n\n## 凭据从哪来（settings.json）\n```\nclaw/users/<uid>/channels/weixinClawBot = {\n  \"enabled\": true,\n  \"channelId\": \"<你的 bot channelId，从你的 settings.json 读取>\",\n  \"botToken\":  \"<完整 botToken 串，含 accountId: 前缀；脚本自动从你的 settings.json 读取，无需手填>\",  // 完整 token = Bearer 凭据\n  \"baseUrl\":   \"https://ilinkai.weixin.qq.com\",                                // apiBaseUrl\n  \"accountId\": \"<你的 bot accountId，从你的 settings.json 读取>\",\n  \"userId\":    \"<老板的 im.wechat id = to_user_id；脚本自动从你的 settings.json 读取>\",                       // 老板的 im.wechat id = to_user_id\n  \"connectionMode\": \"polling\"\n}\n```\n\n> 🔒 以上字段均为接收方**自己**的 `settings.json` 内容，无需分享者提供。脚本只读取、不写出。\n\n## 🔴 关键机制：context_token（2026-07-09 定稿）\n\n### 文本默认空 token；只有媒体才带 cursor buf\n- **文本推送**：`msg.context_token` 默认传【空串】即可发送，**无需读 cursor、无需激活**。\n  这就是为什么会话闲置十几小时（例如昨晚到今早）文本仍能正常推送——空 token 对文本长期有效。\n- **媒体推送（图片 / 文件 / 视频）**：**必须**带非空 `context_token`，\n  唯一来源是 cursor 游标里的 `get_updates_buf`（见下）。空 token 发媒体会 `ret:-2`。\n- **任何被拒（`ret:-2`）都要激活**：文本平时用空 token 就能发，一旦**文本也被拒**，\n  大概率是底层 bot id / 凭证已轮换，**同样需要**先给 ClawBot 发消息激活后重跑（详见排错表）。\n\n### 媒体的 context_token 来源：cursor 游标里的 `get_updates_buf`\n\n- host 实时把 ilink 接收会话游标写进\n  `~/.workbuddy/claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 的 `get_updates_buf` 字段。\n- 该字段值是 **base64 编码的 protobuf**；我们**把整段 base64 串原样**当作 `context_token` 用\n  （不是解码出来的 botToken 串，也不是里面的 accountId 段）。\n\n> ✅❌ **读取铁律（违反任何一条都会 ret:-2，这是\"编码读取方式\"的要害）**\n> 1. **以 UTF-8 文本**读 `cursor.json` → ② `JSON.parse` → ③ 取 `get_updates_buf` 字段的【字符串值】 →\n>    ④ **原样**作为 `context_token`。\n> 2. ❌ 严禁对这串做任何变换：**base64 解码、重新编码、trim、URL-decode、转义、换行、截断、大小写改写**。\n>    base64 串里全是 `A-Za-z0-9+/=` 字符，JSON 安全，**直接原样塞进 `context_token` 字段即可**。\n> 3. ❌ 不要\"聪明地\"解析 / 改写 / 重组这个串——它就是个不透明令牌，服务端的校验逻辑你是看不见的，任何本地变换都只会让它失效。\n> 4. ✅ 直接用本仓库的 `send.js`（已封装以上全部），**不要手工拼请求**——手工拼最容易在读取这步翻车。\n\n- **凭证稳定、不要误判**：`botToken` / `accountId` 段（形如 `<ACCOUNT_ID>`）约 **1 天**才轮换一次，期间**一直有效、不变是正常的**，它**不是**失效信号，别拿它判断 buf 是否过期。\n- **文本无需激活**：文本走空 token，会话闲置多久都能发（实测跨十几小时）；只有出现 `ret:-2` 时才需激活。\n- **媒体激活一次可长期使用**：媒体带 cursor buf，只要此前已激活过且没收到 `ret:-2`，就可持续推送，**不需要每次推送前都重新发消息**。\n- **文本被拒 = id 变了，也要激活**：文本平时空 token 能发；一旦文本 `ret:-2`，大概率底层 bot id 轮换，**同样**先发消息激活再重跑。\n- ⚠️ **未激活时反复直接重跑必定再次 `ret:-2`**——请务必先完成\"发消息激活\"这个动作，再重跑命令。\n- 实测：媒体用 buf 当 `context_token` + 完整 `botToken` 当 Bearer ⇒ `{}` 成功，且不读 context-token.json、无需轮询。\n- 编码细节：`get_updates_buf` 解码后为约 78 字节 protobuf，含 `botId`(varint) + 账号标识 +\n  botToken 明文段（`accountId@im.bot:secret`）。\n\n> 🔒 `get_updates_buf` 内嵌了 bot 凭证副本，**绝不要**把它粘贴到聊天、Issue、或随仓库提交。\n\n### `im.bot.cursor.json` 文件的更新机制（务必分清\"文件刷新\"和\"buf 轮换\"两件事）\n\n文件路径：`~/.workbuddy/claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json`\n（`<ACCOUNT_ID>` = bot accountId 段，如同一个 bot 换了凭证/会话，文件名的这段会变，会出现新的一份 cursor 文件）。\n\n**① 文件何时被创建**\n- 该文件由 host（WorkBuddy 后台的 ilink bot 长轮询）维护。**通道必须先建立过会话**才会有这个文件——\n  即老板/用户曾在微信给 ClawBot 发过消息、host 侧建立了接收游标。\n- 若目录里没有任何 `*_im.bot.cursor.json`：让老板/用户**先在微信给 ClawBot 发一条消息**，host 才会写出该文件。\n\n**② 文件 mtime（修改时间）——host 实时刷新，别拿它当判断依据**\n- host 在**每一轮长轮询写盘游标**时都会更新该文件的 mtime，非常频繁，且**与你是否发消息无关**（是 host 侧实时行为，不是你触发的）。\n- ⚠️ 因此 **绝不能用 mtime（\"多久没变 / 刚变过\"）来判断 buf 是否新鲜、是否需要刷新**——mtime 一直在变，但 `get_updates_buf` 的值**未必**跟着变。这是最容易误判的点。\n\n**③ `get_updates_buf` 内容（真正的 token）——稳定，靠\"激活\"刷新，不靠时间猜**\n- 这才是我们要的 token。它在 bot 凭证/会话有效期内**保持稳定**（`accountId` 段约 1 天轮换一次，期间不变属正常）。\n  - 判断是否需要刷新，**唯一依据是「实际推送是否被服务端拒绝（`ret:-2`）」**：\n    - 被拒＝当前 buf 暂时不可发送 → **让老板/用户在微信给 ClawBot 发一条消息激活**（host 随即刷新游标），再重跑 `send.js` 自动读最新 buf 重发即可。\n    - 只要不被拒，**激活一次即可在较长时间内反复推送**（实测跨十几小时仍能成功），不需要每次推送前都发消息激活。\n    - ⚠️ **不要**把 mtime 变化、或\"buf 值有没有变\"当成判断条件——这两者都不决定可发送性，纯属干扰。\n- `send.js` 收到 `-2` 会【清晰报错并退出】，不内置轮询等待（\"等待刷新\"退步逻辑已彻底删除）；由你手动激活后重跑命令即可。\n\n### send.js 的取值优先级\n```\n文本：ctx = --context 显式传入 ＞ 【空串】（默认，无需 cursor / 激活）\n媒体：ctx = --context 显式传入 ＞ 读最新 <ACCOUNT_ID>_im.bot.cursor.json 的 get_updates_buf（默认走这条）\n```\n（媒体的 `get_updates_buf` 为空、或任何推送被拒 `ret:-2`（含文本被拒＝id 变了）时：\n**先让老板/用户自己在微信给 ClawBot 发一条消息激活**（host 随即刷新游标），再重跑 `send.js`；\n仍失败再走 `--context <token>` 显式兜底。）\n\n## 🔴 关键坑（必看，否则必失败）\n1. **Bearer token 必须用完整 `botToken` 串**（含 `accountId:` 前缀），即\n   `<完整 botToken 串（含 accountId: 前缀），从你的 settings.json 读取>`。\n   只取冒号后的短串会返回 `errcode:-14 session timeout`，推送失败。\n2. **协议常量对齐官方 `@tencent-weixin/openclaw-weixin@2.4.6`**（不要再用旧值）：\n   - `channel_version = \"2.4.6\"`（早期实现误用 `cbc-1.0.0`，现已对齐官方）\n   - `iLink-App-ClientVersion = 132102`（= `buildClientVersion(\"2.4.6\")`）\n   - `iLink-App-Id = \"bot\"`，`bot_agent = \"OpenClaw\"`\n3. **文本默认空 `context_token` 即可**；**媒体推送必须带有效 `context_token`**（见上节），否则 `ret:-2` 拒收。文本若也被拒 `ret:-2`，大概率 bot id 轮换，需激活。\n\n## 发送契约（对齐官方 ilink bot 协议）\n- 端点：`POST {baseUrl}/ilink/bot/sendmessage`\n- 请求头（完整，缺一不可）：\n  - `Authorization: Bearer <完整botToken>`\n  - `AuthorizationType: ilink_bot_token`\n  - `X-WECHAT-UIN: <随机4字节uint32的base64>`\n  - `iLink-App-Id: bot`\n  - `iLink-App-ClientVersion: 132102`\n  - `Content-Type: application/json`\n- Body（文本）：\n```json\n{\n  \"msg\": {\n    \"from_user_id\": \"\",\n    \"to_user_id\": \"<boss的im.wechat id>\",\n    \"client_id\": \"<16位随机hex>\",\n    \"message_type\": 2,\n    \"message_state\": 2,\n    \"item_list\": [{ \"type\": 1, \"text_item\": { \"text\": \"消息内容\" } }],\n    \"context_token\": \"<从 cursor 读取的 get_updates_buf>\"\n  },\n  \"base_info\": { \"channel_version\": \"2.4.6\", \"bot_agent\": \"OpenClaw\" }\n}\n```\n- `item_list` 类型：`1=文本` / `2=图片` / `4=文件` / `5=视频`（text 超 4000 字自动分片）。\n- 成功判定：`sendmessage` 返回 `{}`（host 视 `ret` 缺失为成功）；`ret` 非零（如 `-2`）即失败。\n- 会话存活自检：`POST {baseUrl}/ilink/bot/getupdates` 返回无 `errcode` 即健康。\n\n## 富媒体流程（图片/文件/视频）\n0. **context_token 自动从 cursor 游标读取**（详见上方机制专节），无需手动准备。没有会 `ret:-2`。\n1. 生成 16 字节随机 AES 密钥 `aesKey`，`aesKeyHex = aesKey.toString('hex')`。\n2. `POST /ilink/bot/getuploadurl`，body：`filekey, media_type(1=IMAGE/2=VIDEO/3=FILE), to_user_id, rawsize, rawfilemd5, filesize(密文长), aeskey(aesKeyHex), no_need_thumb`。\n3. 取响应 `upload_full_url`（或旧版 `upload_param` 拼 `https://novac2c.cdn.weixin.qq.com/c2c/upload?encrypted_query_param=...&filekey=...`）。\n4. `POST` 密文（AES-128-ECB(PKCS7) 加密后的文件）到该 URL，`Content-Type: application/octet-stream`。\n5. 取响应头 `x-encrypted-param` 作为下载令牌 `encrypt_query_param`。\n6. 构造 item：`media = { encrypt_query_param, aes_key: base64(aesKeyHex), encrypt_type: 1 }`，\n   图片加 `mid_size`，文件加 `file_name`+`len`，视频加 `video_size`。\n7. `POST /ilink/bot/sendmessage`，`msg.context_token` = 有效 token。\n\n## 排错\n| 现象 | 原因 | 解决 |\n|------|------|------|\n| `errcode:-14 session timeout` | 用了短 token | 改用完整 `botToken` 串 |\n| `FAILED: API ret=-2` | 会话已失效 / 底层 bot id 已轮换。文本平时用空 token 可长期发送，一旦文本也 `-2` 大概率是 id 变了；媒体则是 cursor buf 失效 | **【必须】先到微信给 ClawBot 发一条任意消息**（激活 host 的发送游标），**激活后再重跑本命令**，`send.js` 自动读最新 buf 重发。⚠️ 未激活时反复直接重跑必定再次 `ret:-2`，请务必先完成激活动作；不要拿 mtime 或\"buf 值变没变\"当判断条件；`send.js` 收到 `-2` 会清晰报错并退出（不内置轮询）；仍失败再显式 `--context <token>` 兜底 |\n| 网络超时 / fetch 失败 | 默认沙箱拦截出网 | 加 `dangerouslyDisableSandbox: true` 或点允许 |\n| 通道找不到 | settings.json 路径/字段变了 | 按上文\"凭据从哪来\"手动核对路径 |\n| 走错通道 | 误用 MCP 的 weixin/wecom | 确认用 `weixinClawBot`（ClawBot），不是 MCP connector |\n| 富媒体上传失败 | `getuploadurl` 未返回 url / CDN 缺 `x-encrypted-param` | 检查 botToken 完整、网络可达 CDN |\n| 文本类文件（.txt/.md）中文乱码 | 源文件 UTF-8 无 BOM，微信/Windows 按 GBK 解码 | send.js 已自动为文本类文件补 UTF-8 BOM，无需手动处理 |\n| `文件不存在: ...` | 传入的媒体路径错误 | 检查 `--image/--file/--video` 指向的文件路径 |\n| `缺少 botToken` / `缺少 userId` | settings.json 的 weixinClawBot 配置不完整 | 按\"凭据从哪来\"补全字段 |\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn769gn5we5rgv7bfhb9ztd8j983p8qc\",\n  \"slug\": \"weixinclawbot\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1783646055953\n}\n\nFile v1.0.1:skill-card.md\n\n## Description: <br>\n通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道主动向指定微信收件人发送文本、图片、文件和视频。 <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[noaheleven](https://clawhub.ai/user/noaheleven) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and WorkBuddy operators use this skill when an agent needs to send explicit ClawBot WeChat notifications, status updates, or media attachments to a configured recipient using local WorkBuddy credentials. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill can send real WeChat messages and media outward using local ClawBot credentials. <br>\nMitigation: Install only for intentional outbound WeChat notification use, review the configured recipient before use, and require explicit confirmation before every send. <br>\nRisk: The skill reads local WorkBuddy bot credentials and cursor state that may contain sensitive tokens. <br>\nMitigation: Do not share settings.json or claw-state cursor files, keep token values out of logs and prompts, and use only the local credential files for the intended account. <br>\nRisk: Network sending may require relaxed sandboxing, increasing the impact of unintended execution. <br>\nMitigation: Avoid disabling sandbox protections except for a narrow, trusted run and only after verifying the recipient and message content. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/noaheleven/skills/weixinclawbot) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Shell commands, Configuration, Guidance] <br>\n**Output Format:** [Markdown guidance with shell command examples and command-line status output] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May trigger outbound WeChat text or media sends through local WorkBuddy ClawBot credentials.] <br>\n\n## Skill Version(s): <br>\n1.0.1 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>","readmeExcerpt":"Skill: Weixinclaw Proactive Push Owner: noaheleven Summary: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。 Tags: clawbot:1.0.3, latest:1.0.3, push:1.0.3, wechat:1.0.3, weixin:1.0.3 Version history: v1.0.3 | 2026-09-02T08:06:30.","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"NODE=\"C:/Users/<USER>/.workbuddy/binaries/node/versions/22.22.2/node.exe\"   # 将 <USER> 换成你的 Windows 用户名\nSKILL=\"C:/Users/<USER>/.workbuddy/skills/weixinclaw-proactive-push/send.js\"  # ⚠️ 必须指到 send.js；只传目录会 MODULE_NOT_FOUND（无 package.json main）\n\n# 文本（默认空 context_token，无需激活；详见下方机制专节）\n\"$NODE\" \"$SKILL\" \"🦐 你的消息内容\"\n\n# 从文件读长文本\n\"$NODE\" \"$SKILL\" --text-file 内容.txt\n\n# 图片 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --image 截图.png --caption \"看这张图\"\n\n# 文件 + 文件名 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --file 报告.pdf --name \"周报.pdf\" --caption \"请查阅\"\n\n# 视频（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --video clip.mp4\n\n# 显式指定 token（极端兜底：手动传入一个已知有效的 context_token）\n\"$NODE\" \"$SKILL\" \"回复内容\" --context <context_token>"},{"language":"text","snippet":"claw/users/<uid>/channels/weixinClawBot = {\n  \"enabled\": true,\n  \"channelId\": \"<你的 bot channelId，从你的 settings.json 读取>\",\n  \"botToken\":  \"<完整 botToken 串，含 accountId: 前缀；脚本自动从你的 settings.json 读取，无需手填>\",  // 完整 token = Bearer 凭据\n  \"baseUrl\":   \"https://ilinkai.weixin.qq.com\",                                // apiBaseUrl\n  \"accountId\": \"<你的 bot accountId，从你的 settings.json 读取>\",\n  \"userId\":    \"<老板的 im.wechat id = to_user_id；脚本自动从你的 settings.json 读取>\",                       // 老板的 im.wechat id = to_user_id\n  \"connectionMode\": \"polling\"\n}"},{"language":"text","snippet":"文本：ctx = --context 显式传入 ＞ 【空串】（默认，无需 cursor / 激活）\n媒体：ctx = --context 显式传入 ＞ 读最新 <ACCOUNT_ID>_im.bot.cursor.json 的 get_updates_buf（默认走这条）"},{"language":"json","snippet":"{\n  \"msg\": {\n    \"from_user_id\": \"\",\n    \"to_user_id\": \"<boss的im.wechat id>\",\n    \"client_id\": \"<16位随机hex>\",\n    \"message_type\": 2,\n    \"message_state\": 2,\n    \"item_list\": [{ \"type\": 1, \"text_item\": { \"text\": \"消息内容\" } }],\n    \"context_token\": \"<从 cursor 读取的 get_updates_buf>\"\n  },\n  \"base_info\": { \"channel_version\": \"2.4.6\", \"bot_agent\": \"OpenClaw\" }\n}"},{"language":"bash","snippet":"# 0. 依赖：Node 18+（推荐 WorkBuddy managed node 22）\n# 1. 确保 settings.json 已配置 weixinClawBot 通道（凭据自动读取，无需手填）\n\n# 2. 推送文本（context_token 默认空，免激活）\nnode send.js \"你好，老板 🦐\"\n\n# 3. 推送图片 / 文件 / 视频（自动读 cursor 游标当 context_token）\nnode send.js --image ./pic.png\nnode send.js --file  ./report.pdf\nnode send.js --video ./clip.mp4\n\n# 4. 显式覆盖 context_token（一般情况不需要）\nnode send.js \"文本\" --context \"<token>\""},{"language":"bash","snippet":"NODE=\"C:/Users/<USER>/.workbuddy/binaries/node/versions/22.22.2/node.exe\"   # 将 <USER> 换成你的 Windows 用户名\nSKILL=\"C:/Users/<USER>/.workbuddy/skills/weixinclaw-proactive-push/send.js\"  # ⚠️ 必须指到 send.js；只传目录会 MODULE_NOT_FOUND（无 package.json main）\n\n# 文本（默认空 context_token，无需激活；详见下方机制专节）\n\"$NODE\" \"$SKILL\" \"🦐 你的消息内容\"\n\n# 从文件读长文本\n\"$NODE\" \"$SKILL\" --text-file 内容.txt\n\n# 图片 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --image 截图.png --caption \"看这张图\"\n\n# 文件 + 文件名 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --file 报告.pdf --name \"周报.pdf\" --caption \"请查阅\"\n\n# 视频（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --video clip.mp4\n\n# 显式指定 token（极端兜底：手动传入一个已知有效的 context_token）\n\"$NODE\" \"$SKILL\" \"回复内容\" --context <context_token>"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: weixinclaw-proactive-push\ndescription: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。\n---\n\n> 📦 **本 skill 源码仓库**：https://github.com/NoahEleven/weixinclaw-proactive-push （公开，欢迎 clone / 提 Issue）\n>\n> 🔒 **隐私红线（务必遵守）**：本 skill 运行时**只读本机凭据、不写出任何密钥、日志不打印 token 明文**。\n> 分享 / 备份 / 提交时，**严禁**携带以下文件（含 bot 完整凭证 / 老板微信 id）：\n> - `~/.workbuddy/settings.json`（含完整 `botToken`、`userId`）\n> - `~/.workbuddy/claw-state/weixin/`（cursor 游标内含 bot 凭证镜像 `get_updates_buf`）\n> 本仓库**只含 `SKILL.md` + `send.js`**，接收方用自己的 `settings.json` 即可，无需你提供任何密钥。\n\n# 微信(ClawBot)主动推送（weixinClawBot / ilink bot）\n\n## 背景\nWorkBuddy 迁移自 OpenClaw。微信主动推送能力其实**一直活着**，藏在\n`~/.workbuddy/settings.json` 的 `claw/users/<uid>/channels/weixinClawBot` 里——\n它是 ClawBot 的微信 bot 通道（ilink bot，polling 模式），对接 `https://ilinkai.weixin.qq.com`。\n\n> ⚠️ **这不是微信客服号**：微信客服号走公众平台客服消息 API（48 小时会话限制），\n> 而本通道是 WorkBuddy / ClawBot 内置的 bot 通道，走 ilink bot API，可随时主动推送，不受客服号限制。\n\n协议实现**严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`**\n（npm 包，含 `src/api/api.ts`、`src/api/types.ts`、`src/messaging/*`、`src/cdn/*`）。\n关键常量、请求头、item 结构、AES 加密、错误码检查均与官方保持一致。\n\n> ⚠️ `openclaw-weixin-cli` 不需要装（那是 OpenClaw 的通道安装器，对 WorkBuddy 无用）。\n\n## 何时用\n- \"通过 ClawBot 主动推一条消息给老板\"（文本默认空 context_token，无需激活；详见下方机制专节）\n- \"微信主动推送测试\"\"给老板发条微信 bot 消息\"\n- \"发张图/发个文件/发段视频给老板\"（context_token 自动读取，详见机制专节）\n- 定时任务把结果主动推到老板微信（ClawBot bot 消息，非对话气泡）\n\n## 怎么跑\n脚本自动读 `settings.json` 取凭据与收件人，向老板微信发消息：\n\n```bash\nNODE=\"C:/Users/<USER>/.workbuddy/binaries/node/versions/22.22.2/node.exe\"   # 将 <USER> 换成你的 Windows 用户名\nSKILL=\"C:/Users/<USER>/.workbuddy/skills/weixinclaw-proactive-push/send.js\"  # ⚠️ 必须指到 send.js；只传目录会 MODULE_NOT_FOUND（无 package.json main）\n\n# 文本（默认空 context_token，无需激活；详见下方机制专节）\n\"$NODE\" \"$SKILL\" \"🦐 你的消息内容\"\n\n# 从文件读长文本\n\"$NODE\" \"$SKILL\" --text-file 内容.txt\n\n# 图片 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --image 截图.png --caption \"看这张图\"\n\n# 文件 + 文件名 + 可选说明（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --file 报告.pdf --name \"周报.pdf\" --caption \"请查阅\"\n\n# 视频（context_token 自动读取）\n\"$NODE\" \"$SKILL\" --video clip.mp4\n\n# 显式指定 token（极端兜底：手动传入一个已知有效的 context_token）\n\"$NODE\" \"$SKILL\" \"回复内容\" --context <context_token>\n```\n\n- 不传参数 → 发送默认测试文案（文本）。\n- 跑的时候若因沙箱拦截网络，加 `dangerouslyDisableSandbox: true`（或在弹窗点允许）。\n- 成功标志：终端打印 `[weixinclaw] OK`，老板微信里会收到一条 **ClawBot bot 消息**（不是对话气泡）。\n\n## 凭据从哪来（settings.json）\n```\nclaw/users/<uid>/channels/weixinClawBot = {\n  \"enabled\": true,\n  \"channelId\": \"<你的 bot channelId，从你的 settings.json 读取>\",\n  \"botToken\":  \"<完整 botToken 串，含 accountId: 前缀；脚本自动从你的 settings.json 读取，无需手填>\",  // 完整 token = Bearer 凭据\n  \"baseUrl\":   \"https://ilinkai.weixin.qq.com\",                                // apiBaseUrl\n  \"accountId\": \"<你的 bot accountId，从你的 settings.json 读取>\",\n  \"userId\":    \"<老板的 im.wechat id = to_user_id；脚本自动从你的 settings.json 读取>\",                       // 老板的 im.wechat id = to_user_id\n  \"connectionMode\""},{"path":"README.md","content":"# weixinclaw-proactive-push\n\n通过 WorkBuddy 已连接的 **ClawBot 微信 bot 通道**（`weixinClawBot` / ilink bot，**非微信客服号**）主动向老板微信推送 **文本 / 图片 / 文件 / 视频**。\n\n协议严格对齐腾讯官方插件 `@tencent-weixin/openclaw-weixin@2.4.6`（`src/api` + `src/messaging` + `src/cdn`）。\n\n> 本 skill 源码即本仓库：clone 后放入 `~/.workbuddy/skills/weixinclaw-proactive-push/` 即可使用。\n\n## 文件说明\n\n| 文件 | 作用 |\n|---|---|\n| `SKILL.md` | 完整使用文档（通道原理、token 获取、推送、排错） |\n| `send.js` | 推送主脚本：文本 / 图片 / 文件 / 视频 |\n\n## 核心机制（2026-07-09 定稿）\n\n| 推送类型 | `context_token` | 是否需要激活 |\n|----------|------------------|--------------|\n| **文本** | 默认**空串**，长期有效 | ❌ 不需要 |\n| **媒体**（图片 / 文件 / 视频）| **必须**带 → 读 `claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 的 `get_updates_buf`（原样，零变换） | 读不到 / 被拒才激活 |\n| **任意类型被拒 `ret:-2`** | — | ✅ 都要激活（文本被拒通常是底层 bot id 轮换，同样需激活） |\n\n- **文本免激活的原因**：空 `context_token` 对文本长期有效，因此闲置十几小时仍能推文字。\n- **媒体必须带 token**：图片 / 文件 / 视频接口强制要求非空 `context_token`，从宿主刷新的 cursor 游标文件读取。\n- **唯一需要激活的时刻 = 实际被拒（`ret:-2`）**：先到微信给 ClawBot 发一条任意消息激活，再重跑 `send.js` 自动读最新游标重发。\n\n### 协议常量（官方 `@tencent-weixin/openclaw-weixin@2.4.6`）\n\n- `Authorization: Bearer <完整 botToken，含 accountId: 前缀>`\n- 6 个请求头：`Content-Type`、`AuthorizationType: ilink_bot_token`、`X-WECHAT-UIN`、`Authorization`、`iLink-App-Id: bot`、`iLink-App-ClientVersion: 132102`\n- `base_info`：`{ channel_version: \"2.4.6\", bot_agent: \"OpenClaw\" }`\n- 发送接口：`POST {baseUrl}/ilink/bot/sendmessage`，`baseUrl = https://ilinkai.weixin.qq.com`\n\n### 🔴 隐私红线\n\n- `claw-state/weixin/<ACCOUNT_ID>_im.bot.cursor.json` 内含 bot 凭证镜像，**禁止随仓库提交 / 分享**。\n- 本 skill 仅**只读**本机凭据（从 `settings.json` 与本地 cursor 文件读取），不向任何文件写入密钥。\n- 日志只打印 token 长度，绝不打印明文。\n\n## 快速开始\n\n```bash\n# 0. 依赖：Node 18+（推荐 WorkBuddy managed node 22）\n# 1. 确保 settings.json 已配置 weixinClawBot 通道（凭据自动读取，无需手填）\n\n# 2. 推送文本（context_token 默认空，免激活）\nnode send.js \"你好，老板 🦐\"\n\n# 3. 推送图片 / 文件 / 视频（自动读 cursor 游标当 context_token）\nnode send.js --image ./pic.png\nnode send.js --file  ./report.pdf\nnode send.js --video ./clip.mp4\n\n# 4. 显式覆盖 context_token（一般情况不需要）\nnode send.js \"文本\" --context \"<token>\"\n```\n\n详见 `SKILL.md`。"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn769gn5we5rgv7bfhb9ztd8j983p8qc\",\n  \"slug\": \"weixinclawbot\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1788336390275\n}"},{"path":"skill-card.md","content":"## Description:\n\nSends proactive text, image, file, and video messages through a locally configured WorkBuddy ClawBot WeChat bot channel.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[noaheleven](https://clawhub.ai/user/noaheleven)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent operators use this skill when an agent needs to send proactive WeChat notifications or media to a configured recipient through the user's local WorkBuddy ClawBot account.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can send real WeChat messages and files through the user's local WorkBuddy ClawBot account.\n\nMitigation: Use it only for intentional outbound notifications to the configured recipient, and add an explicit confirmation step before routine or automated sends.\n\nRisk: Local bot tokens, cursor files, context tokens, message contents, and recipient IDs are sensitive.\n\nMitigation: Keep settings and cursor files local, avoid sharing them, and redact recipient identifiers and token-derived values from logs or transcripts.\n\nRisk: Credentials could be sent to an unexpected endpoint if local configuration is altered.\n\nMitigation: Verify that ~/.workbuddy/settings.json uses the official Weixin iLink base URL before running the skill.\n\nRisk: Broad sandbox bypasses increase the chance of unintended network access.\n\nMitigation: Avoid disabling sandboxing broadly; grant only the network access needed for the intended WeChat send workflow.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/noaheleven/skills/weixinclawbot)\n- [Publisher profile](https://clawhub.ai/user/noaheleven)\n- [Weixin iLink endpoint](https://ilinkai.weixin.qq.com)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Plain text or Markdown guidance with shell commands; runtime sends WeChat bot text or media messages]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can send text, images, files, or videos using local WorkBuddy ClawBot credentials.]\n\n## Skill Version(s):\n\n1.0.3 (source: ClawHub release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。 Skill: Weixinclaw Proactive Push Owner: noaheleven Summary: 通过 WorkBuddy 已连接的 ClawBot 微信 bot 通道（weixinClawBot / ilink bot，非微信客服号）主动向老板微信推送文本/图片/文件/视频。当用户要求\"通过 ClawBot 主动推送/给老板发微信/微信主动推送测试/微信独立消息/发图片给老板/发文件给老板\"时使用。协议严格对齐腾讯官方插件 @tencent-weixin/openclaw-weixin@2.4.6（src/api + src/messaging + src/cdn）。 Tags: clawbot:1.0.3, latest:1.0.3, push:1.0.3, wechat:1.0.3, weixin:1.0.3 Version history: v1.0.3 | 2026-09-02T08:06:30.","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":883,"uniquenessScore":52,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-12T00:50:21.454Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-12T00:50:21.454Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-12T12:06:31.801Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"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!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"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","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}