@superbenxxxh/feishu 2.0.0 → 3.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/README.md +423 -322
- package/index.ts +21 -13
- package/openclaw.plugin.json +10 -9
- package/package.json +2 -1
- package/src/bot.ts +35 -21
- package/src/channel.ts +13 -2
- package/src/config-schema.ts +31 -11
- package/src/doc-schema.ts +47 -0
- package/src/docx.ts +506 -0
- package/src/drive-schema.ts +46 -0
- package/src/drive.ts +201 -0
- package/src/perm-schema.ts +52 -0
- package/src/perm.ts +160 -0
- package/src/tools-config.ts +21 -0
- package/src/types.ts +13 -5
- package/src/wiki-schema.ts +55 -0
- package/src/wiki.ts +218 -0
package/README.md
CHANGED
|
@@ -1,339 +1,440 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Feishu/Lark (飞书) channel plugin for [OpenClaw](https://github.com/openclaw/openclaw).
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
####
|
|
43
|
-
|
|
44
|
-
| Permission | Scope | Description |
|
|
45
|
-
|------------|-------|-------------|
|
|
46
|
-
| `
|
|
47
|
-
| `im:message
|
|
48
|
-
| `im:message:
|
|
49
|
-
| `im:message:
|
|
50
|
-
| `im:message
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
# clawdbot-feishu
|
|
2
|
+
|
|
3
|
+
Feishu/Lark (飞书) channel plugin for [OpenClaw](https://github.com/openclaw/openclaw).
|
|
4
|
+
|
|
5
|
+
This fork adds:
|
|
6
|
+
- Better Markdown rendering (post/card modes + auto detection)
|
|
7
|
+
- Feishu Docs / Drive / Wiki / Permission tools
|
|
8
|
+
- Built-in skills to guide tool usage
|
|
9
|
+
|
|
10
|
+
[English](#english) | [中文](#中文)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
openclaw plugins install @superbenxxxh/feishu
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or install via npm:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @superbenxxxh/feishu
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Local dev install:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
openclaw plugins install .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Configuration
|
|
35
|
+
|
|
36
|
+
1. Create a self-built app on [Feishu Open Platform](https://open.feishu.cn)
|
|
37
|
+
2. Get your App ID and App Secret from the Credentials page
|
|
38
|
+
3. Enable required permissions (see below)
|
|
39
|
+
4. **Configure event subscriptions** (see below) ⚠️ Important
|
|
40
|
+
5. Configure the plugin
|
|
41
|
+
|
|
42
|
+
#### Required Permissions (Messaging)
|
|
43
|
+
|
|
44
|
+
| Permission | Scope | Description |
|
|
45
|
+
|------------|-------|-------------|
|
|
46
|
+
| `contact:user.base:readonly` | User info | Get basic user info (required to resolve sender display names for speaker attribution) |
|
|
47
|
+
| `im:message` | Messaging | Send and receive messages |
|
|
48
|
+
| `im:message.p2p_msg:readonly` | DM | Read direct messages to bot |
|
|
49
|
+
| `im:message.group_at_msg:readonly` | Group | Receive @mention messages in groups |
|
|
50
|
+
| `im:message:send_as_bot` | Send | Send messages as the bot |
|
|
51
|
+
| `im:resource` | Media | Upload and download images/files |
|
|
52
|
+
|
|
53
|
+
#### Optional Permissions (Messaging)
|
|
54
|
+
|
|
55
|
+
| Permission | Scope | Description |
|
|
56
|
+
|------------|-------|-------------|
|
|
57
|
+
| `im:message.group_msg` | Group | Read all group messages (sensitive) |
|
|
58
|
+
| `im:message:readonly` | Read | Get message history |
|
|
59
|
+
| `im:message:update` | Edit | Update/edit sent messages |
|
|
60
|
+
| `im:message:recall` | Recall | Recall sent messages |
|
|
61
|
+
| `im:message.reactions:read` | Reactions | View message reactions |
|
|
62
|
+
|
|
63
|
+
#### Optional Permissions (Docs / Drive / Wiki)
|
|
64
|
+
|
|
65
|
+
| Feature | Required Permissions |
|
|
66
|
+
|---------|----------------------|
|
|
67
|
+
| Feishu Docs (`feishu_doc`) | `docx:document`, `docx:document:readonly`, `docx:document.block:convert`, `drive:drive` |
|
|
68
|
+
| Feishu Drive (`feishu_drive`) | `drive:drive` (full) or `drive:drive:readonly` (read only) |
|
|
69
|
+
| Feishu Wiki (`feishu_wiki`) | `wiki:wiki` or `wiki:wiki:readonly` |
|
|
70
|
+
| Permissions tool (`feishu_perm`) | `drive:permission` |
|
|
71
|
+
|
|
72
|
+
#### Event Subscriptions ⚠️
|
|
73
|
+
|
|
74
|
+
> **This is the most commonly missed configuration!** If the bot can send messages but cannot receive them, check this section.
|
|
75
|
+
|
|
76
|
+
In the Feishu Open Platform console, go to **Events & Callbacks**:
|
|
77
|
+
|
|
78
|
+
1. **Event configuration**: Select **Long connection** (recommended)
|
|
79
|
+
2. **Add event subscriptions**:
|
|
80
|
+
|
|
81
|
+
| Event | Description |
|
|
82
|
+
|-------|-------------|
|
|
83
|
+
| `im.message.receive_v1` | Receive messages (required) |
|
|
84
|
+
| `im.message.message_read_v1` | Message read receipts |
|
|
85
|
+
| `im.chat.member.bot.added_v1` | Bot added to group |
|
|
86
|
+
| `im.chat.member.bot.deleted_v1` | Bot removed from group |
|
|
87
|
+
|
|
88
|
+
3. Ensure the event permissions are approved
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
openclaw config set channels.feishu.appId "cli_xxxxx"
|
|
92
|
+
openclaw config set channels.feishu.appSecret "your_app_secret"
|
|
93
|
+
openclaw config set channels.feishu.enabled true
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Configuration Options
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
channels:
|
|
100
|
+
feishu:
|
|
101
|
+
enabled: true
|
|
102
|
+
appId: "cli_xxxxx"
|
|
103
|
+
appSecret: "secret"
|
|
104
|
+
# Domain: "feishu" (China) or "lark" (International)
|
|
105
|
+
domain: "feishu"
|
|
106
|
+
# Connection mode: "websocket" (recommended) or "webhook"
|
|
107
|
+
connectionMode: "websocket"
|
|
108
|
+
# DM policy: "pairing" | "open" | "allowlist"
|
|
109
|
+
dmPolicy: "pairing"
|
|
110
|
+
# Group policy: "open" | "allowlist" | "disabled"
|
|
111
|
+
groupPolicy: "allowlist"
|
|
112
|
+
# Require @mention in groups
|
|
113
|
+
requireMention: true
|
|
114
|
+
# Max media size in MB (default: 30)
|
|
115
|
+
mediaMaxMb: 30
|
|
96
116
|
# Render mode for bot replies: "post" | "auto" | "raw" | "card"
|
|
97
117
|
renderMode: "post"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
118
|
+
# Tool toggles
|
|
119
|
+
tools:
|
|
120
|
+
doc: true
|
|
121
|
+
wiki: true
|
|
122
|
+
drive: true
|
|
123
|
+
perm: false
|
|
124
|
+
scopes: true
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Render Mode
|
|
128
|
+
|
|
102
129
|
| Mode | Description |
|
|
103
130
|
|------|-------------|
|
|
104
131
|
| `post` | (Default) Send replies as rich text posts using `msg_type=post` + `tag=md`. |
|
|
105
132
|
| `auto` | Automatically detect: use card for messages with code blocks or tables, plain text otherwise. |
|
|
106
133
|
| `raw` | Always send replies as plain text. Markdown tables are converted to ASCII. |
|
|
107
134
|
| `card` | Always send replies as interactive cards with full markdown rendering (syntax highlighting, tables, clickable links). |
|
|
108
|
-
|
|
109
|
-
###
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
135
|
+
|
|
136
|
+
### Tools & Skills
|
|
137
|
+
|
|
138
|
+
This plugin registers tools and ships built-in skills (loaded via `openclaw.plugin.json`) so the model can use them reliably:
|
|
139
|
+
|
|
140
|
+
| Tool | Purpose |
|
|
141
|
+
|------|---------|
|
|
142
|
+
| `feishu_doc` | Read/write Feishu Docs (docx), append content, list/update/delete blocks |
|
|
143
|
+
| `feishu_drive` | List/move/delete files and folders in Feishu Drive |
|
|
144
|
+
| `feishu_wiki` | Browse and manage wiki spaces/nodes |
|
|
145
|
+
| `feishu_perm` | Manage file/document permissions (disabled by default) |
|
|
146
|
+
| `feishu_app_scopes` | Inspect granted app scopes |
|
|
147
|
+
|
|
148
|
+
Notes:
|
|
149
|
+
- Wiki content is edited via `feishu_doc` (wiki → get node → use `obj_token` as doc token).
|
|
150
|
+
- Feishu Docs do **not** support Markdown tables via the convert API.
|
|
151
|
+
- Drive root folder may be unavailable to bots; share a folder with the bot first, then operate inside it.
|
|
152
|
+
|
|
153
|
+
### Features
|
|
154
|
+
|
|
155
|
+
- WebSocket and Webhook connection modes
|
|
156
|
+
- Direct messages and group chats
|
|
157
|
+
- Message replies and quoted message context
|
|
158
|
+
- **Inbound media support**: AI can see images, read files (PDF, Excel, etc.), and process rich text with embedded images
|
|
159
|
+
- Image and file uploads (outbound)
|
|
160
|
+
- Typing indicator (via emoji reactions)
|
|
161
|
+
- Pairing flow for DM approval
|
|
162
|
+
- User and group directory lookup
|
|
163
|
+
- **Card render mode**: Optional markdown rendering with syntax highlighting
|
|
164
|
+
- **@mention forwarding**: When you @mention someone in your message, the bot's reply will automatically @mention them too
|
|
165
|
+
- **Cloud docs & wiki tools**: Read/write docx, navigate wiki, manage drive
|
|
166
|
+
|
|
167
|
+
#### @Mention Forwarding
|
|
168
|
+
|
|
169
|
+
When you want the bot to @mention someone in its reply, simply @mention them in your message:
|
|
170
|
+
|
|
171
|
+
- **In DM**: `@张三 say hello` → Bot replies with `@张三 Hello!`
|
|
172
|
+
- **In Group**: `@bot @张三 say hello` → Bot replies with `@张三 Hello!`
|
|
173
|
+
|
|
174
|
+
The bot automatically detects @mentions in your message and includes them in its reply. No extra permissions required beyond the standard messaging permissions.
|
|
175
|
+
|
|
176
|
+
### FAQ
|
|
177
|
+
|
|
178
|
+
#### Bot cannot receive messages
|
|
179
|
+
|
|
180
|
+
Check the following:
|
|
181
|
+
1. Have you configured **event subscriptions**? (See Event Subscriptions section)
|
|
182
|
+
2. Is the event configuration set to **long connection**?
|
|
183
|
+
3. Did you add the `im.message.receive_v1` event?
|
|
184
|
+
4. Are the permissions approved?
|
|
185
|
+
|
|
186
|
+
#### 403 error when sending messages
|
|
187
|
+
|
|
188
|
+
Ensure `im:message:send_as_bot` permission is approved.
|
|
189
|
+
|
|
190
|
+
#### Drive actions fail with 400 or empty root
|
|
191
|
+
|
|
192
|
+
Bots do not have a personal root folder. Share a folder with the bot, then operate inside that folder.
|
|
193
|
+
|
|
194
|
+
#### Docx write cannot create tables
|
|
195
|
+
|
|
196
|
+
The docx convert API does not support Markdown tables. Use plain lists or manual tables instead.
|
|
197
|
+
|
|
198
|
+
#### How to clear history / start new conversation
|
|
199
|
+
|
|
200
|
+
Send `/new` command in the chat.
|
|
201
|
+
|
|
202
|
+
#### Why is the output not streaming
|
|
203
|
+
|
|
204
|
+
Feishu API has rate limits. Streaming updates can easily trigger throttling. We use complete-then-send approach for stability.
|
|
205
|
+
|
|
206
|
+
#### Windows install error `spawn npm ENOENT`
|
|
207
|
+
|
|
208
|
+
If `openclaw plugins install` fails, install manually:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# 1. Download the package
|
|
212
|
+
curl -O https://registry.npmjs.org/@superbenxxxh/feishu/-/feishu-VERSION.tgz
|
|
213
|
+
|
|
214
|
+
# 2. Install from local file
|
|
215
|
+
openclaw plugins install ./feishu-VERSION.tgz
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### Cannot find the bot in Feishu
|
|
219
|
+
|
|
220
|
+
1. Ensure the app is published (at least to test version)
|
|
221
|
+
2. Search for the bot name in Feishu search box
|
|
222
|
+
3. Check if your account is in the app's availability scope
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 中文
|
|
227
|
+
|
|
228
|
+
### 安装
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
openclaw plugins install @superbenxxxh/feishu
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
或通过 npm 安装:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm install @superbenxxxh/feishu
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
本地开发安装:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
openclaw plugins install .
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 配置
|
|
247
|
+
|
|
248
|
+
1. 在 [飞书开放平台](https://open.feishu.cn) 创建自建应用
|
|
249
|
+
2. 在凭证页面获取 App ID 和 App Secret
|
|
250
|
+
3. 开启所需权限(见下方)
|
|
251
|
+
4. **配置事件订阅**(见下方)⚠️ 重要
|
|
252
|
+
5. 配置插件
|
|
253
|
+
|
|
254
|
+
#### 必需权限(消息)
|
|
255
|
+
|
|
256
|
+
| 权限 | 范围 | 说明 |
|
|
257
|
+
|------|------|------|
|
|
258
|
+
| `contact:user.base:readonly` | 用户信息 | 获取用户基本信息(用于解析发送者姓名,避免群聊/私聊把不同人当成同一说话者) |
|
|
259
|
+
| `im:message` | 消息 | 发送和接收消息 |
|
|
260
|
+
| `im:message.p2p_msg:readonly` | 私聊 | 读取发给机器人的私聊消息 |
|
|
261
|
+
| `im:message.group_at_msg:readonly` | 群聊 | 接收群内 @机器人 的消息 |
|
|
262
|
+
| `im:message:send_as_bot` | 发送 | 以机器人身份发送消息 |
|
|
263
|
+
| `im:resource` | 媒体 | 上传和下载图片/文件 |
|
|
264
|
+
|
|
265
|
+
#### 可选权限(消息)
|
|
266
|
+
|
|
267
|
+
| 权限 | 范围 | 说明 |
|
|
268
|
+
|------|------|------|
|
|
269
|
+
| `im:message.group_msg` | 群聊 | 读取所有群消息(敏感) |
|
|
270
|
+
| `im:message:readonly` | 读取 | 获取历史消息 |
|
|
271
|
+
| `im:message:update` | 编辑 | 更新/编辑已发送消息 |
|
|
272
|
+
| `im:message:recall` | 撤回 | 撤回已发送消息 |
|
|
273
|
+
| `im:message.reactions:read` | 表情 | 查看消息表情回复 |
|
|
274
|
+
|
|
275
|
+
#### 可选权限(文档 / 云盘 / 知识库)
|
|
276
|
+
|
|
277
|
+
| 功能 | 所需权限 |
|
|
278
|
+
|------|-----------|
|
|
279
|
+
| 文档工具 `feishu_doc` | `docx:document`, `docx:document:readonly`, `docx:document.block:convert`, `drive:drive` |
|
|
280
|
+
| 云盘工具 `feishu_drive` | `drive:drive`(读写)或 `drive:drive:readonly`(只读) |
|
|
281
|
+
| 知识库工具 `feishu_wiki` | `wiki:wiki` 或 `wiki:wiki:readonly` |
|
|
282
|
+
| 权限工具 `feishu_perm` | `drive:permission` |
|
|
283
|
+
|
|
284
|
+
#### 事件订阅 ⚠️
|
|
285
|
+
|
|
286
|
+
> **这是最容易遗漏的配置!** 如果机器人能发消息但收不到消息,请检查此项。
|
|
287
|
+
|
|
288
|
+
在飞书开放平台的应用后台,进入 **事件与回调** 页面:
|
|
289
|
+
|
|
290
|
+
1. **事件配置方式**:选择 **使用长连接接收事件**(推荐)
|
|
291
|
+
2. **添加事件订阅**,勾选以下事件:
|
|
292
|
+
|
|
293
|
+
| 事件 | 说明 |
|
|
294
|
+
|------|------|
|
|
295
|
+
| `im.message.receive_v1` | 接收消息(必需) |
|
|
296
|
+
| `im.message.message_read_v1` | 消息已读回执 |
|
|
297
|
+
| `im.chat.member.bot.added_v1` | 机器人进群 |
|
|
298
|
+
| `im.chat.member.bot.deleted_v1` | 机器人被移出群 |
|
|
299
|
+
|
|
300
|
+
3. 确保事件订阅的权限已申请并通过审核
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
openclaw config set channels.feishu.appId "cli_xxxxx"
|
|
304
|
+
openclaw config set channels.feishu.appSecret "your_app_secret"
|
|
305
|
+
openclaw config set channels.feishu.enabled true
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 配置选项
|
|
309
|
+
|
|
310
|
+
```yaml
|
|
311
|
+
channels:
|
|
312
|
+
feishu:
|
|
313
|
+
enabled: true
|
|
314
|
+
appId: "cli_xxxxx"
|
|
315
|
+
appSecret: "secret"
|
|
316
|
+
# 域名: "feishu" (国内) 或 "lark" (国际)
|
|
317
|
+
domain: "feishu"
|
|
318
|
+
# 连接模式: "websocket" (推荐) 或 "webhook"
|
|
319
|
+
connectionMode: "websocket"
|
|
320
|
+
# 私聊策略: "pairing" | "open" | "allowlist"
|
|
321
|
+
dmPolicy: "pairing"
|
|
322
|
+
# 群聊策略: "open" | "allowlist" | "disabled"
|
|
323
|
+
groupPolicy: "allowlist"
|
|
324
|
+
# 群聊是否需要 @机器人
|
|
325
|
+
requireMention: true
|
|
326
|
+
# 媒体文件最大大小 (MB, 默认 30)
|
|
327
|
+
mediaMaxMb: 30
|
|
260
328
|
# 回复渲染模式: "post" | "auto" | "raw" | "card"
|
|
261
329
|
renderMode: "post"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
330
|
+
# 工具开关
|
|
331
|
+
tools:
|
|
332
|
+
doc: true
|
|
333
|
+
wiki: true
|
|
334
|
+
drive: true
|
|
335
|
+
perm: false
|
|
336
|
+
scopes: true
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### 渲染模式
|
|
340
|
+
|
|
266
341
|
| 模式 | 说明 |
|
|
267
342
|
|------|------|
|
|
268
343
|
| `post` | (默认)使用富文本 post(`msg_type=post` + `tag=md`)。 |
|
|
269
344
|
| `auto` | 自动检测:有代码块或表格时用卡片,否则纯文本 |
|
|
270
345
|
| `raw` | 始终纯文本,表格转为 ASCII |
|
|
271
346
|
| `card` | 始终使用卡片,支持语法高亮、表格、链接等 |
|
|
272
|
-
|
|
273
|
-
###
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
347
|
+
|
|
348
|
+
### 工具与技能
|
|
349
|
+
|
|
350
|
+
插件注册了工具,并自带技能说明(通过 `openclaw.plugin.json` 加载),模型可更稳定调用:
|
|
351
|
+
|
|
352
|
+
| 工具 | 作用 |
|
|
353
|
+
|------|------|
|
|
354
|
+
| `feishu_doc` | 读写飞书文档(docx),追加内容,列出/更新/删除块 |
|
|
355
|
+
| `feishu_drive` | 云盘文件/文件夹浏览、移动、删除 |
|
|
356
|
+
| `feishu_wiki` | 知识库空间与节点管理 |
|
|
357
|
+
| `feishu_perm` | 文件/文档权限管理(默认关闭) |
|
|
358
|
+
| `feishu_app_scopes` | 查看应用权限范围 |
|
|
359
|
+
|
|
360
|
+
说明:
|
|
361
|
+
- 知识库页面内容通过 `feishu_doc` 读写(先 wiki get 获取 `obj_token`)。
|
|
362
|
+
- docx 转换 API **不支持 Markdown 表格**。
|
|
363
|
+
- 机器人没有“我的空间”根目录,需要先共享一个文件夹给机器人。
|
|
364
|
+
|
|
365
|
+
### 功能
|
|
366
|
+
|
|
367
|
+
- WebSocket 和 Webhook 连接模式
|
|
368
|
+
- 私聊和群聊
|
|
369
|
+
- 消息回复和引用上下文
|
|
370
|
+
- **入站媒体支持**:AI 可以看到图片、读取文件(PDF、Excel 等)、处理富文本中的嵌入图片
|
|
371
|
+
- 图片和文件上传(出站)
|
|
372
|
+
- 输入指示器(通过表情回复实现)
|
|
373
|
+
- 私聊配对审批流程
|
|
374
|
+
- 用户和群组目录查询
|
|
375
|
+
- **卡片渲染模式**:支持语法高亮的 Markdown 渲染
|
|
376
|
+
- **@ 转发功能**:在消息中 @ 某人,机器人的回复会自动 @ 该用户
|
|
377
|
+
- **文档 / 云盘 / 知识库工具**:读写 docx、浏览知识库、管理云盘
|
|
378
|
+
|
|
379
|
+
#### @ 转发功能
|
|
380
|
+
|
|
381
|
+
如果你希望机器人的回复中 @ 某人,只需在你的消息中 @ 他们:
|
|
382
|
+
|
|
383
|
+
- **私聊**:`@张三 跟他问好` → 机器人回复 `@张三 你好!`
|
|
384
|
+
- **群聊**:`@机器人 @张三 跟他问好` → 机器人回复 `@张三 你好!`
|
|
385
|
+
|
|
386
|
+
机器人会自动检测消息中的 @ 并在回复时带上。无需额外权限。
|
|
387
|
+
|
|
388
|
+
### 常见问题
|
|
389
|
+
|
|
390
|
+
#### 机器人收不到消息
|
|
391
|
+
|
|
392
|
+
检查以下配置:
|
|
393
|
+
1. 是否配置了 **事件订阅**?(见上方事件订阅章节)
|
|
394
|
+
2. 事件配置方式是否选择了 **长连接**?
|
|
395
|
+
3. 是否添加了 `im.message.receive_v1` 事件?
|
|
396
|
+
4. 相关权限是否已申请并审核通过?
|
|
397
|
+
|
|
398
|
+
#### 返回消息时 403 错误
|
|
399
|
+
|
|
400
|
+
确保已申请 `im:message:send_as_bot` 权限,并且权限已审核通过。
|
|
401
|
+
|
|
402
|
+
#### 云盘操作 400 或根目录为空
|
|
403
|
+
|
|
404
|
+
机器人没有个人根目录。请先共享一个文件夹给机器人,再在该文件夹内操作。
|
|
405
|
+
|
|
406
|
+
#### 文档写入不支持表格
|
|
407
|
+
|
|
408
|
+
docx 转换 API 不支持 Markdown 表格。请使用列表或手动表格。
|
|
409
|
+
|
|
410
|
+
#### 如何清理历史会话 / 开启新对话
|
|
411
|
+
|
|
412
|
+
在聊天中发送 `/new` 命令即可开启新对话。
|
|
413
|
+
|
|
414
|
+
#### 消息为什么不是流式输出
|
|
415
|
+
|
|
416
|
+
飞书 API 有请求频率限制,流式更新消息很容易触发限流。当前采用完整回复后一次性发送的方式,以保证稳定性。
|
|
417
|
+
|
|
418
|
+
#### Windows 安装报错 `spawn npm ENOENT`
|
|
419
|
+
|
|
420
|
+
如果 `openclaw plugins install` 失败,可以手动安装:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# 1. 下载插件包
|
|
424
|
+
curl -O https://registry.npmjs.org/@superbenxxxh/feishu/-/feishu-VERSION.tgz
|
|
425
|
+
|
|
426
|
+
# 2. 从本地安装
|
|
427
|
+
openclaw plugins install ./feishu-VERSION.tgz
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
#### 在飞书里找不到机器人
|
|
431
|
+
|
|
432
|
+
1. 确保应用已发布(至少发布到测试版本)
|
|
433
|
+
2. 在飞书搜索框中搜索机器人名称
|
|
434
|
+
3. 检查应用可用范围是否包含你的账号
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## License
|
|
439
|
+
|
|
339
440
|
MIT
|