@wecom/wecom-openclaw-plugin 2026.4.2-beta.0 → 2026.4.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +395 -10
- package/dist/index.d.ts +2 -4
- package/dist/index.js +58 -0
- package/dist/src/accounts.d.ts +57 -0
- package/dist/src/accounts.js +222 -0
- package/dist/src/agent/api-client.d.ts +94 -0
- package/dist/src/agent/api-client.js +292 -0
- package/dist/src/agent/handler.d.ts +63 -0
- package/dist/src/agent/handler.js +551 -0
- package/dist/src/agent/index.d.ts +5 -0
- package/dist/src/agent/index.js +5 -0
- package/dist/src/agent/webhook.d.ts +24 -0
- package/dist/src/agent/webhook.js +228 -0
- package/dist/src/agent/xml.d.ts +21 -0
- package/dist/src/agent/xml.js +41 -0
- package/dist/src/channel.js +579 -0
- package/dist/src/chat-queue.d.ts +31 -0
- package/dist/src/chat-queue.js +45 -0
- package/dist/{esm/types/src → src}/const.d.ts +46 -0
- package/dist/{esm/src → src}/const.js +77 -30
- package/dist/{esm/src → src}/dm-policy.js +6 -9
- package/dist/src/dynamic-agent.d.ts +37 -0
- package/dist/src/dynamic-agent.js +60 -0
- package/dist/src/dynamic-routing.d.ts +65 -0
- package/dist/src/dynamic-routing.js +58 -0
- package/dist/{esm/src → src}/group-policy.js +8 -22
- package/dist/src/http.d.ts +26 -0
- package/dist/src/http.js +93 -0
- package/dist/{esm/types/src → src}/interface.d.ts +0 -2
- package/dist/src/interface.js +4 -0
- package/dist/src/mcp/index.js +6 -0
- package/dist/{esm/src → src}/mcp/interceptors/biz-error.js +2 -6
- package/dist/{esm/src → src}/mcp/interceptors/index.js +6 -10
- package/dist/{esm/src → src}/mcp/interceptors/msg-media.js +6 -10
- package/dist/{esm/src → src}/mcp/interceptors/smartpage-create.js +2 -6
- package/dist/{esm/src → src}/mcp/interceptors/smartpage-export.js +2 -6
- package/dist/src/mcp/interceptors/types.js +7 -0
- package/dist/{esm/src → src}/mcp/schema.js +1 -4
- package/dist/{esm/src → src}/mcp/tool.js +4 -8
- package/dist/{esm/src → src}/mcp/transport.js +15 -16
- package/dist/{esm/src → src}/media-handler.js +6 -10
- package/dist/{esm/src → src}/media-uploader.js +64 -10
- package/dist/{esm/src → src}/message-parser.js +1 -4
- package/dist/{esm/types/src → src}/message-sender.d.ts +18 -0
- package/dist/{esm/src → src}/message-sender.js +45 -11
- package/dist/{esm/src → src}/monitor.js +145 -292
- package/dist/{esm/src → src}/onboarding.js +22 -26
- package/dist/{esm/types/src → src}/openclaw-compat.d.ts +49 -0
- package/dist/{esm/src → src}/openclaw-compat.js +133 -27
- package/dist/{esm/src → src}/reqid-store.js +4 -7
- package/dist/{esm/src → src}/runtime.js +2 -5
- package/dist/src/shared/command-auth.d.ts +23 -0
- package/dist/src/shared/command-auth.js +73 -0
- package/dist/src/shared/xml-parser.d.ts +46 -0
- package/dist/src/shared/xml-parser.js +210 -0
- package/dist/{esm/src → src}/state-dir-resolve.js +3 -7
- package/dist/{esm/src → src}/state-manager.js +84 -16
- package/dist/src/target.d.ts +35 -0
- package/dist/src/target.js +67 -0
- package/dist/src/template-card-manager.d.ts +55 -0
- package/dist/src/template-card-manager.js +205 -0
- package/dist/{esm/src → src}/template-card-parser.js +17 -8
- package/dist/{esm/src → src}/timeout.js +2 -5
- package/dist/src/types/account.d.ts +29 -0
- package/dist/src/types/account.js +4 -0
- package/dist/src/types/config.d.ts +91 -0
- package/dist/src/types/config.js +7 -0
- package/dist/src/types/constants.d.ts +42 -0
- package/dist/src/types/constants.js +42 -0
- package/dist/src/types/index.d.ts +7 -0
- package/dist/src/types/index.js +5 -0
- package/dist/src/types/message.d.ts +238 -0
- package/dist/src/types/message.js +5 -0
- package/dist/{esm/types/src → src}/utils.d.ts +41 -0
- package/dist/{esm/src → src}/utils.js +24 -10
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +24 -0
- package/dist/src/webhook/command-auth.d.ts +47 -0
- package/dist/src/webhook/command-auth.js +96 -0
- package/dist/src/webhook/gateway.d.ts +36 -0
- package/dist/src/webhook/gateway.js +235 -0
- package/dist/src/webhook/handler.d.ts +18 -0
- package/dist/src/webhook/handler.js +420 -0
- package/dist/src/webhook/helpers.d.ts +156 -0
- package/dist/src/webhook/helpers.js +833 -0
- package/dist/src/webhook/http.d.ts +26 -0
- package/dist/src/webhook/http.js +94 -0
- package/dist/src/webhook/index.d.ts +11 -0
- package/dist/src/webhook/index.js +14 -0
- package/dist/src/webhook/media.d.ts +29 -0
- package/dist/src/webhook/media.js +88 -0
- package/dist/src/webhook/monitor.d.ts +59 -0
- package/dist/src/webhook/monitor.js +1161 -0
- package/dist/src/webhook/state.d.ts +220 -0
- package/dist/src/webhook/state.js +491 -0
- package/dist/src/webhook/target.d.ts +41 -0
- package/dist/src/webhook/target.js +132 -0
- package/dist/src/webhook/types.d.ts +347 -0
- package/dist/src/webhook/types.js +33 -0
- package/dist/src/webhook/video-frame.d.ts +13 -0
- package/dist/src/webhook/video-frame.js +30 -0
- package/package.json +15 -7
- package/dist/cjs/index.js +0 -45
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/src/channel.js +0 -339
- package/dist/cjs/src/channel.js.map +0 -1
- package/dist/cjs/src/const.js +0 -137
- package/dist/cjs/src/const.js.map +0 -1
- package/dist/cjs/src/dm-policy.js +0 -89
- package/dist/cjs/src/dm-policy.js.map +0 -1
- package/dist/cjs/src/group-policy.js +0 -133
- package/dist/cjs/src/group-policy.js.map +0 -1
- package/dist/cjs/src/mcp/interceptors/biz-error.js +0 -70
- package/dist/cjs/src/mcp/interceptors/biz-error.js.map +0 -1
- package/dist/cjs/src/mcp/interceptors/index.js +0 -73
- package/dist/cjs/src/mcp/interceptors/index.js.map +0 -1
- package/dist/cjs/src/mcp/interceptors/msg-media.js +0 -159
- package/dist/cjs/src/mcp/interceptors/msg-media.js.map +0 -1
- package/dist/cjs/src/mcp/interceptors/smartpage-create.js +0 -157
- package/dist/cjs/src/mcp/interceptors/smartpage-create.js.map +0 -1
- package/dist/cjs/src/mcp/interceptors/smartpage-export.js +0 -93
- package/dist/cjs/src/mcp/interceptors/smartpage-export.js.map +0 -1
- package/dist/cjs/src/mcp/schema.js +0 -104
- package/dist/cjs/src/mcp/schema.js.map +0 -1
- package/dist/cjs/src/mcp/tool.js +0 -208
- package/dist/cjs/src/mcp/tool.js.map +0 -1
- package/dist/cjs/src/mcp/transport.js +0 -417
- package/dist/cjs/src/mcp/transport.js.map +0 -1
- package/dist/cjs/src/media-handler.js +0 -129
- package/dist/cjs/src/media-handler.js.map +0 -1
- package/dist/cjs/src/media-uploader.js +0 -284
- package/dist/cjs/src/media-uploader.js.map +0 -1
- package/dist/cjs/src/message-parser.js +0 -134
- package/dist/cjs/src/message-parser.js.map +0 -1
- package/dist/cjs/src/message-sender.js +0 -89
- package/dist/cjs/src/message-sender.js.map +0 -1
- package/dist/cjs/src/monitor.js +0 -991
- package/dist/cjs/src/monitor.js.map +0 -1
- package/dist/cjs/src/onboarding.js +0 -182
- package/dist/cjs/src/onboarding.js.map +0 -1
- package/dist/cjs/src/openclaw-compat.js +0 -400
- package/dist/cjs/src/openclaw-compat.js.map +0 -1
- package/dist/cjs/src/reqid-store.js +0 -88
- package/dist/cjs/src/reqid-store.js.map +0 -1
- package/dist/cjs/src/runtime.js +0 -16
- package/dist/cjs/src/runtime.js.map +0 -1
- package/dist/cjs/src/state-dir-resolve.js +0 -35
- package/dist/cjs/src/state-dir-resolve.js.map +0 -1
- package/dist/cjs/src/state-manager.js +0 -158
- package/dist/cjs/src/state-manager.js.map +0 -1
- package/dist/cjs/src/template-card-parser.js +0 -641
- package/dist/cjs/src/template-card-parser.js.map +0 -1
- package/dist/cjs/src/timeout.js +0 -42
- package/dist/cjs/src/timeout.js.map +0 -1
- package/dist/cjs/src/utils.js +0 -60
- package/dist/cjs/src/utils.js.map +0 -1
- package/dist/cjs/src/version.js +0 -26
- package/dist/cjs/src/version.js.map +0 -1
- package/dist/esm/index.js +0 -41
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/src/channel.js +0 -337
- package/dist/esm/src/channel.js.map +0 -1
- package/dist/esm/src/const.js.map +0 -1
- package/dist/esm/src/dm-policy.js.map +0 -1
- package/dist/esm/src/group-policy.js.map +0 -1
- package/dist/esm/src/mcp/interceptors/biz-error.js.map +0 -1
- package/dist/esm/src/mcp/interceptors/index.js.map +0 -1
- package/dist/esm/src/mcp/interceptors/msg-media.js.map +0 -1
- package/dist/esm/src/mcp/interceptors/smartpage-create.js.map +0 -1
- package/dist/esm/src/mcp/interceptors/smartpage-export.js.map +0 -1
- package/dist/esm/src/mcp/schema.js.map +0 -1
- package/dist/esm/src/mcp/tool.js.map +0 -1
- package/dist/esm/src/mcp/transport.js.map +0 -1
- package/dist/esm/src/media-handler.js.map +0 -1
- package/dist/esm/src/media-uploader.js.map +0 -1
- package/dist/esm/src/message-parser.js.map +0 -1
- package/dist/esm/src/message-sender.js.map +0 -1
- package/dist/esm/src/monitor.js.map +0 -1
- package/dist/esm/src/onboarding.js.map +0 -1
- package/dist/esm/src/openclaw-compat.js.map +0 -1
- package/dist/esm/src/reqid-store.js.map +0 -1
- package/dist/esm/src/runtime.js.map +0 -1
- package/dist/esm/src/state-dir-resolve.js.map +0 -1
- package/dist/esm/src/state-manager.js.map +0 -1
- package/dist/esm/src/template-card-parser.js.map +0 -1
- package/dist/esm/src/timeout.js.map +0 -1
- package/dist/esm/src/utils.js.map +0 -1
- package/dist/esm/src/version.js +0 -23
- package/dist/esm/src/version.js.map +0 -1
- package/dist/esm/types/index.d.ts +0 -9
- package/dist/esm/types/src/version.d.ts +0 -2
- /package/dist/{esm/types/src → src}/channel.d.ts +0 -0
- /package/dist/{esm/types/src → src}/dm-policy.d.ts +0 -0
- /package/dist/{esm/types/src → src}/group-policy.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/index.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/interceptors/biz-error.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/interceptors/index.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/interceptors/msg-media.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/interceptors/smartpage-create.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/interceptors/smartpage-export.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/interceptors/types.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/schema.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/tool.d.ts +0 -0
- /package/dist/{esm/types/src → src}/mcp/transport.d.ts +0 -0
- /package/dist/{esm/types/src → src}/media-handler.d.ts +0 -0
- /package/dist/{esm/types/src → src}/media-uploader.d.ts +0 -0
- /package/dist/{esm/types/src → src}/message-parser.d.ts +0 -0
- /package/dist/{esm/types/src → src}/monitor.d.ts +0 -0
- /package/dist/{esm/types/src → src}/onboarding.d.ts +0 -0
- /package/dist/{esm/types/src → src}/reqid-store.d.ts +0 -0
- /package/dist/{esm/types/src → src}/runtime.d.ts +0 -0
- /package/dist/{esm/types/src → src}/state-dir-resolve.d.ts +0 -0
- /package/dist/{esm/types/src → src}/state-manager.d.ts +0 -0
- /package/dist/{esm/types/src → src}/template-card-parser.d.ts +0 -0
- /package/dist/{esm/types/src → src}/timeout.d.ts +0 -0
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
**WeCom channel plugin for [OpenClaw](https://github.com/openclaw)** — by the Tencent WeCom team.
|
|
21
21
|
|
|
22
|
-
> A
|
|
22
|
+
> A channel plugin powered by WeCom. Supports **Bot mode** (WebSocket long-polling or HTTP webhook with JSON callbacks) and **Agent mode** (HTTP webhook with XML encrypted callbacks). Direct messages, group chats, streaming replies, and proactive messaging.
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
@@ -28,14 +28,27 @@
|
|
|
28
28
|
|
|
29
29
|
## ✨ Features
|
|
30
30
|
|
|
31
|
-
- 🔗 WebSocket
|
|
31
|
+
- 🔗 **Dual-mode**: Bot (WebSocket / Webhook) and Agent (HTTP webhook) can run independently or together
|
|
32
32
|
- 💬 Supports both direct messages (DM) and group chat
|
|
33
|
-
- 📤 Proactive messaging to specific users or
|
|
34
|
-
- 🖼️ Receives and processes image
|
|
35
|
-
-
|
|
33
|
+
- 📤 Proactive messaging to specific users, groups, departments, or tags
|
|
34
|
+
- 🖼️ Receives and processes image, voice, video, file, and **mixed (图文混排)** messages with automatic downloading
|
|
35
|
+
- 🗣️ Voice-to-text: automatically extracts transcribed text from voice messages
|
|
36
|
+
- 💬 Quote message support: processes quoted text, image, voice, and file messages
|
|
37
|
+
- ⏳ Streaming replies with "thinking" placeholder messages (Bot mode)
|
|
38
|
+
- 🔐 Agent mode: AES-256-CBC encrypted XML callbacks with SHA1 signature verification
|
|
36
39
|
- 📝 Markdown formatting support for replies
|
|
40
|
+
- 🃏 Template card messages (text_notice, news_notice, button_interaction, vote_interaction, multiple_interaction) with **event callback handling**
|
|
37
41
|
- 🔒 Built-in access control: DM Policy (pairing / open / allowlist / disabled) and Group Policy (open / allowlist / disabled)
|
|
38
|
-
-
|
|
42
|
+
- 🔑 Command authorization: per-account command permission control with access group support
|
|
43
|
+
- 👥 Multi-account support: run multiple WeCom accounts with independent bot/agent configs
|
|
44
|
+
- 🧩 MCP tool integration (`wecom_mcp`) with interceptor pipeline (biz-error, media, smartpage-create, smartpage-export)
|
|
45
|
+
- 🎯 **15 built-in Skills**: contact lookup, doc management, todo, meeting, schedule, messaging, smartsheet, template cards, and more
|
|
46
|
+
- 🔀 Dynamic Agent routing: auto-create isolated agents per user/group
|
|
47
|
+
- 📁 Local file sending with configurable media path allowlist (`mediaLocalRoots`)
|
|
48
|
+
- 📊 Smart media size limits with auto-downgrade (image 10MB → file, video 10MB → file, voice 2MB/AMR-only → file, max 20MB)
|
|
49
|
+
- 🔄 **Bot-first, Agent-fallback** outbound delivery: auto fallback to Agent HTTP API when Bot WS is unavailable
|
|
50
|
+
- ⚡ Auto heartbeat keep-alive and reconnection (up to 10 reconnect attempts, 5 auth failure retries)
|
|
51
|
+
- 🛡️ Anti-kick protection: suppresses auto-restart on server-side disconnection to prevent mutual kicking loops
|
|
39
52
|
- 🧙 Interactive CLI setup wizard
|
|
40
53
|
|
|
41
54
|
---
|
|
@@ -44,7 +57,7 @@
|
|
|
44
57
|
|
|
45
58
|
### Requirements
|
|
46
59
|
|
|
47
|
-
- OpenClaw `>= 2026.
|
|
60
|
+
- OpenClaw `>= 2026.3.28`
|
|
48
61
|
|
|
49
62
|
### Quick Install
|
|
50
63
|
|
|
@@ -89,19 +102,285 @@ openclaw config set channels.wecom.enabled true
|
|
|
89
102
|
openclaw gateway restart
|
|
90
103
|
```
|
|
91
104
|
|
|
92
|
-
###
|
|
105
|
+
### Mode Overview
|
|
106
|
+
|
|
107
|
+
The plugin supports two connection modes that can be used independently or together:
|
|
108
|
+
|
|
109
|
+
| Mode | Connection | Message Format | Use Case |
|
|
110
|
+
|------|-----------|---------------|----------|
|
|
111
|
+
| **Bot** (智能体) | WebSocket (default) or HTTP webhook | JSON | Quick setup, streaming replies |
|
|
112
|
+
| **Agent** (自建应用) | HTTP webhook callbacks | XML | Enterprise apps, API-driven messaging |
|
|
113
|
+
|
|
114
|
+
> **Note**: Bot mode supports two connection methods via `connectionMode`:
|
|
115
|
+
> - `websocket` (default) — WebSocket long-polling, requires `botId` + `secret`
|
|
116
|
+
> - `webhook` — HTTP callback, requires `token` + `encodingAESKey`
|
|
117
|
+
|
|
118
|
+
### Bot Mode Configuration
|
|
119
|
+
|
|
120
|
+
#### Core Settings
|
|
121
|
+
|
|
122
|
+
| Config Path | Description | Options | Default |
|
|
123
|
+
|---|---|---|---|
|
|
124
|
+
| `channels.wecom.enabled` | Enable the channel | `true` / `false` | `false` |
|
|
125
|
+
| `channels.wecom.connectionMode` | Bot connection mode | `websocket` / `webhook` | `websocket` |
|
|
126
|
+
| `channels.wecom.name` | Account display name | — | `企业微信` |
|
|
127
|
+
|
|
128
|
+
#### WebSocket Mode (default)
|
|
93
129
|
|
|
94
130
|
| Config Path | Description | Options | Default |
|
|
95
131
|
|---|---|---|---|
|
|
96
132
|
| `channels.wecom.botId` | WeCom bot ID | — | — |
|
|
97
133
|
| `channels.wecom.secret` | WeCom bot secret | — | — |
|
|
98
|
-
| `channels.wecom.enabled` | Enable the channel | `true` / `false` | `false` |
|
|
99
134
|
| `channels.wecom.websocketUrl` | WebSocket endpoint | — | `wss://openws.work.weixin.qq.com` |
|
|
135
|
+
| `channels.wecom.sendThinkingMessage` | Send "thinking" placeholder | `true` / `false` | `true` |
|
|
136
|
+
|
|
137
|
+
#### Webhook Mode (`connectionMode: "webhook"`)
|
|
138
|
+
|
|
139
|
+
| Config Path | Description | Options | Default |
|
|
140
|
+
|---|---|---|---|
|
|
141
|
+
| `channels.wecom.token` | Webhook verification token | — | — |
|
|
142
|
+
| `channels.wecom.encodingAESKey` | AES encryption key (43 chars Base64) | — | — |
|
|
143
|
+
| `channels.wecom.receiveId` | Receiver ID (for decryption verification) | — | — |
|
|
144
|
+
| `channels.wecom.welcomeText` | Welcome message on enter_chat event | — | — |
|
|
145
|
+
| `channels.wecom.streamPlaceholderContent` | Stream placeholder content | — | — |
|
|
146
|
+
|
|
147
|
+
#### Access Control
|
|
148
|
+
|
|
149
|
+
| Config Path | Description | Options | Default |
|
|
150
|
+
|---|---|---|---|
|
|
100
151
|
| `channels.wecom.dmPolicy` | DM access policy | `pairing` / `open` / `allowlist` / `disabled` | `open` |
|
|
101
152
|
| `channels.wecom.allowFrom` | DM allowlist (user IDs) | — | `[]` |
|
|
102
153
|
| `channels.wecom.groupPolicy` | Group chat access policy | `open` / `allowlist` / `disabled` | `open` |
|
|
103
154
|
| `channels.wecom.groupAllowFrom` | Group allowlist (group IDs) | — | `[]` |
|
|
104
|
-
| `channels.wecom.
|
|
155
|
+
| `channels.wecom.groups` | Per-group config (e.g. sender allowlist) | — | `{}` |
|
|
156
|
+
|
|
157
|
+
#### Media Settings
|
|
158
|
+
|
|
159
|
+
| Config Path | Description | Default |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `channels.wecom.mediaLocalRoots` | Extra local paths allowed for media sending (supports `~`) | `[]` |
|
|
162
|
+
| `channels.wecom.media.maxBytes` | Max media file size in bytes | `20971520` (20MB) |
|
|
163
|
+
| `channels.wecom.media.tempDir` | Temp directory for media processing | — |
|
|
164
|
+
| `channels.wecom.media.retentionHours` | Media file retention hours | — |
|
|
165
|
+
| `channels.wecom.media.cleanupOnStart` | Clean temp media on startup | — |
|
|
166
|
+
|
|
167
|
+
**Media Size Limits & Auto-Downgrade:**
|
|
168
|
+
|
|
169
|
+
| Media Type | Max Size | Downgrade Behavior |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| Image | 10 MB | Exceeds → sent as file |
|
|
172
|
+
| Video | 10 MB | Exceeds → sent as file |
|
|
173
|
+
| Voice | 2 MB (AMR only) | Non-AMR format or exceeds → sent as file |
|
|
174
|
+
| File | 20 MB | Exceeds → rejected (cannot send) |
|
|
175
|
+
|
|
176
|
+
#### Network Settings
|
|
177
|
+
|
|
178
|
+
| Config Path | Description | Default |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| `channels.wecom.network.timeoutMs` | HTTP request timeout (ms) | — |
|
|
181
|
+
| `channels.wecom.network.retries` | Number of retries | — |
|
|
182
|
+
| `channels.wecom.network.retryDelayMs` | Delay between retries (ms) | — |
|
|
183
|
+
| `channels.wecom.network.egressProxyUrl` | Egress proxy URL for trusted IP scenarios | — |
|
|
184
|
+
|
|
185
|
+
> **Egress Proxy Priority**: `channels.wecom.network.egressProxyUrl` > `OPENCLAW_WECOM_EGRESS_PROXY_URL` > `WECOM_EGRESS_PROXY_URL` > `HTTPS_PROXY` > `ALL_PROXY` > `HTTP_PROXY`
|
|
186
|
+
|
|
187
|
+
### Agent Mode Configuration
|
|
188
|
+
|
|
189
|
+
Agent mode uses HTTP webhook callbacks with XML encrypted messages. You need to configure the callback URL in the WeCom admin console under "API Receive" settings.
|
|
190
|
+
|
|
191
|
+
#### Prerequisites
|
|
192
|
+
|
|
193
|
+
1. Create a self-built app in [WeCom Admin Console](https://work.weixin.qq.com/wework_admin/frame#apps)
|
|
194
|
+
2. Note down the **CorpID**, **CorpSecret** (from app settings), and **AgentId**
|
|
195
|
+
3. In the app settings, go to "API Receive" (API接收):
|
|
196
|
+
- Note down the **Token** and **EncodingAESKey** (auto-generated or custom)
|
|
197
|
+
- **Do NOT click save yet** — WeCom will verify the callback URL immediately when you save
|
|
198
|
+
|
|
199
|
+
#### Setup Steps
|
|
200
|
+
|
|
201
|
+
> **Important**: You must configure the Gateway **before** saving the callback URL in WeCom admin console. WeCom sends a verification request (GET with `echostr`) immediately when you save, and the Gateway needs the `token` and `encodingAESKey` to decrypt and respond correctly.
|
|
202
|
+
|
|
203
|
+
**Step 1: Configure Gateway**
|
|
204
|
+
|
|
205
|
+
```shell
|
|
206
|
+
openclaw config set channels.wecom.agent.corpId <YOUR_CORP_ID>
|
|
207
|
+
openclaw config set channels.wecom.agent.corpSecret <YOUR_CORP_SECRET>
|
|
208
|
+
openclaw config set channels.wecom.agent.agentId <YOUR_AGENT_ID>
|
|
209
|
+
openclaw config set channels.wecom.agent.token <YOUR_CALLBACK_TOKEN>
|
|
210
|
+
openclaw config set channels.wecom.agent.encodingAESKey <YOUR_ENCODING_AES_KEY>
|
|
211
|
+
openclaw config set channels.wecom.enabled true
|
|
212
|
+
openclaw gateway restart
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Step 2: Save callback URL in WeCom admin console**
|
|
216
|
+
|
|
217
|
+
Go back to the "API Receive" settings and enter the callback URL:
|
|
218
|
+
- **URL**: `https://<your-gateway-host>/plugins/wecom/agent/<accountId>` (e.g. `/plugins/wecom/agent/default`); single-account mode can also use `/plugins/wecom/agent`
|
|
219
|
+
|
|
220
|
+
Now click save — the verification should pass.
|
|
221
|
+
|
|
222
|
+
#### JSON Configuration
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"channels": {
|
|
227
|
+
"wecom": {
|
|
228
|
+
"enabled": true,
|
|
229
|
+
"agent": {
|
|
230
|
+
"corpId": "ww1234567890abcdef",
|
|
231
|
+
"corpSecret": "your-corp-secret",
|
|
232
|
+
"agentId": 1000002,
|
|
233
|
+
"token": "your-callback-token",
|
|
234
|
+
"encodingAESKey": "your-encoding-aes-key-43-chars"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
#### Agent Config Reference
|
|
242
|
+
|
|
243
|
+
| Config Path | Description | Required |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| `channels.wecom.agent.corpId` | Enterprise Corp ID | Yes |
|
|
246
|
+
| `channels.wecom.agent.corpSecret` | App secret | Yes |
|
|
247
|
+
| `channels.wecom.agent.agentId` | App agent ID | No (needed for proactive messaging) |
|
|
248
|
+
| `channels.wecom.agent.token` | Callback verification token | Yes |
|
|
249
|
+
| `channels.wecom.agent.encodingAESKey` | Callback encryption key (43 chars) | Yes |
|
|
250
|
+
| `channels.wecom.agent.welcomeText` | Welcome message | No |
|
|
251
|
+
| `channels.wecom.agent.dmPolicy` | DM access policy (overrides top-level) | No |
|
|
252
|
+
| `channels.wecom.agent.allowFrom` | DM allowlist (overrides top-level) | No |
|
|
253
|
+
|
|
254
|
+
#### Webhook Paths
|
|
255
|
+
|
|
256
|
+
**Agent Mode:**
|
|
257
|
+
|
|
258
|
+
| Path | Description |
|
|
259
|
+
|---|---|
|
|
260
|
+
| `/plugins/wecom/agent/<accountId>` | 推荐路径(例如 `/plugins/wecom/agent/default`) |
|
|
261
|
+
| `/plugins/wecom/agent/default` | 多账号模式下自动路由到默认账号(即使默认账号 ID 不是 `default`) |
|
|
262
|
+
| `/plugins/wecom/agent` | 兼容路径(单账号 / 多账号签名匹配) |
|
|
263
|
+
| `/wecom/agent` | Legacy 兼容路径 |
|
|
264
|
+
|
|
265
|
+
**Bot Webhook Mode** (`connectionMode: "webhook"`):
|
|
266
|
+
|
|
267
|
+
| Path | Description |
|
|
268
|
+
|---|---|
|
|
269
|
+
| `/plugins/wecom/bot` | Recommended path (single account) |
|
|
270
|
+
| `/plugins/wecom/bot/<accountId>` | Multi-account path |
|
|
271
|
+
| `/wecom/bot` | Legacy compatible path |
|
|
272
|
+
| `/wecom` | Legacy compatible path |
|
|
273
|
+
|
|
274
|
+
### Outbound Delivery (Bot WS → Agent HTTP Fallback)
|
|
275
|
+
|
|
276
|
+
The plugin uses a **Bot-first, Agent-fallback** strategy for outbound message delivery:
|
|
277
|
+
|
|
278
|
+
1. **Bot WebSocket available** → send via WS (supports markdown, streaming)
|
|
279
|
+
2. **Bot WS unavailable** → automatically fallback to **Agent HTTP API** (`cgi-bin/message/send`)
|
|
280
|
+
|
|
281
|
+
This means:
|
|
282
|
+
- **Agent-only accounts** (no Bot configured) can still send proactive messages, cron deliveries, and broadcasts
|
|
283
|
+
- **Target formats** like `party:1`, `tag:Ops`, `user:zhangsan` are fully supported in both paths
|
|
284
|
+
- **Media fallback**: when Bot WS is unavailable, media files are downloaded, uploaded to WeCom via Agent API, then sent; if upload fails, falls back to text + URL
|
|
285
|
+
- No manual switching needed — the plugin handles fallback transparently
|
|
286
|
+
|
|
287
|
+
### Using Both Modes Together
|
|
288
|
+
|
|
289
|
+
Bot and Agent can run simultaneously on the same account. Bot handles WebSocket streaming; Agent handles HTTP webhook callbacks with API-driven replies.
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"channels": {
|
|
294
|
+
"wecom": {
|
|
295
|
+
"enabled": true,
|
|
296
|
+
"botId": "your-bot-id",
|
|
297
|
+
"secret": "your-bot-secret",
|
|
298
|
+
"agent": {
|
|
299
|
+
"corpId": "ww1234567890abcdef",
|
|
300
|
+
"corpSecret": "your-corp-secret",
|
|
301
|
+
"agentId": 1000002,
|
|
302
|
+
"token": "your-callback-token",
|
|
303
|
+
"encodingAESKey": "your-encoding-aes-key-43-chars"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Multi-Account Configuration
|
|
311
|
+
|
|
312
|
+
Use `accounts` to configure multiple WeCom accounts, each with optional bot and/or agent sub-configs. Account-level fields override top-level fields of the same name.
|
|
313
|
+
|
|
314
|
+
```json
|
|
315
|
+
{
|
|
316
|
+
"channels": {
|
|
317
|
+
"wecom": {
|
|
318
|
+
"enabled": true,
|
|
319
|
+
"defaultAccount": "main",
|
|
320
|
+
"dmPolicy": "open",
|
|
321
|
+
"accounts": {
|
|
322
|
+
"main": {
|
|
323
|
+
"botId": "bot-id-1",
|
|
324
|
+
"secret": "secret-1",
|
|
325
|
+
"agent": {
|
|
326
|
+
"corpId": "ww1234567890abcdef",
|
|
327
|
+
"corpSecret": "secret-a",
|
|
328
|
+
"agentId": 1000002,
|
|
329
|
+
"token": "token-a",
|
|
330
|
+
"encodingAESKey": "aes-key-a"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"support": {
|
|
334
|
+
"dmPolicy": "allowlist",
|
|
335
|
+
"allowFrom": ["admin1"],
|
|
336
|
+
"agent": {
|
|
337
|
+
"corpId": "ww1234567890abcdef",
|
|
338
|
+
"corpSecret": "secret-b",
|
|
339
|
+
"agentId": 1000003,
|
|
340
|
+
"token": "token-b",
|
|
341
|
+
"encodingAESKey": "aes-key-b"
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
> **Note**: In multi-account mode, accounts without explicit `bindings` will not fall back to the default agent. Configure bindings for each account:
|
|
351
|
+
> ```json
|
|
352
|
+
> {
|
|
353
|
+
> "bindings": [
|
|
354
|
+
> { "agentId": "your-agent", "match": { "channel": "wecom", "accountId": "main" } }
|
|
355
|
+
> ]
|
|
356
|
+
> }
|
|
357
|
+
> ```
|
|
358
|
+
|
|
359
|
+
### Dynamic Agent Configuration
|
|
360
|
+
|
|
361
|
+
Dynamic Agent routing automatically creates isolated agents per user or group, enabling session isolation.
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
{
|
|
365
|
+
"channels": {
|
|
366
|
+
"wecom": {
|
|
367
|
+
"dynamicAgents": {
|
|
368
|
+
"enabled": true,
|
|
369
|
+
"dmCreateAgent": true,
|
|
370
|
+
"groupEnabled": true,
|
|
371
|
+
"adminUsers": ["admin_user_id"]
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
| Config Path | Description | Default |
|
|
379
|
+
|---|---|---|
|
|
380
|
+
| `channels.wecom.dynamicAgents.enabled` | Enable dynamic agent routing | `false` |
|
|
381
|
+
| `channels.wecom.dynamicAgents.dmCreateAgent` | Create isolated agent per DM user | `true` |
|
|
382
|
+
| `channels.wecom.dynamicAgents.groupEnabled` | Enable dynamic agent for group chats | `true` |
|
|
383
|
+
| `channels.wecom.dynamicAgents.adminUsers` | Admin users (bypass dynamic routing, use main agent) | `[]` |
|
|
105
384
|
|
|
106
385
|
---
|
|
107
386
|
|
|
@@ -198,6 +477,112 @@ In addition to the group allowlist, you can restrict which members within a grou
|
|
|
198
477
|
|
|
199
478
|
---
|
|
200
479
|
|
|
480
|
+
## ⏰ Cronjob (Scheduled Tasks)
|
|
481
|
+
|
|
482
|
+
The plugin supports scheduled message delivery via OpenClaw's built-in Cron service. Cron jobs run through the **Agent outbound** channel, so Agent mode must be configured.
|
|
483
|
+
|
|
484
|
+
### Target Formats
|
|
485
|
+
|
|
486
|
+
The `delivery.to` field supports the following target formats:
|
|
487
|
+
|
|
488
|
+
| Format | Target | Example |
|
|
489
|
+
|--------|--------|--------|
|
|
490
|
+
| `party:<id>` | Department (all members) | `party:1` (root dept = all employees) |
|
|
491
|
+
| `dept:<id>` | Department (alias for party) | `dept:5` |
|
|
492
|
+
| `tag:<id>` | Tag group | `tag:Ops` |
|
|
493
|
+
| `user:<id>` | Specific user | `user:zhangsan` |
|
|
494
|
+
| `group:<id>` | External group chat | `group:wr123abc` |
|
|
495
|
+
| `chat:<id>` | Group chat (alias for group) | `chat:wc456def` |
|
|
496
|
+
| Pure number | Auto-detected as department | `1` → `party:1` |
|
|
497
|
+
| `wr...` / `wc...` | Auto-detected as group chat | `wr123` → `chatid` |
|
|
498
|
+
| Other string | Auto-detected as user | `zhangsan` → `touser` |
|
|
499
|
+
|
|
500
|
+
> **Namespace prefixes** (`wecom:`, `qywx:`, `wework:`, `wechatwork:`, `wecom-agent:`) are automatically stripped before parsing.
|
|
501
|
+
|
|
502
|
+
### Method 1: CLI (Recommended — takes effect immediately)
|
|
503
|
+
|
|
504
|
+
```shell
|
|
505
|
+
openclaw cron add \
|
|
506
|
+
--name "daily-report" \
|
|
507
|
+
--agent main \
|
|
508
|
+
--cron "0 9 * * 1-5" \
|
|
509
|
+
--tz "Asia/Shanghai" \
|
|
510
|
+
--message "Good morning! Here is your daily briefing." \
|
|
511
|
+
--announce \
|
|
512
|
+
--channel wecom \
|
|
513
|
+
--to "party:1"
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
> **Note**: `--announce` enables delivery mode (broadcasts the AI response to the target chat). Use `--no-deliver` to keep output internal. The deprecated `--deliver` flag is an alias for `--announce`.
|
|
517
|
+
|
|
518
|
+
Common CLI commands:
|
|
519
|
+
|
|
520
|
+
```shell
|
|
521
|
+
openclaw cron list # List all cron jobs
|
|
522
|
+
openclaw cron show <id> # Show job details
|
|
523
|
+
openclaw cron enable <id> # Enable a job
|
|
524
|
+
openclaw cron disable <id> # Disable a job
|
|
525
|
+
openclaw cron remove <id> # Remove a job
|
|
526
|
+
openclaw cron run <id> # Manually trigger a job
|
|
527
|
+
openclaw cron runs --id <id> # View run history
|
|
528
|
+
openclaw cron edit <id> --message "New prompt" # Edit a job
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### Method 2: Edit `jobs.json` (requires gateway restart)
|
|
532
|
+
|
|
533
|
+
File path: `~/.openclaw/cron/jobs.json`
|
|
534
|
+
|
|
535
|
+
```json
|
|
536
|
+
{
|
|
537
|
+
"version": 1,
|
|
538
|
+
"jobs": [
|
|
539
|
+
{
|
|
540
|
+
"id": "daily-report",
|
|
541
|
+
"name": "Daily Report",
|
|
542
|
+
"agentId": "main",
|
|
543
|
+
"enabled": true,
|
|
544
|
+
"schedule": { "kind": "cron", "expr": "0 9 * * 1-5", "tz": "Asia/Shanghai" },
|
|
545
|
+
"sessionTarget": "isolated",
|
|
546
|
+
"wakeMode": "now",
|
|
547
|
+
"payload": {
|
|
548
|
+
"kind": "agentTurn",
|
|
549
|
+
"message": "Generate today's briefing and send it."
|
|
550
|
+
},
|
|
551
|
+
"delivery": {
|
|
552
|
+
"mode": "announce",
|
|
553
|
+
"channel": "wecom",
|
|
554
|
+
"to": "party:1",
|
|
555
|
+
"accountId": "main"
|
|
556
|
+
},
|
|
557
|
+
"state": {}
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
After editing, restart the gateway:
|
|
564
|
+
|
|
565
|
+
```shell
|
|
566
|
+
openclaw gateway restart
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### Method 3: Create via chat (takes effect immediately)
|
|
570
|
+
|
|
571
|
+
You can ask the AI agent directly in a WeCom conversation:
|
|
572
|
+
|
|
573
|
+
> "Create a scheduled task: send a daily briefing to the entire company at 9am every weekday"
|
|
574
|
+
|
|
575
|
+
The agent will call the Cron API to create the job — no restart needed.
|
|
576
|
+
|
|
577
|
+
### Notes
|
|
578
|
+
|
|
579
|
+
- Cron jobs use the **Agent outbound** path — Agent mode (`corpId` / `corpSecret` / `agentId`) must be configured.
|
|
580
|
+
- The server IP must be in the WeCom trusted IP allowlist, or configure `egressProxyUrl` for a fixed egress proxy.
|
|
581
|
+
- Jobs created via CLI or chat API take effect immediately. Manual edits to `jobs.json` require `openclaw gateway restart`.
|
|
582
|
+
- For multi-account setups, set `delivery.accountId` to the target account (e.g. `"main"`, `"support"`).
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
201
586
|
## 📦 Update
|
|
202
587
|
|
|
203
588
|
```shell
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { OpenClawPluginApi } from
|
|
2
|
-
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
3
2
|
declare const plugin: {
|
|
4
3
|
id: string;
|
|
5
4
|
name: string;
|
|
@@ -7,5 +6,4 @@ declare const plugin: {
|
|
|
7
6
|
configSchema: Record<string, unknown>;
|
|
8
7
|
register(api: OpenClawPluginApi): void;
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
export { plugin as default };
|
|
9
|
+
export default plugin;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { emptyPluginConfigSchema } from "./src/openclaw-compat.js";
|
|
2
|
+
import { wecomPlugin } from "./src/channel.js";
|
|
3
|
+
import { createWeComMcpTool } from "./src/mcp/index.js";
|
|
4
|
+
import { setWeComRuntime } from "./src/runtime.js";
|
|
5
|
+
import { CHANNEL_ID, WEBHOOK_PATHS } from "./src/const.js";
|
|
6
|
+
import { createWecomAgentWebhookHandler } from "./src/agent/webhook.js";
|
|
7
|
+
import { handleWecomWebhookRequest } from "./src/webhook/index.js";
|
|
8
|
+
const plugin = {
|
|
9
|
+
id: "wecom-openclaw-plugin",
|
|
10
|
+
name: "企业微信",
|
|
11
|
+
description: "企业微信 OpenClaw 插件",
|
|
12
|
+
configSchema: emptyPluginConfigSchema(),
|
|
13
|
+
register(api) {
|
|
14
|
+
setWeComRuntime(api.runtime);
|
|
15
|
+
api.registerChannel({ plugin: wecomPlugin });
|
|
16
|
+
// 注册 wecom_mcp:通过 HTTP 直接调用企业微信 MCP Server
|
|
17
|
+
api.registerTool(createWeComMcpTool(), { name: "wecom_mcp" });
|
|
18
|
+
const agentWebhookHandler = createWecomAgentWebhookHandler(api.runtime);
|
|
19
|
+
// 注册 Agent 模式 HTTP 路由(prefix match 覆盖带 accountId 的子路径)
|
|
20
|
+
api.registerHttpRoute({
|
|
21
|
+
path: WEBHOOK_PATHS.AGENT_PLUGIN,
|
|
22
|
+
handler: agentWebhookHandler,
|
|
23
|
+
auth: "plugin",
|
|
24
|
+
match: "prefix",
|
|
25
|
+
});
|
|
26
|
+
api.registerHttpRoute({
|
|
27
|
+
path: WEBHOOK_PATHS.AGENT,
|
|
28
|
+
handler: agentWebhookHandler,
|
|
29
|
+
auth: "plugin",
|
|
30
|
+
match: "prefix",
|
|
31
|
+
});
|
|
32
|
+
// ── 注册 bot Webhook HTTP 路由 ────────────────────────────────────────
|
|
33
|
+
// 前缀匹配模式,同时覆盖 /plugins/wecom 和 /wecom 路径
|
|
34
|
+
const webhookRoutes = [WEBHOOK_PATHS.BOT_PLUGIN, WEBHOOK_PATHS.BOT_ALT, WEBHOOK_PATHS.BOT];
|
|
35
|
+
for (const routePath of webhookRoutes) {
|
|
36
|
+
api.registerHttpRoute({
|
|
37
|
+
path: routePath,
|
|
38
|
+
handler: handleWecomWebhookRequest,
|
|
39
|
+
auth: "plugin",
|
|
40
|
+
match: "prefix",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// 注入媒体发送指令和文件大小限制提示词(仅对企业微信 channel 生效)
|
|
44
|
+
api.on("before_prompt_build", (_event, ctx) => {
|
|
45
|
+
// 只在企业微信 channel 的会话中注入,避免影响其他 channel 插件
|
|
46
|
+
if (ctx?.channelId !== CHANNEL_ID) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
appendSystemContext: [
|
|
51
|
+
"重要:涉及发送图片/视频/语音/文件给用户时,请务必使用 `MEDIA:` 指令。详见 wecom-send-media 这个 skill(技能)。",
|
|
52
|
+
"重要:当需要向用户发送结构化卡片消息(如通知、投票、按钮选择等)时,请在回复中直接输出 JSON 代码块(```json ... ```),其中 card_type 字段标明卡片类型。详见 wecom-send-template-card 技能。"
|
|
53
|
+
].join("\n"),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export default plugin;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
+
import type { WeComConfig, WeComAccountConfig, ResolvedWeComAccount } from "./utils.js";
|
|
3
|
+
/**
|
|
4
|
+
* 企业微信多账号配置结构(扩展 WeComConfig)
|
|
5
|
+
*/
|
|
6
|
+
export interface WeComMultiAccountConfig extends WeComConfig {
|
|
7
|
+
/** 默认账号 ID */
|
|
8
|
+
defaultAccount?: string;
|
|
9
|
+
/** 多账号配置 */
|
|
10
|
+
accounts?: Record<string, WeComAccountConfig>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 判断是否为多账号模式(即配置中存在 accounts 字段)。
|
|
14
|
+
* 用于区分单账号/多账号模式的分支判断,替代 `accountId === DEFAULT_ACCOUNT_ID` 的不可靠判断。
|
|
15
|
+
*/
|
|
16
|
+
export declare function hasMultiAccounts(cfg: OpenClawConfig): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 列出所有企业微信账号 ID。
|
|
19
|
+
* 如果没有 accounts 字段,返回 [DEFAULT_ACCOUNT_ID] 以向后兼容。
|
|
20
|
+
*/
|
|
21
|
+
export declare function listWeComAccountIds(cfg: OpenClawConfig): string[];
|
|
22
|
+
/**
|
|
23
|
+
* 解析默认账号 ID。
|
|
24
|
+
*
|
|
25
|
+
* 优先级:
|
|
26
|
+
* 1. 显式设置的 defaultAccount
|
|
27
|
+
* 2. 包含 DEFAULT_ACCOUNT_ID 的账号列表
|
|
28
|
+
* 3. 字母序第一个账号
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveDefaultWeComAccountId(cfg: OpenClawConfig): string;
|
|
31
|
+
/**
|
|
32
|
+
* 解析单个企业微信账号的完整配置。
|
|
33
|
+
*
|
|
34
|
+
* 支持:
|
|
35
|
+
* - 显式指定 accountId → 使用该 accountId
|
|
36
|
+
* - 未指定 → 使用默认账号
|
|
37
|
+
* - 单账号模式(无 accounts 字段) → 直接读取顶层配置
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveWeComAccountMulti(params: {
|
|
40
|
+
cfg: OpenClawConfig;
|
|
41
|
+
accountId?: string | null;
|
|
42
|
+
}): ResolvedWeComAccount;
|
|
43
|
+
/**
|
|
44
|
+
* 列出所有已启用且已配置凭据的账号。
|
|
45
|
+
*/
|
|
46
|
+
export declare function listEnabledWeComAccounts(cfg: OpenClawConfig): ResolvedWeComAccount[];
|
|
47
|
+
/**
|
|
48
|
+
* 写入企业微信账户配置(自动区分单账号/多账号模式)。
|
|
49
|
+
*
|
|
50
|
+
* - 单账号模式(无 accounts 字段):写入顶层 channels.wecom
|
|
51
|
+
* - 多账号模式:写入 channels.wecom.accounts[accountId]
|
|
52
|
+
*
|
|
53
|
+
* @param cfg 当前全局配置
|
|
54
|
+
* @param updates 要写入的部分配置字段
|
|
55
|
+
* @param accountId 目标账号 ID(默认写入默认账号)
|
|
56
|
+
*/
|
|
57
|
+
export declare function setWeComAccountMulti(cfg: OpenClawConfig, updates: Partial<WeComConfig>, accountId?: string): OpenClawConfig;
|