@marshulll/openclaw-wecom 0.1.10 → 0.1.12

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.en.md CHANGED
@@ -99,3 +99,5 @@ Install guide: `docs/INSTALL.md`
99
99
  - Dev doc: `docs/TECHNICAL.md`
100
100
  - Install: `docs/INSTALL.md`
101
101
  - Examples: `docs/wecom.config.example.json` / `docs/wecom.config.full.example.json`
102
+
103
+ Recommendation: use **separate webhookPath** for Bot and App (e.g. `/wecom/bot` and `/wecom/app`) for clearer debugging and fewer callback mix-ups.
package/README.md CHANGED
@@ -39,6 +39,8 @@ openclaw gateway restart
39
39
  全量示例:`docs/wecom.config.full.example.json`
40
40
  安装与配置说明:`docs/INSTALL.md`
41
41
 
42
+ 建议:Bot 与 App 使用**不同的 webhookPath**(如 `/wecom/bot` 与 `/wecom/app`),便于排障并避免回调混淆。
43
+
42
44
  ### 最小配置示例
43
45
  ```json5
44
46
  {
package/README.zh.md CHANGED
@@ -39,6 +39,8 @@ openclaw gateway restart
39
39
  全量示例:`docs/wecom.config.full.example.json`
40
40
  安装与配置说明:`docs/INSTALL.md`
41
41
 
42
+ 建议:Bot 与 App 使用**不同的 webhookPath**(如 `/wecom/bot` 与 `/wecom/app`),便于排障并避免回调混淆。
43
+
42
44
  ### 最小配置示例
43
45
  ```json5
44
46
  {
package/docs/INSTALL.md CHANGED
@@ -50,6 +50,37 @@ openclaw gateway restart
50
50
  }
51
51
  ```
52
52
 
53
+ 推荐示例(Bot/App 独立路径):
54
+ ```json5
55
+ {
56
+ "channels": {
57
+ "wecom": {
58
+ "enabled": true,
59
+ "mode": "both",
60
+ "defaultAccount": "bot",
61
+ "accounts": {
62
+ "bot": {
63
+ "mode": "bot",
64
+ "webhookPath": "/wecom/bot",
65
+ "token": "BOT_TOKEN",
66
+ "encodingAESKey": "BOT_AES",
67
+ "receiveId": "BOT_ID"
68
+ },
69
+ "app": {
70
+ "mode": "app",
71
+ "webhookPath": "/wecom/app",
72
+ "corpId": "CORP_ID",
73
+ "corpSecret": "CORP_SECRET",
74
+ "agentId": 1000001,
75
+ "callbackToken": "CALLBACK_TOKEN",
76
+ "callbackAesKey": "CALLBACK_AES"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
53
84
  ## 环境变量示例(可选)
54
85
 
55
86
  如果你更希望用环境变量,也可以写在 `~/.openclaw/openclaw.json` 的 `env.vars` 中(优先级低于 `channels.wecom` 配置):
@@ -99,6 +130,7 @@ openclaw gateway restart
99
130
  ## Webhook 验证
100
131
  - Bot 模式与 App 模式都要求公网 HTTPS。
101
132
  - 在企业微信后台配置回调 URL。
133
+ - 建议 Bot 与 App 使用不同 `webhookPath`,便于排障与避免回调混淆。
102
134
 
103
135
  ## 常见问题
104
136
  - 回调验证失败:检查 Token / AESKey / URL 是否一致
@@ -3,17 +3,6 @@
3
3
  "wecom": {
4
4
  "enabled": true,
5
5
  "mode": "both",
6
- "webhookPath": "/wecom",
7
-
8
- "token": "BOT_TOKEN",
9
- "encodingAESKey": "BOT_AES",
10
- "receiveId": "BOT_ID",
11
-
12
- "corpId": "CORP_ID",
13
- "corpSecret": "CORP_SECRET",
14
- "agentId": 1000001,
15
- "callbackToken": "CALLBACK_TOKEN",
16
- "callbackAesKey": "CALLBACK_AES",
17
6
 
18
7
  "media": {
19
8
  "tempDir": "/tmp/openclaw-wecom",
@@ -28,26 +17,23 @@
28
17
  "allowFrom": []
29
18
  },
30
19
 
31
- "defaultAccount": "default",
20
+ "defaultAccount": "bot",
32
21
  "accounts": {
33
- "default": {
34
- "mode": "both",
35
- "webhookPath": "/wecom",
22
+ "bot": {
23
+ "mode": "bot",
24
+ "webhookPath": "/wecom/bot",
36
25
  "token": "BOT_TOKEN",
37
26
  "encodingAESKey": "BOT_AES",
38
- "receiveId": "BOT_ID",
27
+ "receiveId": "BOT_ID"
28
+ },
29
+ "app": {
30
+ "mode": "app",
31
+ "webhookPath": "/wecom/app",
39
32
  "corpId": "CORP_ID",
40
33
  "corpSecret": "CORP_SECRET",
41
34
  "agentId": 1000001,
42
35
  "callbackToken": "CALLBACK_TOKEN",
43
- "callbackAesKey": "CALLBACK_AES",
44
- "media": {
45
- "tempDir": "/tmp/openclaw-wecom",
46
- "retentionHours": 72,
47
- "cleanupOnStart": true,
48
- "maxBytes": 10485760
49
- },
50
- "botMediaBridge": true
36
+ "callbackAesKey": "CALLBACK_AES"
51
37
  }
52
38
  }
53
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marshulll/openclaw-wecom",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "OpenClaw WeCom channel plugin (intelligent bot + internal app)",
6
6
  "author": "OpenClaw",
@@ -753,6 +753,10 @@ export async function handleWecomBotWebhook(params: {
753
753
  pruneStreams();
754
754
 
755
755
  const { req, res, targets } = params;
756
+ const botTargets = targets.filter((candidate) => shouldHandleBot(candidate.account));
757
+ if (botTargets.length === 0) {
758
+ return false;
759
+ }
756
760
  const query = resolveQueryParams(req);
757
761
  const timestamp = query.get("timestamp") ?? "";
758
762
  const nonce = query.get("nonce") ?? "";
@@ -770,7 +774,7 @@ export async function handleWecomBotWebhook(params: {
770
774
  return false;
771
775
  }
772
776
 
773
- const target = targets.find((candidate) => {
777
+ const target = botTargets.find((candidate) => {
774
778
  if (!shouldHandleBot(candidate.account)) return false;
775
779
  if (!candidate.account.configured || !candidate.account.token) return false;
776
780
  const ok = verifyWecomSignature({
@@ -823,9 +827,9 @@ export async function handleWecomBotWebhook(params: {
823
827
  return true;
824
828
  }
825
829
 
826
- const target = targets.find((candidate) => {
827
- if (!shouldHandleBot(candidate.account)) return false;
828
- if (!candidate.account.token) return false;
830
+ const target = botTargets.find((candidate) => {
831
+ if (!shouldHandleBot(candidate.account)) return false;
832
+ if (!candidate.account.token) return false;
829
833
  const ok = verifyWecomSignature({
830
834
  token: candidate.account.token,
831
835
  timestamp,