@dingtalk-real-ai/dingtalk-connector 0.7.9 → 0.8.0-beta.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 +39 -6
- package/README.en.md +396 -0
- package/README.md +245 -538
- 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/index.ts +28 -0
- package/install-beta.sh +438 -0
- package/openclaw.plugin.json +2 -1
- package/package.json +19 -10
- package/src/channel.ts +559 -0
- package/src/config/accounts.ts +230 -0
- package/src/config/schema.ts +131 -0
- package/src/core/connection.ts +639 -0
- package/src/core/message-handler.ts +1246 -0
- package/src/core/provider.ts +106 -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 +444 -0
- package/src/onboarding.ts +387 -0
- package/src/policy.ts +19 -0
- package/src/probe.ts +179 -0
- package/src/reply-dispatcher.ts +661 -0
- package/src/runtime.ts +7 -0
- package/src/sdk/helpers.ts +317 -0
- package/src/sdk/types.ts +515 -0
- package/src/secret-input.ts +19 -0
- package/src/services/media/audio.ts +54 -0
- package/src/services/media/chunk-upload.ts +306 -0
- package/src/services/media/common.ts +153 -0
- package/src/services/media/file.ts +70 -0
- package/src/services/media/image.ts +67 -0
- package/src/services/media/index.ts +10 -0
- package/src/services/media/video.ts +162 -0
- package/src/services/media.ts +1133 -0
- package/src/services/messaging/card.ts +312 -0
- package/src/services/messaging/index.ts +17 -0
- package/src/services/messaging/send.ts +141 -0
- package/src/services/messaging.ts +995 -0
- package/src/targets.ts +45 -0
- package/src/types/index.ts +52 -0
- package/src/utils/agent.ts +63 -0
- package/src/utils/async.ts +51 -0
- package/src/utils/constants.ts +9 -0
- package/src/utils/http-client.ts +84 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +78 -0
- package/src/utils/session.ts +118 -0
- package/src/utils/token.ts +84 -0
- package/src/utils/utils-legacy.ts +428 -0
- package/test-dingtalk-connection.mjs +105 -0
- package/.github/workflows/ai-fix-and-test.yml +0 -518
- package/.github/workflows/issue-to-AI-table.yml +0 -52
- package/.github/workflows/issue-to-dingtalk.yml +0 -49
- package/.github/workflows/pr-review.yml +0 -108
- package/docs/RELEASE_NOTES_V0.7.2.md +0 -143
- package/docs/RELEASE_NOTES_V0.7.3.md +0 -149
- package/docs/RELEASE_NOTES_V0.7.4.md +0 -206
- package/docs/RELEASE_NOTES_V0.7.5.md +0 -267
- package/docs/RELEASE_NOTES_V0.7.6.md +0 -219
- package/docs/RELEASE_NOTES_V0.7.7.md +0 -122
- package/docs/RELEASE_NOTES_V0.7.8.md +0 -101
- package/docs/RELEASE_NOTES_V0.7.9.md +0 -65
- package/docs/RELEASE_NOTES_v0.7.0.md +0 -142
- package/docs/RELEASE_NOTES_v0.7.1.md +0 -74
- package/plugin.ts +0 -4146
- package/tests/README.md +0 -54
- package/tests/ai-card/PLAN.md +0 -54
- package/tests/ai-card/ai-card.test.ts +0 -372
- package/tests/audio/PLAN.md +0 -64
- package/tests/audio/audio.test.ts +0 -283
- package/tests/bindings/PLAN.md +0 -99
- package/tests/bindings/bindings.test.ts +0 -191
- package/tests/card-update/PLAN.md +0 -29
- package/tests/card-update/card-update.test.ts +0 -127
- package/tests/config-token/PLAN.md +0 -94
- package/tests/config-token/config-token.test.ts +0 -153
- package/tests/core/PLAN.md +0 -65
- package/tests/core/core.test.ts +0 -286
- package/tests/deliver-payload/PLAN.md +0 -59
- package/tests/deliver-payload/deliver-payload.test.ts +0 -91
- package/tests/download/PLAN.md +0 -47
- package/tests/download/download.test.ts +0 -261
- package/tests/file-markers/PLAN.md +0 -74
- package/tests/file-markers/file-markers.test.ts +0 -105
- package/tests/index.ts +0 -129
- package/tests/integration/PLAN.md +0 -65
- package/tests/integration/integration.test.ts +0 -232
- package/tests/mcp-tools/PLAN.md +0 -67
- package/tests/mcp-tools/mcp-tools.test.ts +0 -327
- package/tests/media/PLAN.md +0 -37
- package/tests/media/media.test.ts +0 -50
- package/tests/message-extract/PLAN.md +0 -83
- package/tests/message-extract/message-extract.test.ts +0 -205
- package/tests/proactive/PLAN.md +0 -88
- package/tests/proactive/proactive.test.ts +0 -502
- package/tests/prompts/PLAN.md +0 -71
- package/tests/prompts/prompts.test.ts +0 -64
- package/tests/send-message/PLAN.md +0 -44
- package/tests/send-message/send-message.test.ts +0 -228
- package/tests/session/PLAN.md +0 -90
- package/tests/session/session.test.ts +0 -166
- package/tests/upload/PLAN.md +0 -72
- package/tests/upload/upload.test.ts +0 -390
- package/tests/video/PLAN.md +0 -118
- package/tests/video/video.test.ts +0 -40
- package/vitest.config.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
版本号遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
and
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.7.10] - 2026-03-16
|
|
9
|
+
|
|
10
|
+
### 新增 / Added
|
|
11
|
+
- ✨ **WebSocket 心跳重连机制优化** - 关闭 DWClient 的 `autoConnect`,采用应用层自动重连机制(修复 DWClient 重连 bug);添加指数退避重连策略,避免雪崩效应;使用 WebSocket 原生 Ping 进行心跳检测
|
|
12
|
+
**WebSocket heartbeat & reconnect optimization** - Disabled DWClient's `autoConnect`, implemented app-layer auto-reconnect (fixing DWClient bug); added exponential backoff to avoid avalanche; using WebSocket native Ping for heartbeat
|
|
13
|
+
- ✨ **socket-manager 模块** - 新增模块统一管理 WebSocket 连接生命周期,包括心跳检测、自动重连、指数退避、事件监听等
|
|
14
|
+
**socket-manager module** - New module for unified WebSocket connection lifecycle management, including heartbeat, auto-reconnect, exponential backoff, event listening
|
|
15
|
+
- ✨ **debug 参数** - 添加 `debug` 配置项控制详细日志输出,便于问题排查
|
|
16
|
+
**debug parameter** - Added `debug` config to control detailed log output for easier troubleshooting
|
|
17
|
+
- ✨ **WebSocket 无限重连机制** - 移除最大重连次数限制,实现无限重连,确保长连接服务的高可用性
|
|
18
|
+
**WebSocket infinite reconnection** - Removed maximum reconnection attempt limit, implemented infinite reconnection to ensure high availability for long-lived connection services
|
|
19
|
+
|
|
20
|
+
### 修复 / Fixes
|
|
21
|
+
- 🐛 **修复 DWClient 重连 bug** - DWClient 内置重连机制存在缺陷,通过应用层重连机制替代,确保连接稳定可靠
|
|
22
|
+
**Fixed DWClient reconnect bug** - DWClient's built-in reconnect has defects; replaced with app-layer reconnect for stable connection
|
|
23
|
+
- 🐛 **长连接静默断开** - 通过应用层心跳检测连接活性,超时后主动重连,减少因长时间无数据导致的静默断连且无法恢复
|
|
24
|
+
**Long-lived connection silent disconnect** - App-layer heartbeat detects liveness and triggers reconnect on timeout, reducing silent disconnects when idle
|
|
25
|
+
### 改进 / Improvements
|
|
26
|
+
- ✅ **DWClient 配置** - 设置 `autoReconnect: false`、`keepAlive: false`,由应用层接管重连和心跳,避免与钉钉服务端策略冲突
|
|
27
|
+
**DWClient config** - Set `autoReconnect: false`, `keepAlive: false`; app-layer takes over reconnect and heartbeat to avoid server conflicts
|
|
28
|
+
- ✅ **指数退避策略** - 公式 `baseBackoffDelay * Math.pow(2, attempt) + jitter(0-1s)`,最大退避 30 秒,避免雪崩效应
|
|
29
|
+
**Exponential backoff strategy** - Formula `baseBackoffDelay * Math.pow(2, attempt) + jitter(0-1s)`, max 30s backoff to avoid avalanche effect
|
|
30
|
+
- ✅ **统一事件监听** - `pong`、`message`、`close`、`open` 四个事件统一管理和清理,提升代码可维护性
|
|
31
|
+
**Unified event listening** - `pong`, `message`, `close`, `open` events managed and cleaned up uniformly, improving maintainability
|
|
32
|
+
- ✅ **配置简化** - 从 `SocketManagerConfig` 中移除 `maxReconnectAttempts` 配置项,简化配置复杂度
|
|
33
|
+
**Configuration simplification** - Removed `maxReconnectAttempts` from `SocketManagerConfig`, simplifying configuration
|
|
34
|
+
- ✅ **日志输出优化** - 更新重连日志格式,移除最大次数显示(从 "尝试 X/5" 改为 "尝试 X")
|
|
35
|
+
**Log output optimization** - Updated reconnection log format, removed maximum attempt display (from "attempt X/5" to "attempt X")
|
|
36
|
+
|
|
37
|
+
### 技术细节 / Technical Details
|
|
38
|
+
- **退避策略**:指数退避 + 随机抖动,公式 `baseBackoffDelay * Math.pow(2, attempt) + jitter(0-1s)`
|
|
39
|
+
- **最大退避**:30 秒(由 `maxBackoffDelay` 限制)
|
|
40
|
+
- **重置条件**:重连成功后 `reconnectAttempts` 归零
|
|
41
|
+
- **立即重连**:心跳检测失败、WebSocket close、disconnect 消息触发时立即重连,不退避
|
|
8
42
|
|
|
9
43
|
## [0.7.9] - 2026-03-13
|
|
10
44
|
|
|
@@ -243,5 +277,4 @@ and version numbers follow [Semantic Versioning](https://semver.org/).
|
|
|
243
277
|
- 新增"多 Agent 配置"章节,提供详细的配置示例和说明
|
|
244
278
|
Added "Multi-Agent Configuration" section with detailed configuration examples and instructions
|
|
245
279
|
- 补充常见问题解答
|
|
246
|
-
Added FAQ section
|
|
247
|
-
|
|
280
|
+
Added FAQ section
|
package/README.en.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
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
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
Before you begin, ensure you have:
|
|
29
|
+
|
|
30
|
+
> This connector is used as an OpenClaw Gateway plugin, and you usually don't need to install or manage Node.js runtime by yourself.
|
|
31
|
+
|
|
32
|
+
### 1. OpenClaw Gateway
|
|
33
|
+
|
|
34
|
+
- **Official Website**: https://openclaw.ai/
|
|
35
|
+
- **Installation**: Follow the official guide to install OpenClaw
|
|
36
|
+
- **Verify installation**:
|
|
37
|
+
```bash
|
|
38
|
+
openclaw gateway status
|
|
39
|
+
```
|
|
40
|
+
Expected output: `✓ Gateway is running on http://127.0.0.1:18789`
|
|
41
|
+
|
|
42
|
+
### 2. DingTalk Enterprise Account
|
|
43
|
+
|
|
44
|
+
- You need a DingTalk enterprise account to create internal applications
|
|
45
|
+
- Official Website: https://www.dingtalk.com/
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
> 💡 **Goal**: Get your DingTalk bot working in ~5 minutes
|
|
52
|
+
|
|
53
|
+
### Operating System Support
|
|
54
|
+
|
|
55
|
+
- macOS / Linux: Use the default shell (zsh, bash, etc.).
|
|
56
|
+
- Windows:
|
|
57
|
+
- Recommended: **PowerShell** or **Windows Terminal**.
|
|
58
|
+
- OpenClaw config file path (default): `C:\Users\<YourUserName>\.openclaw\openclaw.json`.
|
|
59
|
+
|
|
60
|
+
Whenever you see `~/.openclaw/openclaw.json` below, it is equivalent to the above path on Windows.
|
|
61
|
+
|
|
62
|
+
### Step 1: Install the Plugin
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Recommended: Install from npm
|
|
66
|
+
openclaw plugins install @dingtalk-real-ai/dingtalk-connector
|
|
67
|
+
|
|
68
|
+
# Alternative: Install from Git
|
|
69
|
+
openclaw plugins install https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Verify installation**:
|
|
73
|
+
```bash
|
|
74
|
+
openclaw plugins list
|
|
75
|
+
```
|
|
76
|
+
You should see `✓ DingTalk Channel (v0.8.0) - loaded`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Step 2: Create a DingTalk Bot
|
|
81
|
+
|
|
82
|
+
#### 2.1 Create Application
|
|
83
|
+
|
|
84
|
+
1. Go to [DingTalk Open Platform](https://open-dev.dingtalk.com/)
|
|
85
|
+
2. Click **"Application Development"**
|
|
86
|
+
|
|
87
|
+

|
|
88
|
+
|
|
89
|
+
#### 2.2 Add Bot Capability
|
|
90
|
+
|
|
91
|
+
1. On the application details page, use the “one-click OpenClaw bot app” flow
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
#### 2.3 Get Credentials
|
|
96
|
+
|
|
97
|
+
1. Finish creation and open **"Credentials & Basic Info"**
|
|
98
|
+
2. Copy your **AppKey** (Client ID)
|
|
99
|
+
3. Copy your **AppSecret** (Client Secret)
|
|
100
|
+
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+

|
|
104
|
+
|
|
105
|
+
> ⚠️ **Important**: Client ID and Client Secret are your bot’s unique credentials. Store them safely.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### Step 3: Configure OpenClaw
|
|
110
|
+
|
|
111
|
+
You have three options to configure the connector:
|
|
112
|
+
|
|
113
|
+
#### Option A: Configuration Wizard (Recommended for Beginners)
|
|
114
|
+
|
|
115
|
+
> You can directly copy and paste the following command into your terminal to run the configuration wizard.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
openclaw channels add
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Select **"DingTalk (钉钉)"** and follow the prompts to enter:
|
|
122
|
+
- `clientId` (AppKey)
|
|
123
|
+
- `clientSecret` (AppSecret)
|
|
124
|
+
|
|
125
|
+
#### Option B: Edit Configuration File
|
|
126
|
+
|
|
127
|
+
Edit the configuration file:
|
|
128
|
+
|
|
129
|
+
- macOS / Linux: `~/.openclaw/openclaw.json`
|
|
130
|
+
- Windows: `C:\Users\<YourUserName>\.openclaw\openclaw.json`
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"channels": {
|
|
135
|
+
"dingtalk-connector": {
|
|
136
|
+
"enabled": true,
|
|
137
|
+
"clientId": "dingxxxxxxxxx",
|
|
138
|
+
"clientSecret": "your_app_secret"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> 💡 **Tip**: If the file already has content, add the `dingtalk-connector` section under the `channels` node.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### Step 4: Restart and Test
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Restart OpenClaw Gateway
|
|
152
|
+
openclaw gateway restart
|
|
153
|
+
|
|
154
|
+
# Watch logs in real-time
|
|
155
|
+
openclaw logs --follow
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Test your bot**:
|
|
159
|
+
1. Open DingTalk app
|
|
160
|
+
2. Find your bot in the contact list
|
|
161
|
+
3. Send a message: `Hello`
|
|
162
|
+
4. You should receive a response within 10 seconds
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Features
|
|
167
|
+
|
|
168
|
+
### ✅ Core Features
|
|
169
|
+
|
|
170
|
+
- **AI Card Streaming** - Typewriter-like replies with real-time streaming
|
|
171
|
+
- **Session Management** - Multi-turn conversations with context preservation
|
|
172
|
+
- **Session Isolation** - Separate sessions for DMs, groups, and different groups
|
|
173
|
+
- **Auto Session Reset** - Automatic new session after 30 minutes of inactivity
|
|
174
|
+
- **Manual Session Reset** - Send `/new` or `新会话` to clear conversation history
|
|
175
|
+
- **Image Auto-Upload** - Local image paths automatically uploaded to DingTalk
|
|
176
|
+
- **Proactive Messaging** - Send messages to users or groups programmatically
|
|
177
|
+
- **Rich Media Reception** - Receive and process JPEG/PNG images, pass to vision models
|
|
178
|
+
- **File Attachment Extraction** - Parse .docx, .pdf, text files, and binary files
|
|
179
|
+
- **Audio Message Support** - Send audio messages in multiple formats (mp3, wav, amr, ogg)
|
|
180
|
+
- **DingTalk Docs API** - Create, append, search, and list DingTalk documents
|
|
181
|
+
- **Multi-Agent Routing** - Connect multiple bots to different agents for specialized services
|
|
182
|
+
- **Markdown Table Conversion** - Auto-convert Markdown tables to DingTalk-compatible format
|
|
183
|
+
- **Async Mode** - Immediate acknowledgment with background processing (optional)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Configuration
|
|
188
|
+
|
|
189
|
+
### Basic Configuration
|
|
190
|
+
|
|
191
|
+
| Option | Environment Variable | Description |
|
|
192
|
+
|--------|---------------------|-------------|
|
|
193
|
+
| `clientId` | — | DingTalk AppKey |
|
|
194
|
+
| `clientSecret` | — | DingTalk AppSecret |
|
|
195
|
+
|
|
196
|
+
### Session Management
|
|
197
|
+
|
|
198
|
+
| Option | Default | Description |
|
|
199
|
+
|--------|---------|-------------|
|
|
200
|
+
| `separateSessionByConversation` | `true` | Separate sessions for DMs/groups |
|
|
201
|
+
| `groupSessionScope` | `group` | Group session scope: `group` (shared) or `group_sender` (per-user) |
|
|
202
|
+
| `sharedMemoryAcrossConversations` | `false` | Share memory across different conversations |
|
|
203
|
+
|
|
204
|
+
### Session routing policies (`pmpolicy` / `groupPolicy`)
|
|
205
|
+
|
|
206
|
+
Both session routing/message policy options (including `pmpolicy` and `groupPolicy`) are supported now, so you **do not need to remove** them from existing configurations.
|
|
207
|
+
|
|
208
|
+
> 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`).
|
|
209
|
+
|
|
210
|
+
### Async Mode
|
|
211
|
+
|
|
212
|
+
| Option | Default | Description |
|
|
213
|
+
|--------|---------|-------------|
|
|
214
|
+
| `asyncMode` | `false` | Enable async mode for long-running tasks |
|
|
215
|
+
| `ackText` | `🫡 任务已接收,处理中...` | Acknowledgment message text |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Troubleshooting
|
|
220
|
+
|
|
221
|
+
### Bot Not Responding
|
|
222
|
+
|
|
223
|
+
**Symptoms**: Bot doesn't reply to messages
|
|
224
|
+
|
|
225
|
+
**Solutions**:
|
|
226
|
+
1. Check plugin status: `openclaw plugins list`
|
|
227
|
+
2. Check gateway status: `openclaw gateway status`
|
|
228
|
+
3. Check logs: `openclaw logs --follow`
|
|
229
|
+
4. Verify the app is published/enabled in DingTalk Open Platform
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### HTTP 401 Error
|
|
234
|
+
|
|
235
|
+
**Symptoms**: Error message shows "401 Unauthorized"
|
|
236
|
+
|
|
237
|
+
**Solution**: Upgrade to the latest version.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### Stream Connection 400 Error
|
|
242
|
+
|
|
243
|
+
**Symptoms**: Logs show "Request failed with status code 400"
|
|
244
|
+
|
|
245
|
+
**Common Causes**:
|
|
246
|
+
|
|
247
|
+
| Cause | Solution |
|
|
248
|
+
|-------|----------|
|
|
249
|
+
| App not published | DingTalk Open Platform → Version Management → Publish |
|
|
250
|
+
| Invalid credentials | Check `clientId`/`clientSecret` for typos or extra spaces |
|
|
251
|
+
| Not Stream mode | Verify bot is configured for Stream mode (not Webhook) |
|
|
252
|
+
| IP whitelist | Check if the app has IP whitelist restrictions |
|
|
253
|
+
|
|
254
|
+
**Verification Steps**:
|
|
255
|
+
1. Check app status in [DingTalk Open Platform](https://open-dev.dingtalk.com/)
|
|
256
|
+
2. After any configuration change, click **Save** → **Publish**
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Advanced Topics
|
|
261
|
+
|
|
262
|
+
### Multi-Agent Configuration
|
|
263
|
+
|
|
264
|
+
Configure multiple bots connected to different agents:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"channels": {
|
|
269
|
+
"dingtalk-connector": {
|
|
270
|
+
"enabled": true,
|
|
271
|
+
"accounts": {
|
|
272
|
+
"bot1": {
|
|
273
|
+
"enabled": true,
|
|
274
|
+
"clientId": "ding_bot1_app_key",
|
|
275
|
+
"clientSecret": "bot1_secret"
|
|
276
|
+
},
|
|
277
|
+
"bot2": {
|
|
278
|
+
"enabled": true,
|
|
279
|
+
"clientId": "ding_bot2_app_key",
|
|
280
|
+
"clientSecret": "bot2_secret"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"bindings": [
|
|
286
|
+
{
|
|
287
|
+
"agentId": "ding-bot1",
|
|
288
|
+
"match": {
|
|
289
|
+
"channel": "dingtalk-connector",
|
|
290
|
+
"accountId": "bot1"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"agentId": "ding-bot2",
|
|
295
|
+
"match": {
|
|
296
|
+
"channel": "dingtalk-connector",
|
|
297
|
+
"accountId": "bot2"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
For more details, see [OpenClaw Multi-Agent Configuration Guide](https://gist.github.com/smallnest/c5c13482740fd179e40070e620f66a52).
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
### Session Commands
|
|
309
|
+
|
|
310
|
+
Users can send the following commands to start a fresh session:
|
|
311
|
+
|
|
312
|
+
- `/new`, `/reset`, `/clear`
|
|
313
|
+
- `新会话`, `重新开始`, `清空对话`
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### DingTalk Docs via MCP (`docs.*`)
|
|
318
|
+
|
|
319
|
+
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.
|
|
320
|
+
|
|
321
|
+
- **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.
|
|
322
|
+
- **Where to configure**: usually at the **Gateway or Agent tool configuration** level (not in this connector).
|
|
323
|
+
- **How it takes effect**: restart the Gateway and ensure the tool is exposed to the target agent.
|
|
324
|
+
|
|
325
|
+
References (OpenClaw configuration docs):
|
|
326
|
+
- `https://docs.openclaw.ai/configuration`
|
|
327
|
+
- `https://docs.openclaw.ai/gateway/configuration-reference`
|
|
328
|
+
|
|
329
|
+
Create and manage DingTalk documents from your agent:
|
|
330
|
+
|
|
331
|
+
```javascript
|
|
332
|
+
// Create document
|
|
333
|
+
dingtalk-connector.docs.create({
|
|
334
|
+
spaceId: "your-space-id",
|
|
335
|
+
title: "Test Document",
|
|
336
|
+
content: "# Test Content"
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
// Append content
|
|
340
|
+
dingtalk-connector.docs.append({
|
|
341
|
+
docId: "your-doc-id",
|
|
342
|
+
markdownContent: "\n## Appended Content"
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
// Search documents
|
|
346
|
+
dingtalk-connector.docs.search({
|
|
347
|
+
keyword: "search keyword"
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
// List documents
|
|
351
|
+
dingtalk-connector.docs.list({
|
|
352
|
+
spaceId: "your-space-id"
|
|
353
|
+
})
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Project Structure
|
|
359
|
+
|
|
360
|
+
```
|
|
361
|
+
dingtalk-openclaw-connector/
|
|
362
|
+
├── src/
|
|
363
|
+
│ ├── core/ # Core connector logic
|
|
364
|
+
│ ├── services/ # DingTalk API services
|
|
365
|
+
│ ├── utils/ # Utility functions
|
|
366
|
+
│ └── types/ # TypeScript type definitions
|
|
367
|
+
├── docs/
|
|
368
|
+
│ └── images/ # Documentation images
|
|
369
|
+
├── openclaw.plugin.json # Plugin manifest
|
|
370
|
+
├── package.json # npm dependencies
|
|
371
|
+
└── LICENSE
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Dependencies
|
|
377
|
+
|
|
378
|
+
| Package | Purpose |
|
|
379
|
+
|---------|---------|
|
|
380
|
+
| `dingtalk-stream` | DingTalk Stream protocol client |
|
|
381
|
+
| `axios` | HTTP client |
|
|
382
|
+
| `mammoth` | Word document (.docx) parsing |
|
|
383
|
+
| `pdf-parse` | PDF document parsing |
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## License
|
|
388
|
+
|
|
389
|
+
[MIT](LICENSE)
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Support
|
|
394
|
+
|
|
395
|
+
- **Issues**: [GitHub Issues](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues)
|
|
396
|
+
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|