@huo15/dingtalk-connector-pro 1.0.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/CHANGELOG.md +485 -0
- package/LICENSE +21 -0
- package/README.en.md +479 -0
- package/README.md +209 -0
- package/docs/AGENT_ROUTING.md +335 -0
- package/docs/DEAP_AGENT_GUIDE.en.md +115 -0
- package/docs/DEAP_AGENT_GUIDE.md +115 -0
- package/docs/images/dingtalk.svg +1 -0
- package/docs/images/image-1.png +0 -0
- package/docs/images/image-2.png +0 -0
- package/docs/images/image-3.png +0 -0
- package/docs/images/image-4.png +0 -0
- package/docs/images/image-5.png +0 -0
- package/docs/images/image-6.png +0 -0
- package/docs/images/image-7.png +0 -0
- package/index.ts +28 -0
- package/install-beta.sh +438 -0
- package/install-npm.sh +167 -0
- package/openclaw.plugin.json +498 -0
- package/package.json +80 -0
- package/src/channel.ts +463 -0
- package/src/config/accounts.ts +242 -0
- package/src/config/schema.ts +148 -0
- package/src/core/connection.ts +722 -0
- package/src/core/message-handler.ts +1700 -0
- package/src/core/provider.ts +111 -0
- package/src/core/state.ts +54 -0
- package/src/directory.ts +95 -0
- package/src/docs.ts +293 -0
- package/src/gateway-methods.ts +404 -0
- package/src/onboarding.ts +413 -0
- package/src/policy.ts +32 -0
- package/src/probe.ts +212 -0
- package/src/reply-dispatcher.ts +630 -0
- package/src/runtime.ts +32 -0
- package/src/sdk/helpers.ts +322 -0
- package/src/sdk/types.ts +513 -0
- package/src/secret-input.ts +19 -0
- package/src/services/media/audio.ts +54 -0
- package/src/services/media/chunk-upload.ts +296 -0
- package/src/services/media/common.ts +155 -0
- package/src/services/media/file.ts +70 -0
- package/src/services/media/image.ts +81 -0
- package/src/services/media/index.ts +10 -0
- package/src/services/media/video.ts +162 -0
- package/src/services/media.ts +1136 -0
- package/src/services/messaging/card.ts +342 -0
- package/src/services/messaging/index.ts +17 -0
- package/src/services/messaging/send.ts +141 -0
- package/src/services/messaging.ts +1013 -0
- package/src/targets.ts +45 -0
- package/src/types/index.ts +59 -0
- package/src/utils/agent.ts +63 -0
- package/src/utils/async.ts +51 -0
- package/src/utils/constants.ts +27 -0
- package/src/utils/http-client.ts +37 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +78 -0
- package/src/utils/session.ts +147 -0
- package/src/utils/token.ts +93 -0
- package/src/utils/utils-legacy.ts +454 -0
- package/tsconfig.json +20 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img alt="DingTalk" src="docs/images/dingtalk.svg" width="72" height="72" />
|
|
3
|
+
<h1>Official DingTalk OpenClaw Connector</h1>
|
|
4
|
+
<p>Connect DingTalk bots to OpenClaw Gateway with AI Card streaming and session management</p>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<a href="README.md">简体中文</a> •
|
|
8
|
+
<a href="CHANGELOG.md">Changelog</a>
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Prerequisites](#prerequisites)
|
|
17
|
+
- [Quick Start](#quick-start)
|
|
18
|
+
- [Features](#features)
|
|
19
|
+
- [Configuration](#configuration)
|
|
20
|
+
- [Troubleshooting](#troubleshooting)
|
|
21
|
+
- [Advanced Topics](#advanced-topics)
|
|
22
|
+
- [DingTalk DEAP Agent Integration](docs/DEAP_AGENT_GUIDE.en.md)
|
|
23
|
+
- [License](#license)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Prerequisites
|
|
28
|
+
|
|
29
|
+
Before you begin, ensure you have:
|
|
30
|
+
|
|
31
|
+
> This connector is used as an OpenClaw Gateway plugin, and you usually don't need to install or manage Node.js runtime by yourself.
|
|
32
|
+
|
|
33
|
+
### 1. OpenClaw Gateway
|
|
34
|
+
|
|
35
|
+
- **Official Website**: https://openclaw.ai/
|
|
36
|
+
- **Installation**: Follow the official guide to install OpenClaw
|
|
37
|
+
- **Verify installation**:
|
|
38
|
+
```bash
|
|
39
|
+
openclaw gateway status
|
|
40
|
+
```
|
|
41
|
+
Expected output: `✓ Gateway is running on http://127.0.0.1:18789`
|
|
42
|
+
|
|
43
|
+
### 2. DingTalk Enterprise Account
|
|
44
|
+
|
|
45
|
+
- You need a DingTalk enterprise account to create internal applications
|
|
46
|
+
- Official Website: https://www.dingtalk.com/
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
> 💡 **Goal**: Get your DingTalk bot working in ~5 minutes
|
|
53
|
+
|
|
54
|
+
### Operating System Support
|
|
55
|
+
|
|
56
|
+
- macOS / Linux: Use the default shell (zsh, bash, etc.).
|
|
57
|
+
- Windows:
|
|
58
|
+
- Recommended: **PowerShell** or **Windows Terminal**.
|
|
59
|
+
- OpenClaw config file path (default): `C:\Users\<YourUserName>\.openclaw\openclaw.json`.
|
|
60
|
+
|
|
61
|
+
Whenever you see `~/.openclaw/openclaw.json` below, it is equivalent to the above path on Windows.
|
|
62
|
+
|
|
63
|
+
### Step 1: Install the Plugin
|
|
64
|
+
|
|
65
|
+
#### Method A: Install via npm (Recommended)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
openclaw plugins install @dingtalk-real-ai/dingtalk-connector
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Method B: Install from Local Source
|
|
72
|
+
|
|
73
|
+
If you want to develop or modify the plugin, clone the repository first:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# 1. Clone the plugin repository
|
|
77
|
+
git clone https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
|
|
78
|
+
cd dingtalk-openclaw-connector
|
|
79
|
+
|
|
80
|
+
# 2. Install dependencies (required)
|
|
81
|
+
npm install
|
|
82
|
+
|
|
83
|
+
# 3. Install in link mode (changes take effect immediately)
|
|
84
|
+
openclaw plugins install -l .
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Method C: Manual Installation
|
|
88
|
+
|
|
89
|
+
1. Download or copy this repository to `~/.openclaw/extensions/dingtalk-connector`.
|
|
90
|
+
2. Make sure it contains `index.ts`, `openclaw.plugin.json`, and `package.json`.
|
|
91
|
+
3. Run `npm install` in that directory to install dependencies.
|
|
92
|
+
|
|
93
|
+
#### Method D: China Mainland Installation (npm Mirror)
|
|
94
|
+
|
|
95
|
+
If `openclaw plugins install` gets stuck at `Installing plugin dependencies...` or fails with `npm install failed` due to network issues in China, you can specify a mirror registry for that install:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
NPM_CONFIG_REGISTRY=https://registry.npmmirror.com openclaw plugins install @dingtalk-real-ai/dingtalk-connector
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If the plugin is in a partially installed state (e.g., the extension directory exists but dependencies are incomplete), you can manually reinstall dependencies:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cd ~/.openclaw/extensions/dingtalk-connector
|
|
105
|
+
rm -rf node_modules package-lock.json
|
|
106
|
+
NPM_CONFIG_REGISTRY=https://registry.npmmirror.com npm install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To make the mirror permanent, set the default npm registry:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm config set registry https://registry.npmmirror.com
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Or add to `~/.npmrc`:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
registry=https://registry.npmmirror.com
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Verify installation**:
|
|
122
|
+
```bash
|
|
123
|
+
openclaw plugins list
|
|
124
|
+
```
|
|
125
|
+
You should see `✓ DingTalk Channel (v0.8.6) - loaded`
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Step 2: Create a DingTalk Bot
|
|
130
|
+
|
|
131
|
+
#### 2.1 Create Application
|
|
132
|
+
|
|
133
|
+
1. Go to [DingTalk Open Platform](https://open-dev.dingtalk.com/)
|
|
134
|
+
2. Click **"Application Development"**
|
|
135
|
+
|
|
136
|
+

|
|
137
|
+
|
|
138
|
+
#### 2.2 Add Bot Capability
|
|
139
|
+
|
|
140
|
+
1. On the application details page, use the “one-click OpenClaw bot app” flow
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
#### 2.3 Get Credentials
|
|
145
|
+
|
|
146
|
+
1. Finish creation and open **"Credentials & Basic Info"**
|
|
147
|
+
2. Copy your **AppKey** (Client ID)
|
|
148
|
+
3. Copy your **AppSecret** (Client Secret)
|
|
149
|
+
|
|
150
|
+

|
|
151
|
+
|
|
152
|
+

|
|
153
|
+
|
|
154
|
+
> ⚠️ **Important**: Client ID and Client Secret are your bot’s unique credentials. Store them safely.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### Step 3: Configure OpenClaw
|
|
159
|
+
|
|
160
|
+
You have three options to configure the connector:
|
|
161
|
+
|
|
162
|
+
#### Option A: Configuration Wizard (Recommended for Beginners)
|
|
163
|
+
|
|
164
|
+
> You can directly copy and paste the following command into your terminal to run the configuration wizard.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
openclaw channels add
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Select **"DingTalk (钉钉)"** and follow the prompts to enter:
|
|
171
|
+
- `clientId` (AppKey)
|
|
172
|
+
- `clientSecret` (AppSecret)
|
|
173
|
+
|
|
174
|
+
#### Option B: Edit Configuration File
|
|
175
|
+
|
|
176
|
+
Edit the configuration file:
|
|
177
|
+
|
|
178
|
+
- macOS / Linux: `~/.openclaw/openclaw.json`
|
|
179
|
+
- Windows: `C:\Users\<YourUserName>\.openclaw\openclaw.json`
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"channels": {
|
|
184
|
+
"dingtalk-connector": {
|
|
185
|
+
"enabled": true,
|
|
186
|
+
"clientId": "dingxxxxxxxxx",
|
|
187
|
+
"clientSecret": "your_app_secret"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
> 💡 **Tip**: If the file already has content, add the `dingtalk-connector` section under the `channels` node.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### Step 4: Restart and Test
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Restart OpenClaw Gateway
|
|
201
|
+
openclaw gateway restart
|
|
202
|
+
|
|
203
|
+
# Watch logs in real-time
|
|
204
|
+
openclaw logs --follow
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Test your bot**:
|
|
208
|
+
1. Open DingTalk app
|
|
209
|
+
2. Find your bot in the contact list
|
|
210
|
+
3. Send a message: `Hello`
|
|
211
|
+
4. You should receive a response within 10 seconds
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Features
|
|
216
|
+
|
|
217
|
+
### ✅ Core Features
|
|
218
|
+
|
|
219
|
+
- **AI Card Streaming** - Typewriter-like replies with real-time streaming
|
|
220
|
+
- **Session Management** - Multi-turn conversations with context preservation
|
|
221
|
+
- **Session Isolation** - Separate sessions for DMs, groups, and different groups
|
|
222
|
+
- **Auto Session Reset** - Automatic new session after 30 minutes of inactivity
|
|
223
|
+
- **Manual Session Reset** - Send `/new` or `新会话` to clear conversation history
|
|
224
|
+
- **Image Auto-Upload** - Local image paths automatically uploaded to DingTalk
|
|
225
|
+
- **Proactive Messaging** - Send messages to users or groups programmatically
|
|
226
|
+
- **Rich Media Reception** - Receive and process JPEG/PNG images, pass to vision models
|
|
227
|
+
- **File Attachment Extraction** - Parse .docx, .pdf, text files, and binary files
|
|
228
|
+
- **Audio Message Support** - Send audio messages in multiple formats (mp3, wav, amr, ogg)
|
|
229
|
+
- **DingTalk Docs API** - Create, append, search, and list DingTalk documents
|
|
230
|
+
- **Multi-Agent Routing** - Connect multiple bots to different agents for specialized services
|
|
231
|
+
- **Markdown Table Conversion** - Auto-convert Markdown tables to DingTalk-compatible format
|
|
232
|
+
- **Async Mode** - Immediate acknowledgment with background processing (optional)
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
### Basic Configuration
|
|
239
|
+
|
|
240
|
+
| Option | Environment Variable | Description |
|
|
241
|
+
|--------|---------------------|-------------|
|
|
242
|
+
| `clientId` | — | DingTalk AppKey |
|
|
243
|
+
| `clientSecret` | — | DingTalk AppSecret |
|
|
244
|
+
|
|
245
|
+
### Session Management
|
|
246
|
+
|
|
247
|
+
| Option | Default | Description |
|
|
248
|
+
|--------|---------|-------------|
|
|
249
|
+
| `separateSessionByConversation` | `true` | Separate sessions for DMs/groups |
|
|
250
|
+
| `groupSessionScope` | `group` | Group session scope: `group` (shared) or `group_sender` (per-user) |
|
|
251
|
+
| `sharedMemoryAcrossConversations` | `false` | Share memory across different conversations |
|
|
252
|
+
|
|
253
|
+
### Session routing policies (`pmpolicy` / `groupPolicy`)
|
|
254
|
+
|
|
255
|
+
Both session routing/message policy options (including `pmpolicy` and `groupPolicy`) are supported now, so you **do not need to remove** them from existing configurations.
|
|
256
|
+
|
|
257
|
+
> Note: field names may vary across versions/upstream; on the connector side, related policies are supported and applied (for example, `dmPolicy`/`groupPolicy` default to `open`).
|
|
258
|
+
|
|
259
|
+
### Async Mode
|
|
260
|
+
|
|
261
|
+
| Option | Default | Description |
|
|
262
|
+
|--------|---------|-------------|
|
|
263
|
+
| `asyncMode` | `false` | Enable async mode for long-running tasks |
|
|
264
|
+
| `ackText` | `🫡 任务已接收,处理中...` | Acknowledgment message text |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Troubleshooting
|
|
269
|
+
|
|
270
|
+
### Bot Not Responding
|
|
271
|
+
|
|
272
|
+
**Symptoms**: Bot doesn't reply to messages
|
|
273
|
+
|
|
274
|
+
**Solutions**:
|
|
275
|
+
1. Check plugin status: `openclaw plugins list`
|
|
276
|
+
2. Check gateway status: `openclaw gateway status`
|
|
277
|
+
3. Check logs: `openclaw logs --follow`
|
|
278
|
+
4. Verify the app is published/enabled in DingTalk Open Platform
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### HTTP 401 Error
|
|
283
|
+
|
|
284
|
+
**Symptoms**: Error message shows "401 Unauthorized"
|
|
285
|
+
|
|
286
|
+
**Solution**: Upgrade to the latest version.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
### Stream Connection 400 Error
|
|
291
|
+
|
|
292
|
+
**Symptoms**: Logs show "Request failed with status code 400"
|
|
293
|
+
|
|
294
|
+
**Common Causes**:
|
|
295
|
+
|
|
296
|
+
| Cause | Solution |
|
|
297
|
+
|-------|----------|
|
|
298
|
+
| App not published | DingTalk Open Platform → Version Management → Publish |
|
|
299
|
+
| Invalid credentials | Check `clientId`/`clientSecret` for typos or extra spaces |
|
|
300
|
+
| Not Stream mode | Verify bot is configured for Stream mode (not Webhook) |
|
|
301
|
+
| IP whitelist | Check if the app has IP whitelist restrictions |
|
|
302
|
+
|
|
303
|
+
**Verification Steps**:
|
|
304
|
+
1. Check app status in [DingTalk Open Platform](https://open-dev.dingtalk.com/)
|
|
305
|
+
2. After any configuration change, click **Save** → **Publish**
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Advanced Topics
|
|
310
|
+
|
|
311
|
+
### Multi-Agent Configuration
|
|
312
|
+
|
|
313
|
+
Configure multiple bots connected to different agents:
|
|
314
|
+
|
|
315
|
+
```json5
|
|
316
|
+
{
|
|
317
|
+
"agents": {
|
|
318
|
+
"list": [
|
|
319
|
+
{
|
|
320
|
+
"id": "ding-bot1",
|
|
321
|
+
"name": "Customer Service Bot",
|
|
322
|
+
"model": "your-model-config",
|
|
323
|
+
"workspace": "~/.openclaw/workspace-bot1",
|
|
324
|
+
"identity": {
|
|
325
|
+
"name": "Service Assistant",
|
|
326
|
+
"theme": "customer service",
|
|
327
|
+
"emoji": "🤝"
|
|
328
|
+
}
|
|
329
|
+
// Other agent configurations...
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"id": "ding-bot2",
|
|
333
|
+
"name": "Technical Support Bot",
|
|
334
|
+
"model": "your-model-config",
|
|
335
|
+
"workspace": "~/.openclaw/workspace-bot2",
|
|
336
|
+
"identity": {
|
|
337
|
+
"name": "Tech Expert",
|
|
338
|
+
"theme": "technical support",
|
|
339
|
+
"emoji": "🔧"
|
|
340
|
+
}
|
|
341
|
+
// Other agent configurations...
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
"channels": {
|
|
346
|
+
"dingtalk-connector": {
|
|
347
|
+
"enabled": true,
|
|
348
|
+
"accounts": {
|
|
349
|
+
"bot1": {
|
|
350
|
+
"enabled": true,
|
|
351
|
+
"clientId": "ding_bot1_app_key",
|
|
352
|
+
"clientSecret": "bot1_secret"
|
|
353
|
+
},
|
|
354
|
+
"bot2": {
|
|
355
|
+
"enabled": true,
|
|
356
|
+
"clientId": "ding_bot2_app_key",
|
|
357
|
+
"clientSecret": "bot2_secret"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"bindings": [
|
|
363
|
+
{
|
|
364
|
+
"agentId": "ding-bot1",
|
|
365
|
+
"match": {
|
|
366
|
+
"channel": "dingtalk-connector",
|
|
367
|
+
"accountId": "bot1"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"agentId": "ding-bot2",
|
|
372
|
+
"match": {
|
|
373
|
+
"channel": "dingtalk-connector",
|
|
374
|
+
"accountId": "bot2"
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
For more details, see [OpenClaw Multi-Agent Configuration Guide](https://gist.github.com/smallnest/c5c13482740fd179e40070e620f66a52).
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
### Session Commands
|
|
386
|
+
|
|
387
|
+
Users can send the following commands to start a fresh session:
|
|
388
|
+
|
|
389
|
+
- `/new`, `/reset`, `/clear`
|
|
390
|
+
- `新会话`, `重新开始`, `清空对话`
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### DingTalk Docs via MCP (`docs.*`)
|
|
395
|
+
|
|
396
|
+
DingTalk Docs capabilities (`docs.*`, including `docs.create` / `docs.append` / `docs.search` / `docs.list` / `docs.read`) require MCP (Model Context Protocol) to provide the underlying tools. To enable `docs.*`, install and enable the corresponding MCP Server/Tool in the OpenClaw Gateway/Agent.
|
|
397
|
+
|
|
398
|
+
- **Where to get MCP Server/Tool**: via the [DingTalk MCP Marketplace](https://mcp.dingtalk.com/) (or your team’s internal MCP marketplace). You can also use a third-party marketplace to source an equivalent “DingTalk Docs Read / DingTalk Docs Reader” capability and connect it to OpenClaw.
|
|
399
|
+
- **Where to configure**: usually at the **Gateway or Agent tool configuration** level (not in this connector).
|
|
400
|
+
- **How it takes effect**: restart the Gateway and ensure the tool is exposed to the target agent.
|
|
401
|
+
|
|
402
|
+
References (OpenClaw configuration docs):
|
|
403
|
+
- `https://docs.openclaw.ai/configuration`
|
|
404
|
+
- `https://docs.openclaw.ai/gateway/configuration-reference`
|
|
405
|
+
|
|
406
|
+
Create and manage DingTalk documents from your agent:
|
|
407
|
+
|
|
408
|
+
```javascript
|
|
409
|
+
// Create document
|
|
410
|
+
dingtalk-connector.docs.create({
|
|
411
|
+
spaceId: "your-space-id",
|
|
412
|
+
title: "Test Document",
|
|
413
|
+
content: "# Test Content"
|
|
414
|
+
})
|
|
415
|
+
|
|
416
|
+
// Append content
|
|
417
|
+
dingtalk-connector.docs.append({
|
|
418
|
+
docId: "your-doc-id",
|
|
419
|
+
markdownContent: "\n## Appended Content"
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
// Search documents
|
|
423
|
+
dingtalk-connector.docs.search({
|
|
424
|
+
keyword: "search keyword"
|
|
425
|
+
})
|
|
426
|
+
|
|
427
|
+
// List documents
|
|
428
|
+
dingtalk-connector.docs.list({
|
|
429
|
+
spaceId: "your-space-id"
|
|
430
|
+
})
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Project Structure
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
dingtalk-openclaw-connector/
|
|
439
|
+
├── src/
|
|
440
|
+
│ ├── core/ # Core connector logic
|
|
441
|
+
│ ├── services/ # DingTalk API services
|
|
442
|
+
│ ├── utils/ # Utility functions
|
|
443
|
+
│ └── types/ # TypeScript type definitions
|
|
444
|
+
├── docs/
|
|
445
|
+
│ └── images/ # Documentation images
|
|
446
|
+
├── openclaw.plugin.json # Plugin manifest
|
|
447
|
+
├── package.json # npm dependencies
|
|
448
|
+
└── LICENSE
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Dependencies
|
|
454
|
+
|
|
455
|
+
| Package | Purpose |
|
|
456
|
+
|---------|---------|
|
|
457
|
+
| `dingtalk-stream` | DingTalk Stream protocol client |
|
|
458
|
+
| `axios` | HTTP client |
|
|
459
|
+
| `mammoth` | Word document (.docx) parsing |
|
|
460
|
+
| `pdf-parse` | PDF document parsing |
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## DingTalk DEAP Agent Integration
|
|
465
|
+
|
|
466
|
+
Connect DingTalk DEAP Agent with OpenClaw Gateway to enable natural language-driven local device operations. See **[DingTalk DEAP Agent Integration Guide](docs/DEAP_AGENT_GUIDE.en.md)** for details.
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## License
|
|
471
|
+
|
|
472
|
+
[MIT](LICENSE)
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## Support
|
|
477
|
+
|
|
478
|
+
- **Issues**: [GitHub Issues](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues)
|
|
479
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
package/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://tools.huo15.com/uploads/images/system/logo-colours.png" alt="火一五Logo" style="width: 120px; height: auto; display: inline; margin: 0;" />
|
|
4
|
+
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
|
|
9
|
+
**打破信息孤岛,用一套系统驱动企业增长**
|
|
10
|
+
**加速企业用户向全场景人工智能机器人转变**
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div align="center">
|
|
15
|
+
|
|
16
|
+
| 🏫 教学机构 | 👨🏫 讲师 | 📧 联系方式 | 💬 QQ群 | 📺 配套视频 |
|
|
17
|
+
|:-----------:|:--------:|:------------------:|:-----------:|:-----------------------------------:|
|
|
18
|
+
| 逸寻智库 | Job | support@huo15.com | 1093992108 | [📺 B站视频](https://space.bilibili.com/400418085) |
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# 🔔 huo15-dingtalk-connector-pro
|
|
25
|
+
|
|
26
|
+
> **作者**: 火一五信息科技有限公司
|
|
27
|
+
> **版本**: v1.0.0
|
|
28
|
+
> **参考**: [dingtalk-openclaw-connector](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector) v0.8.12
|
|
29
|
+
> **触发词**: 钉钉、钉钉连接器、dingtalk
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 一、简介
|
|
34
|
+
|
|
35
|
+
火一五定制版钉钉 OpenClaw 连接器,基于官方 dingtalk-openclaw-connector v0.8.12 定制,支持 huo15-memory-evolution 记忆系统集成和 Claude Code 能力增强。
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 二、核心特性
|
|
40
|
+
|
|
41
|
+
| 特性 | 说明 |
|
|
42
|
+
|------|------|
|
|
43
|
+
| 🤖 **记忆系统集成** | 支持 huo15-memory-evolution 记忆系统 |
|
|
44
|
+
| 💬 **AI Card 流式响应** | 打字机效果,实时流式显示回复 |
|
|
45
|
+
| 🔒 **会话持久化** | 同一用户的多轮对话共享上下文 |
|
|
46
|
+
| 🎯 **会话隔离** | 按单聊/群聊/群区分 session |
|
|
47
|
+
| ⏰ **超时自动新会话** | 默认 30 分钟无活动自动开启新对话 |
|
|
48
|
+
| 📁 **富媒体接收** | 支持 JPEG/PNG 图片、文件附件 |
|
|
49
|
+
| 🎵 **音频消息** | 支持发送多种格式音频 |
|
|
50
|
+
| 📄 **钉钉文档 API** | 支持创建、追加、搜索钉钉文档 |
|
|
51
|
+
| 🔗 **多 Agent 路由** | 支持一个连接器实例连接多个 Agent |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 三、快速开始
|
|
56
|
+
|
|
57
|
+
### 3.1 前置要求
|
|
58
|
+
|
|
59
|
+
- OpenClaw 已安装并运行
|
|
60
|
+
- 钉钉企业账号
|
|
61
|
+
|
|
62
|
+
### 3.2 安装
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 克隆仓库
|
|
66
|
+
git clone https://github.com/huo15/huo15-dingtalk-connector-pro.git
|
|
67
|
+
cd huo15-dingtalk-connector-pro
|
|
68
|
+
|
|
69
|
+
# 安装依赖
|
|
70
|
+
npm install
|
|
71
|
+
|
|
72
|
+
# 以链接模式安装
|
|
73
|
+
openclaw plugins install -l .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3.3 配置
|
|
77
|
+
|
|
78
|
+
1. 获取钉钉凭证
|
|
79
|
+
- 访问 [钉钉开放平台](https://open-dev.dingtalk.com/)
|
|
80
|
+
- 创建企业内部应用
|
|
81
|
+
- 获取 AppKey 和 AppSecret
|
|
82
|
+
|
|
83
|
+
2. 配置连接器
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 方式一:使用配置向导
|
|
87
|
+
openclaw channels add
|
|
88
|
+
|
|
89
|
+
# 方式二:直接编辑配置文件
|
|
90
|
+
# macOS: ~/.openclaw/openclaw.json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"channels": {
|
|
96
|
+
"dingtalk-connector": {
|
|
97
|
+
"enabled": true,
|
|
98
|
+
"clientId": "你的AppKey",
|
|
99
|
+
"clientSecret": "你的AppSecret"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 3.4 重启验证
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 重启 Gateway
|
|
109
|
+
openclaw gateway restart
|
|
110
|
+
|
|
111
|
+
# 检查插件状态
|
|
112
|
+
openclaw plugins list
|
|
113
|
+
|
|
114
|
+
# 查看日志
|
|
115
|
+
openclaw logs --follow
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 四、完整功能列表
|
|
121
|
+
|
|
122
|
+
### 4.1 基础功能
|
|
123
|
+
|
|
124
|
+
- **AI Card 流式响应** - 打字机效果,实时显示 AI 回复
|
|
125
|
+
- **会话管理** - 多轮对话共享上下文
|
|
126
|
+
- **会话隔离** - 按单聊/群聊/群区分 session
|
|
127
|
+
- **手动/自动会话重置** - 发送 /new 或 30分钟无活动自动新会话
|
|
128
|
+
- **图片自动上传** - 自动上传到钉钉
|
|
129
|
+
- **富媒体接收** - JPEG/PNG 图片,支持视觉模型
|
|
130
|
+
- **文件附件** - 解析 .docx, .pdf, 文本, 二进制文件
|
|
131
|
+
- **音频消息** - 支持 mp3, wav, amr, ogg 格式
|
|
132
|
+
- **钉钉文档 API** - 创建、追加、搜索、列出文档
|
|
133
|
+
- **多 Agent 路由** - 多个 bot 连接不同 agent
|
|
134
|
+
- **Markdown 表格转换** - 自动转换为钉钉兼容格式
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 五、开发计划
|
|
139
|
+
|
|
140
|
+
### 5.1 融合火一五记忆进化系统
|
|
141
|
+
|
|
142
|
+
- [ ] 将 huo15-memory-evolution 集成到钉钉连接器
|
|
143
|
+
- [ ] 实现会话记忆持久化
|
|
144
|
+
- [ ] 支持 user/feedback/project/reference 四类记忆
|
|
145
|
+
- [ ] 实现 Auto Capture 自动捕获高光时刻
|
|
146
|
+
- [ ] 实现 Dream Agent 每日日志提炼
|
|
147
|
+
|
|
148
|
+
### 5.2 融合 Claude Code 能力
|
|
149
|
+
|
|
150
|
+
- [ ] 实现 findRelevantMemories 智能记忆检索
|
|
151
|
+
- [ ] 实现 CLAUDE.md 项目级指令注入
|
|
152
|
+
- [ ] 实现 Manifest pre-inject
|
|
153
|
+
- [ ] 实现 Forked extraction 后台提取
|
|
154
|
+
- [ ] 实现 Before recommending 规范
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 六、与官方版区别
|
|
159
|
+
|
|
160
|
+
| 功能 | 官方版 | 定制版 |
|
|
161
|
+
|------|--------|--------|
|
|
162
|
+
| 基础功能 | ✅ | ✅ |
|
|
163
|
+
| 记忆系统集成 | ❌ | ✅ huo15-memory-evolution |
|
|
164
|
+
| Claude Code 能力 | ❌ | ✅ 进行中 |
|
|
165
|
+
| AI Card 流式响应 | ✅ | ✅ |
|
|
166
|
+
| 多 Agent 路由 | ✅ | ✅ |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 七、项目结构
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
huo15-dingtalk-connector-pro/
|
|
174
|
+
├── src/
|
|
175
|
+
│ ├── core/ # 核心连接器逻辑
|
|
176
|
+
│ ├── services/ # 钉钉 API 服务
|
|
177
|
+
│ ├── utils/ # 工具函数
|
|
178
|
+
│ └── types/ # TypeScript 类型定义
|
|
179
|
+
├── docs/
|
|
180
|
+
│ └── images/ # 文档图片
|
|
181
|
+
├── openclaw.plugin.json # 插件清单
|
|
182
|
+
├── package.json # npm 依赖
|
|
183
|
+
└── LICENSE
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 八、相关链接
|
|
189
|
+
|
|
190
|
+
- **官方版**: https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector
|
|
191
|
+
- **OpenClaw**: https://openclaw.ai
|
|
192
|
+
- **火一五记忆系统**: https://clawhub.ai/jobzhao15/huo15-memory-evolution
|
|
193
|
+
- **钉钉开放平台**: https://open-dev.dingtalk.com/
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
<div align="center">
|
|
198
|
+
|
|
199
|
+
**公司名称:** 青岛火一五信息科技有限公司
|
|
200
|
+
|
|
201
|
+
**联系邮箱:** postmaster@huo15.com | **QQ群:** 1093992108
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
**关注逸寻智库公众号,获取更多资讯**
|
|
206
|
+
|
|
207
|
+
<img src="https://tools.huo15.com/uploads/images/system/qrcode_yxzk.jpg" alt="逸寻智库公众号二维码" style="width: 200px; height: auto; margin: 10px 0;" />
|
|
208
|
+
|
|
209
|
+
</div>
|