@wecom/wecom-openclaw-plugin 1.0.7-beta.0 → 1.0.7-beta.1
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 +142 -11
- package/dist/index.cjs.js +8 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -10
- package/dist/index.esm.js.map +1 -1
- package/openclaw.plugin.json +3 -0
- package/package.json +3 -2
- package/skills/wecom-doc/SKILL.md +327 -0
- package/skills/wecom-doc/references/doc-api.md +224 -0
package/README.md
CHANGED
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
# 🤖 WeCom OpenClaw Plugin
|
|
2
2
|
|
|
3
|
-
**WeCom channel plugin for [OpenClaw](https://github.com/openclaw)
|
|
3
|
+
**WeCom channel plugin for [OpenClaw](https://github.com/openclaw)** — by the Tencent WeCom team.
|
|
4
4
|
|
|
5
|
-
> A
|
|
5
|
+
> A bot plugin powered by WeCom AI Bot WebSocket persistent connections. Supports direct messages & group chats, streaming replies, and proactive messaging.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
📖 [WeCom AI Bot Official Documentation](https://open.work.weixin.qq.com/help?doc_id=21657)
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
## ✨ Features
|
|
10
13
|
|
|
11
|
-
- 🔗
|
|
12
|
-
- 💬 Supports
|
|
13
|
-
- 📤
|
|
14
|
+
- 🔗 WebSocket persistent connection for stable communication
|
|
15
|
+
- 💬 Supports both direct messages (DM) and group chat
|
|
16
|
+
- 📤 Proactive messaging to specific users or groups
|
|
17
|
+
- 🖼️ Receives and processes image and file messages with automatic downloading
|
|
18
|
+
- ⏳ Streaming replies with "thinking" placeholder messages
|
|
19
|
+
- 📝 Markdown formatting support for replies
|
|
20
|
+
- 🔒 Built-in access control: DM Policy (pairing / open / allowlist / disabled) and Group Policy (open / allowlist / disabled)
|
|
21
|
+
- ⚡ Auto heartbeat keep-alive and reconnection (up to 100 reconnect attempts)
|
|
22
|
+
- 🧙 Interactive CLI setup wizard
|
|
14
23
|
|
|
15
24
|
---
|
|
16
25
|
|
|
17
26
|
## 🚀 Getting Started
|
|
18
27
|
|
|
28
|
+
### Requirements
|
|
29
|
+
|
|
30
|
+
- OpenClaw `>= 2026.2.13`
|
|
31
|
+
|
|
19
32
|
### Installation
|
|
20
33
|
|
|
21
34
|
```shell
|
|
22
|
-
# Install the WeCom Channel Plugin
|
|
23
35
|
openclaw plugins install @wecom/wecom-openclaw-plugin
|
|
24
|
-
|
|
25
|
-
# Future plugin updates
|
|
26
|
-
openclaw plugins update wecom-openclaw-plugin
|
|
27
36
|
```
|
|
28
37
|
|
|
29
38
|
### Configuration
|
|
@@ -34,12 +43,134 @@ openclaw plugins update wecom-openclaw-plugin
|
|
|
34
43
|
openclaw channels add
|
|
35
44
|
```
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
Follow the prompts to enter your WeCom bot's **Bot ID** and **Secret**.
|
|
47
|
+
|
|
48
|
+
#### Option 2: CLI Quick Setup
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
openclaw config set channels.wecom.botId <YOUR_BOT_ID>
|
|
52
|
+
openclaw config set channels.wecom.secret <YOUR_BOT_SECRET>
|
|
53
|
+
openclaw config set channels.wecom.enabled true
|
|
54
|
+
openclaw gateway restart
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Configuration Reference
|
|
58
|
+
|
|
59
|
+
| Config Path | Description | Options | Default |
|
|
60
|
+
|---|---|---|---|
|
|
61
|
+
| `channels.wecom.botId` | WeCom bot ID | — | — |
|
|
62
|
+
| `channels.wecom.secret` | WeCom bot secret | — | — |
|
|
63
|
+
| `channels.wecom.enabled` | Enable the channel | `true` / `false` | `false` |
|
|
64
|
+
| `channels.wecom.websocketUrl` | WebSocket endpoint | — | `wss://openws.work.weixin.qq.com` |
|
|
65
|
+
| `channels.wecom.dmPolicy` | DM access policy | `pairing` / `open` / `allowlist` / `disabled` | `pairing` |
|
|
66
|
+
| `channels.wecom.allowFrom` | DM allowlist (user IDs) | — | `[]` |
|
|
67
|
+
| `channels.wecom.groupPolicy` | Group chat access policy | `open` / `allowlist` / `disabled` | `open` |
|
|
68
|
+
| `channels.wecom.groupAllowFrom` | Group allowlist (group IDs) | — | `[]` |
|
|
69
|
+
| `channels.wecom.sendThinkingMessage` | Send "thinking" placeholder | `true` / `false` | `true` |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 🔒 Access Control
|
|
74
|
+
|
|
75
|
+
### DM (Direct Message) Access
|
|
76
|
+
|
|
77
|
+
**Default**: `dmPolicy: "pairing"` — unrecognized users will receive a pairing code.
|
|
78
|
+
|
|
79
|
+
#### Approve Pairing
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
openclaw pairing list wecom # View pending pairing requests
|
|
83
|
+
openclaw pairing approve wecom <CODE> # Approve a pairing request
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Allowlist Mode
|
|
87
|
+
|
|
88
|
+
Configure allowed user IDs via `channels.wecom.allowFrom`:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"channels": {
|
|
93
|
+
"wecom": {
|
|
94
|
+
"dmPolicy": "allowlist",
|
|
95
|
+
"allowFrom": ["user_id_1", "user_id_2"]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Open Mode
|
|
102
|
+
|
|
103
|
+
Set `dmPolicy: "open"` to allow all users to send direct messages without approval.
|
|
104
|
+
|
|
105
|
+
#### Disabled Mode
|
|
106
|
+
|
|
107
|
+
Set `dmPolicy: "disabled"` to completely block all direct messages.
|
|
108
|
+
|
|
109
|
+
### Group Access
|
|
110
|
+
|
|
111
|
+
#### Group Policy (`channels.wecom.groupPolicy`)
|
|
112
|
+
|
|
113
|
+
- `"open"` — Allow messages from all groups (default)
|
|
114
|
+
- `"allowlist"` — Only allow groups listed in `groupAllowFrom`
|
|
115
|
+
- `"disabled"` — Disable all group messages
|
|
116
|
+
|
|
117
|
+
### Group Configuration Examples
|
|
118
|
+
|
|
119
|
+
#### Allow All Groups (Default Behavior)
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"channels": {
|
|
124
|
+
"wecom": {
|
|
125
|
+
"groupPolicy": "open"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Allow Only Specific Groups
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"channels": {
|
|
136
|
+
"wecom": {
|
|
137
|
+
"groupPolicy": "allowlist",
|
|
138
|
+
"groupAllowFrom": ["group_id_1", "group_id_2"]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Allow Only Specific Senders Within a Group (Sender Allowlist)
|
|
145
|
+
|
|
146
|
+
In addition to the group allowlist, you can restrict which members within a group are allowed to interact with the bot. Only messages from users listed in `groups.<chatId>.allowFrom` will be processed; messages from other members will be silently ignored. This is a sender-level allowlist that applies to **all messages**.
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"channels": {
|
|
151
|
+
"wecom": {
|
|
152
|
+
"groupPolicy": "allowlist",
|
|
153
|
+
"groupAllowFrom": ["group_id_1"],
|
|
154
|
+
"groups": {
|
|
155
|
+
"group_id_1": {
|
|
156
|
+
"allowFrom": ["user_id_1", "user_id_2"]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📦 Update
|
|
38
167
|
|
|
39
168
|
```shell
|
|
40
|
-
openclaw
|
|
169
|
+
openclaw plugins update wecom-openclaw-plugin
|
|
41
170
|
```
|
|
42
171
|
|
|
172
|
+
---
|
|
173
|
+
|
|
43
174
|
## 📄 License
|
|
44
175
|
|
|
45
176
|
MIT
|
package/dist/index.cjs.js
CHANGED
|
@@ -1083,16 +1083,14 @@ async function routeAndDispatchMessage(params) {
|
|
|
1083
1083
|
},
|
|
1084
1084
|
});
|
|
1085
1085
|
// 发送最终消息
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1086
|
+
await sendWeComReply({
|
|
1087
|
+
wsClient,
|
|
1088
|
+
frame,
|
|
1089
|
+
text: state.accumulatedText,
|
|
1090
|
+
runtime,
|
|
1091
|
+
finish: true,
|
|
1092
|
+
streamId: state.streamId,
|
|
1093
|
+
});
|
|
1096
1094
|
safeCleanup();
|
|
1097
1095
|
}
|
|
1098
1096
|
catch (err) {
|