@zzedbot/yunzhijia 1.0.2

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.
@@ -0,0 +1,61 @@
1
+ # Alternative Installation Methods
2
+
3
+ Since npm publishing requires 2FA or granular access tokens with bypass permissions, here are alternative ways to install and use the YunzhiJia channel plugin.
4
+
5
+ ## Method 1: Install from GitHub (Recommended)
6
+
7
+ You can install the plugin directly from the GitHub repository:
8
+
9
+ ```bash
10
+ # Install from the dev branch
11
+ openclaw plugins install https://github.com/zzedbot/channel-yunzhijia
12
+
13
+ # Or install from a specific tag/release
14
+ openclaw plugins install https://github.com/zzedbot/channel-yunzhijia#v1.0.0
15
+ ```
16
+
17
+ ## Method 2: Manual Installation
18
+
19
+ 1. Clone the repository:
20
+ ```bash
21
+ git clone https://github.com/zzedbot/channel-yunzhijia.git
22
+ cd channel-yunzhijia
23
+ ```
24
+
25
+ 2. Copy to OpenClaw extensions directory:
26
+ ```bash
27
+ # Create extensions directory if it doesn't exist
28
+ mkdir -p ~/.openclaw/extensions
29
+
30
+ # Copy the plugin
31
+ cp -r . ~/.openclaw/extensions/yunzhijia
32
+ ```
33
+
34
+ 3. Restart OpenClaw Gateway
35
+
36
+ ## Method 3: Local Development Link
37
+
38
+ For development purposes, you can link the local directory:
39
+
40
+ ```bash
41
+ openclaw plugins install -l /path/to/your/local/channel-yunzhijia
42
+ ```
43
+
44
+ ## Configuration
45
+
46
+ After installation using any of the above methods, configure the channel as described in DEPLOYMENT.md:
47
+
48
+ ```bash
49
+ openclaw channels add --channel yunzhijia --webhook-token YOUR_WEBHOOK_TOKEN --app-secret YOUR_APP_SECRET
50
+ ```
51
+
52
+ ## Verification
53
+
54
+ Check that the plugin is loaded correctly:
55
+
56
+ ```bash
57
+ openclaw plugins list
58
+ openclaw channels status
59
+ ```
60
+
61
+ This approach bypasses the need for npm publishing while still providing full functionality.
package/DEPLOYMENT.md ADDED
@@ -0,0 +1,380 @@
1
+ # YunzhiJia Channel Deployment Guide
2
+
3
+ ## Overview
4
+
5
+ This document provides comprehensive deployment instructions for the YunzhiJia channel plugin, following OpenClaw's standard plugin deployment patterns. The YunzhiJia channel enables integration with Kingdee's enterprise messaging platform through webhook-based communication.
6
+
7
+ ## Prerequisites
8
+
9
+ ### 1. OpenClaw Gateway Requirements
10
+ - **OpenClaw Gateway** version 2026.1.0 or later
11
+ - **Public HTTPS endpoint** accessible from YunzhiJia servers
12
+ - **Valid SSL certificate** (required by YunzhiJia)
13
+
14
+ ### 2. YunzhiJia Bot Configuration
15
+ - **YunzhiJia Enterprise Account** with bot creation permissions
16
+ - **App Secret** for request signature verification
17
+ - **Webhook Token** for sending responses
18
+ - **Message Receive URL** pointing to your OpenClaw instance
19
+
20
+ ## Installation Methods
21
+
22
+ ### Method 1: Plugin Installation (Recommended)
23
+
24
+ The YunzhiJia channel follows OpenClaw's standard plugin architecture and can be installed using the `openclaw plugins` CLI:
25
+
26
+ ```bash
27
+ # Install from local development directory
28
+ openclaw plugins install /zed/workspace/projects/yunzhijiachannel
29
+
30
+ # Or install from npm (once published)
31
+ openclaw plugins install @openclaw/yunzhijia
32
+ ```
33
+
34
+ ### Method 2: Development Linking
35
+
36
+ For active development, link the plugin without copying:
37
+
38
+ ```bash
39
+ # Link for development (changes reflect immediately)
40
+ openclaw plugins install -l /zed/workspace/projects/yunzhijiachannel
41
+ ```
42
+
43
+ ### Method 3: Manual Extension Loading
44
+
45
+ Add the plugin path to your OpenClaw configuration:
46
+
47
+ ```json5
48
+ {
49
+ plugins: {
50
+ load: {
51
+ paths: ["/zed/workspace/projects/yunzhijiachannel"]
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ ## Configuration
58
+
59
+ ### Basic Configuration
60
+
61
+ After installation, configure the YunzhiJia channel in your OpenClaw config file (`~/.openclaw/openclaw.json`):
62
+
63
+ ```json5
64
+ {
65
+ channels: {
66
+ yunzhijia: {
67
+ enabled: true,
68
+ webhookToken: "${YUNZHIJIA_WEBHOOK_TOKEN}",
69
+ appSecret: "${YUNZHIJIA_APP_SECRET}",
70
+ requireMention: true,
71
+ allowFrom: []
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ ### Environment Variables
78
+
79
+ For security, use environment variables for sensitive credentials:
80
+
81
+ ```bash
82
+ export OPENCLAW_YUNZHIJIA_WEBHOOK_TOKEN="your-webhook-token"
83
+ export OPENCLAW_YUNZHIJIA_APP_SECRET="your-app-secret"
84
+ ```
85
+
86
+ Then reference them in your config:
87
+
88
+ ```json5
89
+ {
90
+ channels: {
91
+ yunzhijia: {
92
+ enabled: true,
93
+ webhookToken: "${YUNZHIJIA_WEBHOOK_TOKEN}",
94
+ appSecret: "${YUNZHIJIA_APP_SECRET}"
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Multi-Account Configuration
101
+
102
+ Support multiple YunzhiJia bots with different configurations:
103
+
104
+ ```json5
105
+ {
106
+ channels: {
107
+ yunzhijia: {
108
+ accounts: {
109
+ "production": {
110
+ webhookToken: "${PROD_WEBHOOK_TOKEN}",
111
+ appSecret: "${PROD_APP_SECRET}",
112
+ enabled: true
113
+ },
114
+ "staging": {
115
+ webhookToken: "${STAGING_WEBHOOK_TOKEN}",
116
+ appSecret: "${STAGING_APP_SECRET}",
117
+ enabled: false
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## HTTP Endpoint Setup
126
+
127
+ ### Automatic Registration
128
+
129
+ The YunzhiJia plugin automatically registers its HTTP endpoint at `/receive` when loaded. No manual registration is required.
130
+
131
+ ### Reverse Proxy Configuration
132
+
133
+ Configure your reverse proxy to forward requests to the OpenClaw Gateway:
134
+
135
+ #### Nginx Example
136
+ ```nginx
137
+ server {
138
+ listen 443 ssl;
139
+ server_name your-domain.com;
140
+
141
+ # SSL configuration
142
+ ssl_certificate /path/to/cert.pem;
143
+ ssl_certificate_key /path/to/key.pem;
144
+
145
+ location /receive {
146
+ proxy_pass http://localhost:8000/receive;
147
+ proxy_set_header Host $host;
148
+ proxy_set_header X-Real-IP $remote_addr;
149
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
150
+ proxy_set_header X-Forwarded-Proto $scheme;
151
+ proxy_set_header Content-Type $http_content_type;
152
+
153
+ # Required headers for YunzhiJia
154
+ proxy_pass_request_headers on;
155
+ }
156
+ }
157
+ ```
158
+
159
+ #### Apache Example
160
+ ```apache
161
+ <VirtualHost *:443>
162
+ ServerName your-domain.com
163
+
164
+ SSLEngine on
165
+ SSLCertificateFile /path/to/cert.pem
166
+ SSLCertificateKeyFile /path/to/key.pem
167
+
168
+ ProxyPass /receive http://localhost:8000/receive
169
+ ProxyPassReverse /receive http://localhost:8000/receive
170
+
171
+ # Preserve original headers
172
+ ProxyPreserveHost On
173
+ RequestHeader set X-Forwarded-Proto "https"
174
+ </VirtualHost>
175
+ ```
176
+
177
+ ## YunzhiJia Bot Setup
178
+
179
+ ### 1. Create Bot in YunzhiJia
180
+
181
+ 1. Navigate to your YunzhiJia admin panel
182
+ 2. Create a new webhook bot
183
+ 3. Set the **Message Receive URL** to: `https://your-domain.com/receive`
184
+ 4. Copy the generated **App Secret** and **Webhook Token**
185
+
186
+ ### 2. Configure Security Settings
187
+
188
+ - **Signature Verification**: Enabled (required)
189
+ - **Mention Requirement**: Recommended for production
190
+ - **Allowlist**: Configure if you want to restrict access
191
+
192
+ ## Testing and Validation
193
+
194
+ ### 1. Initial Configuration Test
195
+
196
+ Use the OpenClaw CLI to verify plugin installation:
197
+
198
+ ```bash
199
+ # List installed plugins
200
+ openclaw plugins list
201
+
202
+ # Check channel status
203
+ openclaw channels status --channel yunzhijia
204
+
205
+ # Test configuration
206
+ openclaw doctor
207
+ ```
208
+
209
+ ### 2. YunzhiJia Test Request
210
+
211
+ YunzhiJia sends a test request when you save the bot configuration:
212
+
213
+ **Request Headers:**
214
+ ```
215
+ Content-Type: application/json; charset=utf-8
216
+ sign: jy/WTAtltv5UVQVDOb0f4H4JPqw=
217
+ sessionId: XXXXXX
218
+ ```
219
+
220
+ **Request Body:**
221
+ ```json
222
+ {
223
+ "type": 2,
224
+ "robotId": "test-robotId",
225
+ "robotName": "test-robotName",
226
+ "operatorOpenid": "test-userId",
227
+ "operatorName": "test-userName",
228
+ "time": 1599727083000,
229
+ "msgId": "test-msgId",
230
+ "content": "你好,你能做什么呢?"
231
+ }
232
+ ```
233
+
234
+ **Expected Response (within 3 seconds):**
235
+ ```json
236
+ {
237
+ "success": true,
238
+ "data": {
239
+ "type": 2,
240
+ "content": ""
241
+ }
242
+ }
243
+ ```
244
+
245
+ The actual response will be sent asynchronously via webhook after OpenClaw processing completes.
246
+
247
+ ### 3. Manual Testing
248
+
249
+ Test the integration manually using curl:
250
+
251
+ ```bash
252
+ # Test signature calculation (using test-secret)
253
+ curl -X POST \
254
+ -H "Content-Type: application/json; charset=utf-8" \
255
+ -H "sign: jy/WTAtltv5UVQVDOb0f4H4JPqw=" \
256
+ -H "sessionId: test-session-123" \
257
+ -d '{
258
+ "type": 2,
259
+ "robotId": "test-robotId",
260
+ "robotName": "test-robotName",
261
+ "operatorOpenid": "test-userId",
262
+ "operatorName": "test-userName",
263
+ "time": 1599727083000,
264
+ "msgId": "test-msgId",
265
+ "content": "测试消息"
266
+ }' \
267
+ https://your-domain.com/receive
268
+ ```
269
+
270
+ ## Troubleshooting
271
+
272
+ ### Common Issues
273
+
274
+ #### 1. Signature Verification Failed
275
+ - **Cause**: App Secret mismatch between configuration and YunzhiJia bot settings
276
+ - **Solution**: Verify the `appSecret` in your OpenClaw config matches the YunzhiJia bot configuration
277
+ - **Debug**: Enable verbose logging with `OPENCLAW_DEBUG=true`
278
+
279
+ #### 2. Request Timeout (3 seconds exceeded)
280
+ - **Cause**: HTTP handler not returning immediate response
281
+ - **Solution**: Ensure the plugin is properly installed and the `/receive` endpoint is registered
282
+ - **Verify**: Check OpenClaw logs for HTTP request processing
283
+
284
+ #### 3. Webhook Delivery Failed
285
+ - **Cause**: Invalid webhook token or network connectivity issues
286
+ - **Solution**: Verify the `webhookToken` and ensure YunzhiJia can reach your webhook endpoint
287
+ - **Test**: Use curl to test webhook delivery directly
288
+
289
+ #### 4. No Messages Received
290
+ - **Cause**: Bot not properly @mentioned or allowlist restrictions
291
+ - **Solution**: Check `requireMention` setting and `allowFrom` configuration
292
+ - **Verify**: Test with explicit @mention in YunzhiJia chat
293
+
294
+ ### Debugging Commands
295
+
296
+ ```bash
297
+ # Enable verbose logging
298
+ export OPENCLAW_DEBUG=true
299
+
300
+ # Check channel status
301
+ openclaw channels status --channel yunzhijia
302
+
303
+ # View channel logs
304
+ openclaw channels logs --channel yunzhijia
305
+
306
+ # Run diagnostics
307
+ openclaw doctor
308
+
309
+ # Test configuration validation
310
+ openclaw config validate
311
+ ```
312
+
313
+ ### Log Analysis
314
+
315
+ Key log messages to watch for:
316
+
317
+ - `Received YunzhiJia message from {userName} ({userId}): {content}` - Message received
318
+ - `Invalid signature` - Signature verification failed
319
+ - `Processing completed, sending webhook response` - Async processing finished
320
+ - `Failed to send webhook message` - Webhook delivery error
321
+
322
+ ## Security Considerations
323
+
324
+ ### 1. Credential Protection
325
+ - Never commit webhook tokens or app secrets to version control
326
+ - Use environment variables or secure secret management
327
+ - Rotate credentials regularly
328
+
329
+ ### 2. Access Control
330
+ - Enable `requireMention: true` in production to prevent spam
331
+ - Use `allowFrom` whitelist for sensitive deployments
332
+ - Monitor unauthorized access attempts
333
+
334
+ ### 3. Network Security
335
+ - Ensure HTTPS is properly configured with valid certificates
336
+ - Restrict inbound traffic to YunzhiJia IP ranges if possible
337
+ - Implement rate limiting at the reverse proxy level
338
+
339
+ ## Maintenance and Updates
340
+
341
+ ### Plugin Updates
342
+
343
+ Update the plugin using the standard OpenClaw plugin management:
344
+
345
+ ```bash
346
+ # Update from local changes
347
+ openclaw plugins update yunzhijia
348
+
349
+ # Restart gateway to apply changes
350
+ openclaw gateway restart
351
+ ```
352
+
353
+ ### Configuration Changes
354
+
355
+ Apply configuration changes safely:
356
+
357
+ ```bash
358
+ # Validate configuration before applying
359
+ openclaw config validate
360
+
361
+ # Apply changes with automatic restart
362
+ openclaw gateway call config.patch --params '{
363
+ "raw": "{\\"channels\\": {\\"yunzhijia\\": {\\"requireMention\\": false}}}",
364
+ "baseHash": "<current-hash>"
365
+ }'
366
+ ```
367
+
368
+ ## Compliance with OpenClaw Standards
369
+
370
+ This YunzhiJia channel implementation follows OpenClaw's plugin development standards:
371
+
372
+ - ✅ Uses `openclaw/plugin-sdk` for type safety and runtime integration
373
+ - ✅ Implements complete `ChannelPlugin` interface with all required adapters
374
+ - ✅ Supports multi-account configuration and dynamic management
375
+ - ✅ Integrates with OpenClaw's async message processing pipeline
376
+ - ✅ Provides proper security adapters and allowlist support
377
+ - ✅ Includes comprehensive status monitoring and health checks
378
+ - ✅ Follows standard deployment patterns for OpenClaw plugins
379
+
380
+ The implementation is modeled after the Telegram channel reference implementation and maintains full compatibility with OpenClaw's core architecture.