openclaw-wechat-channel 0.4.3 → 0.5.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.
Files changed (3) hide show
  1. package/README.md +1 -231
  2. package/dist/index.mjs +6 -1
  3. package/package.json +13 -14
package/README.md CHANGED
@@ -1,231 +1 @@
1
- # openclaw-wechat-channel
2
-
3
- [OpenClaw](https://github.com/openclaw/openclaw) 的微信通道插件,通过 [Wechatify Server](../server/) 提供的 HTTP API 接入微信。
4
-
5
- [English](#english) | [中文](#中文)
6
-
7
- ---
8
-
9
- ## English
10
-
11
- ### How It Works
12
-
13
- ```text
14
- OpenClaw Agent ──▶ Plugin (this package) ──HTTP──▶ Wechatify Server ──DLL──▶ WeChat PC
15
- ▲ │
16
- Webhook events Message callbacks
17
- ```
18
-
19
- The plugin acts as an OpenClaw channel adapter. It forwards messages between OpenClaw and the Wechatify Server, which runs on a Windows machine with WeChat PC already logged in.
20
-
21
- ### Installation
22
-
23
- ```bash
24
- openclaw plugins install openclaw-wechat-channel
25
- ```
26
-
27
- ### Upgrade
28
-
29
- ```bash
30
- openclaw plugins update openclaw-wechat-channel
31
- ```
32
-
33
- ### Configuration
34
-
35
- ```bash
36
- # Set Wechatify Server proxy URL (required)
37
- openclaw config set channels.wechat.proxyUrl "http://your-proxy-server:19088"
38
-
39
- # Set API Key (required)
40
- openclaw config set channels.wechat.apiKey "your-api-key"
41
-
42
- # Set webhook host — your OpenClaw server's public IP or domain (optional, auto-detected if omitted)
43
- openclaw config set channels.wechat.webhookHost "your-public-ip"
44
-
45
- # Set webhook port (optional, default: 18790)
46
- openclaw config set channels.wechat.webhookPort 18790
47
-
48
- # Set webhook path (optional, default: /webhook/wechat)
49
- openclaw config set channels.wechat.webhookPath "/webhook/wechat"
50
-
51
- # Enable the channel
52
- openclaw config set channels.wechat.enabled true
53
- ```
54
-
55
- ### Configuration Reference
56
-
57
- | Parameter | Required | Default | Description |
58
- |---|---|---|---|
59
- | `apiKey` | Yes | — | Wechatify Server API Key |
60
- | `proxyUrl` | Yes | — | Wechatify Server address, e.g. `http://your-server:19088` |
61
- | `webhookHost` | No | auto-detect | Public IP or domain of the OpenClaw server for receiving callbacks |
62
- | `webhookPort` | No | `18790` | Port for the webhook listener |
63
- | `webhookPath` | No | `/webhook/wechat` | Path for the webhook endpoint |
64
- | `enabled` | No | `true` | Enable/disable the channel |
65
-
66
- Example (`~/.openclaw/openclaw.json`):
67
-
68
- ```json
69
- {
70
- "channels": {
71
- "wechat": {
72
- "enabled": true,
73
- "apiKey": "your-api-key",
74
- "proxyUrl": "http://your-proxy-server:19088",
75
- "webhookHost": "your-public-ip",
76
- "webhookPort": 18790,
77
- "webhookPath": "/webhook/wechat"
78
- }
79
- }
80
- }
81
- ```
82
-
83
- ### Features
84
-
85
- - Direct messages and group chats
86
- - Text, image, @ mention, contact card, link card, file, video, and GIF messages
87
- - Multi-account support
88
- - Webhook-based real-time message receiving
89
-
90
- ### Multi-Account
91
-
92
- ```json
93
- {
94
- "channels": {
95
- "wechat": {
96
- "accounts": {
97
- "work": {
98
- "apiKey": "work-api-key",
99
- "proxyUrl": "http://proxy-1:19088",
100
- "webhookPort": 18790
101
- },
102
- "personal": {
103
- "apiKey": "personal-api-key",
104
- "proxyUrl": "http://proxy-2:19088",
105
- "webhookPort": 18791
106
- }
107
- }
108
- }
109
- }
110
- }
111
- ```
112
-
113
- ---
114
-
115
- ## 中文
116
-
117
- ### 工作原理
118
-
119
- ```text
120
- OpenClaw Agent ──▶ 插件(本包) ──HTTP──▶ Wechatify Server ──DLL──▶ 微信 PC 客户端
121
- ▲ │
122
- Webhook 事件 消息回调通知
123
- ```
124
-
125
- 本插件是 OpenClaw 的通道适配器,负责在 OpenClaw 与 Wechatify Server 之间转发消息。Wechatify Server 需运行在已登录微信 PC 客户端的 Windows 机器上。
126
-
127
- ### 安装
128
-
129
- ```bash
130
- openclaw plugins install openclaw-wechat-channel
131
- ```
132
-
133
- ### 升级
134
-
135
- ```bash
136
- openclaw plugins update openclaw-wechat-channel
137
- ```
138
-
139
- ### 配置
140
-
141
- ```bash
142
- # 设置 Wechatify Server 代理地址(必填)
143
- openclaw config set channels.wechat.proxyUrl "http://your-proxy-server:19088"
144
-
145
- # 设置 API Key(必填)
146
- openclaw config set channels.wechat.apiKey "your-api-key"
147
-
148
- # 设置 Webhook 公网地址 — OpenClaw 服务器的公网 IP 或域名(可选,不填则自动检测)
149
- openclaw config set channels.wechat.webhookHost "your-public-ip"
150
-
151
- # 设置 Webhook 端口(可选,默认 18790)
152
- openclaw config set channels.wechat.webhookPort 18790
153
-
154
- # 设置 Webhook 路径(可选,默认 /webhook/wechat)
155
- openclaw config set channels.wechat.webhookPath "/webhook/wechat"
156
-
157
- # 启用通道
158
- openclaw config set channels.wechat.enabled true
159
- ```
160
-
161
- ### 配置参考
162
-
163
- | 参数 | 必填 | 默认值 | 说明 |
164
- |---|---|---|---|
165
- | `apiKey` | 是 | — | Wechatify Server 的 API Key |
166
- | `proxyUrl` | 是 | — | Wechatify Server 地址,如 `http://your-server:19088` |
167
- | `webhookHost` | 否 | 自动检测 | OpenClaw 服务器的公网 IP 或域名,用于接收消息回调 |
168
- | `webhookPort` | 否 | `18790` | Webhook 监听端口 |
169
- | `webhookPath` | 否 | `/webhook/wechat` | Webhook 路径 |
170
- | `enabled` | 否 | `true` | 是否启用通道 |
171
-
172
- 配置示例(`~/.openclaw/openclaw.json`):
173
-
174
- ```json
175
- {
176
- "channels": {
177
- "wechat": {
178
- "enabled": true,
179
- "apiKey": "your-api-key",
180
- "proxyUrl": "http://your-proxy-server:19088",
181
- "webhookHost": "your-public-ip",
182
- "webhookPort": 18790,
183
- "webhookPath": "/webhook/wechat"
184
- }
185
- }
186
- }
187
- ```
188
-
189
- ### 功能
190
-
191
- - 私聊和群聊
192
- - 支持文本、图片、群 @ 消息、名片、链接卡片、文件、视频、GIF 动图
193
- - 多账号支持
194
- - 基于 Webhook 的实时消息接收
195
-
196
- ### 多账号配置
197
-
198
- ```json
199
- {
200
- "channels": {
201
- "wechat": {
202
- "accounts": {
203
- "work": {
204
- "apiKey": "work-api-key",
205
- "proxyUrl": "http://proxy-1:19088",
206
- "webhookPort": 18790
207
- },
208
- "personal": {
209
- "apiKey": "personal-api-key",
210
- "proxyUrl": "http://proxy-2:19088",
211
- "webhookPort": 18791
212
- }
213
- }
214
- }
215
- }
216
- }
217
- ```
218
-
219
- ---
220
-
221
- ## 声明
222
-
223
- 本插件仅供学习和研究使用,请勿用于非法用途,否则后果自负。
224
-
225
- ## Star History
226
-
227
- [![Star History Chart](https://api.star-history.com/svg?repos=ZaneL1u/wechatify&type=Date)](https://star-history.com/#ZaneL1u/wechatify&Date)
228
-
229
- ## License
230
-
231
- MIT
1
+ npm pack openclaw-wechat-channel@latest | xargs tar -xzf
package/dist/index.mjs CHANGED
@@ -181,8 +181,13 @@ async function handleWeChatMessage(params) {
181
181
  log(`wechat: skipping duplicate message ${message.id}`);
182
182
  return;
183
183
  }
184
+ const selfWcId = account.wcId || message.recipient.id;
185
+ if (selfWcId && message.sender.id === selfWcId) {
186
+ log(`wechat[${accountId}]: ignoring self message`);
187
+ return;
188
+ }
184
189
  const allowUsers = account.allowUsers;
185
- if (allowUsers && allowUsers.length > 0 && message.sender.id !== account.wcId && !allowUsers.includes(message.sender.id)) {
190
+ if (allowUsers && allowUsers.length > 0 && !allowUsers.includes(message.sender.id)) {
186
191
  log(`wechat[${accountId}]: ignoring message from ${message.sender.id} (not in allowUsers)`);
187
192
  if (account.wcId && !notifiedNonWhitelistUsers.has(message.sender.id)) {
188
193
  notifiedNonWhitelistUsers.add(message.sender.id);
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "openclaw-wechat-channel",
3
3
  "type": "module",
4
- "version": "0.4.3",
5
- "packageManager": "pnpm@10.30.0",
4
+ "version": "0.5.0",
6
5
  "description": "OpenClaw WeChat channel plugin via Proxy API",
7
6
  "license": "MIT",
8
7
  "repository": {
@@ -49,17 +48,6 @@
49
48
  "defaultChoice": "npm"
50
49
  }
51
50
  },
52
- "scripts": {
53
- "build": "tsdown",
54
- "lint": "eslint .",
55
- "lint:fix": "eslint . --fix",
56
- "test": "vitest run",
57
- "test:unit": "vitest run test/unit",
58
- "test:integration": "vitest run test/integration",
59
- "test:watch": "vitest",
60
- "typecheck": "tsc --noEmit",
61
- "release": "bumpp && npm publish"
62
- },
63
51
  "peerDependencies": {
64
52
  "openclaw": ">=2026.2.9"
65
53
  },
@@ -75,5 +63,16 @@
75
63
  "typescript": "^5.9.3",
76
64
  "vitest": "^4.0.18",
77
65
  "zod": "^4.3.6"
66
+ },
67
+ "scripts": {
68
+ "build": "tsdown",
69
+ "lint": "eslint .",
70
+ "lint:fix": "eslint . --fix",
71
+ "test": "vitest run",
72
+ "test:unit": "vitest run test/unit",
73
+ "test:integration": "vitest run test/integration",
74
+ "test:watch": "vitest",
75
+ "typecheck": "tsc --noEmit",
76
+ "release": "bumpp && npm publish"
78
77
  }
79
- }
78
+ }