@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 CHANGED
@@ -1,339 +1,440 @@
1
- # clawd-feishu
2
-
3
- Feishu/Lark (飞书) channel plugin for [OpenClaw](https://github.com/openclaw/openclaw).
4
-
5
- [English](#english) | [中文](#中文)
6
-
7
- ---
8
-
9
- ## English
10
-
11
- ### Installation
12
-
13
- ```bash
14
- openclaw plugins install @m1heng-clawd/feishu
15
- ```
16
-
17
- Or install via npm:
18
-
19
- ```bash
20
- npm install @m1heng-clawd/feishu
21
- ```
22
-
23
- ### Configuration
24
-
25
- 1. Create a self-built app on [Feishu Open Platform](https://open.feishu.cn)
26
- 2. Get your App ID and App Secret from the Credentials page
27
- 3. Enable required permissions (see below)
28
- 4. **Configure event subscriptions** (see below) ⚠️ Important
29
- 5. Configure the plugin:
30
-
31
- #### Required Permissions
32
-
33
- | Permission | Scope | Description |
34
- |------------|-------|-------------|
35
- | `contact:user.base:readonly` | User info | Get basic user info (required to resolve sender display names for speaker attribution) |
36
- | `im:message` | Messaging | Send and receive messages |
37
- | `im:message.p2p_msg:readonly` | DM | Read direct messages to bot |
38
- | `im:message.group_at_msg:readonly` | Group | Receive @mention messages in groups |
39
- | `im:message:send_as_bot` | Send | Send messages as the bot |
40
- | `im:resource` | Media | Upload and download images/files |
41
-
42
- #### Optional Permissions
43
-
44
- | Permission | Scope | Description |
45
- |------------|-------|-------------|
46
- | `im:message.group_msg` | Group | Read all group messages (sensitive) |
47
- | `im:message:readonly` | Read | Get message history |
48
- | `im:message:update` | Edit | Update/edit sent messages |
49
- | `im:message:recall` | Recall | Recall sent messages |
50
- | `im:message.reactions:read` | Reactions | View message reactions |
51
-
52
- #### Event Subscriptions ⚠️
53
-
54
- > **This is the most commonly missed configuration!** If the bot can send messages but cannot receive them, check this section.
55
-
56
- In the Feishu Open Platform console, go to **Events & Callbacks**:
57
-
58
- 1. **Event configuration**: Select **Long connection** (recommended)
59
- 2. **Add event subscriptions**:
60
-
61
- | Event | Description |
62
- |-------|-------------|
63
- | `im.message.receive_v1` | Receive messages (required) |
64
- | `im.message.message_read_v1` | Message read receipts |
65
- | `im.chat.member.bot.added_v1` | Bot added to group |
66
- | `im.chat.member.bot.deleted_v1` | Bot removed from group |
67
-
68
- 3. Ensure the event permissions are approved
69
-
70
- ```bash
71
- openclaw config set channels.feishu.appId "cli_xxxxx"
72
- openclaw config set channels.feishu.appSecret "your_app_secret"
73
- openclaw config set channels.feishu.enabled true
74
- ```
75
-
76
- ### Configuration Options
77
-
78
- ```yaml
79
- channels:
80
- feishu:
81
- enabled: true
82
- appId: "cli_xxxxx"
83
- appSecret: "secret"
84
- # Domain: "feishu" (China) or "lark" (International)
85
- domain: "feishu"
86
- # Connection mode: "websocket" (recommended) or "webhook"
87
- connectionMode: "websocket"
88
- # DM policy: "pairing" | "open" | "allowlist"
89
- dmPolicy: "pairing"
90
- # Group policy: "open" | "allowlist" | "disabled"
91
- groupPolicy: "allowlist"
92
- # Require @mention in groups
93
- requireMention: true
94
- # Max media size in MB (default: 30)
95
- mediaMaxMb: 30
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
- #### Render Mode
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
- ### Features
110
-
111
- - WebSocket and Webhook connection modes
112
- - Direct messages and group chats
113
- - Message replies and quoted message context
114
- - **Inbound media support**: AI can see images, read files (PDF, Excel, etc.), and process rich text with embedded images
115
- - Image and file uploads (outbound)
116
- - Typing indicator (via emoji reactions)
117
- - Pairing flow for DM approval
118
- - User and group directory lookup
119
- - **Card render mode**: Optional markdown rendering with syntax highlighting
120
- - **@mention forwarding**: When you @mention someone in your message, the bot's reply will automatically @mention them too
121
-
122
- #### @Mention Forwarding
123
-
124
- When you want the bot to @mention someone in its reply, simply @mention them in your message:
125
-
126
- - **In DM**: `@张三 say hello` → Bot replies with `@张三 Hello!`
127
- - **In Group**: `@bot @张三 say hello` → Bot replies with `@张三 Hello!`
128
-
129
- The bot automatically detects @mentions in your message and includes them in its reply. No extra permissions required beyond the standard messaging permissions.
130
-
131
- ### FAQ
132
-
133
- #### Bot cannot receive messages
134
-
135
- Check the following:
136
- 1. Have you configured **event subscriptions**? (See Event Subscriptions section)
137
- 2. Is the event configuration set to **long connection**?
138
- 3. Did you add the `im.message.receive_v1` event?
139
- 4. Are the permissions approved?
140
-
141
- #### 403 error when sending messages
142
-
143
- Ensure `im:message:send_as_bot` permission is approved.
144
-
145
- #### How to clear history / start new conversation
146
-
147
- Send `/new` command in the chat.
148
-
149
- #### Why is the output not streaming
150
-
151
- Feishu API has rate limits. Streaming updates can easily trigger throttling. We use complete-then-send approach for stability.
152
-
153
- #### Windows install error `spawn npm ENOENT`
154
-
155
- If `openclaw plugins install` fails, install manually:
156
-
157
- ```bash
158
- # 1. Download the package
159
- curl -O https://registry.npmjs.org/@m1heng-clawd/feishu/-/feishu-0.1.3.tgz
160
-
161
- # 2. Install from local file
162
- openclaw plugins install ./feishu-0.1.3.tgz
163
- ```
164
-
165
- #### Cannot find the bot in Feishu
166
-
167
- 1. Ensure the app is published (at least to test version)
168
- 2. Search for the bot name in Feishu search box
169
- 3. Check if your account is in the app's availability scope
170
-
171
- ---
172
-
173
- ## 中文
174
-
175
- ### 安装
176
-
177
- ```bash
178
- openclaw plugins install @m1heng-clawd/feishu
179
- ```
180
-
181
- 或通过 npm 安装:
182
-
183
- ```bash
184
- npm install @m1heng-clawd/feishu
185
- ```
186
-
187
- ### 配置
188
-
189
- 1. 在 [飞书开放平台](https://open.feishu.cn) 创建自建应用
190
- 2. 在凭证页面获取 App ID 和 App Secret
191
- 3. 开启所需权限(见下方)
192
- 4. **配置事件订阅**(见下方)⚠️ 重要
193
- 5. 配置插件:
194
-
195
- #### 必需权限
196
-
197
- | 权限 | 范围 | 说明 |
198
- |------|------|------|
199
- | `contact:user.base:readonly` | 用户信息 | 获取用户基本信息(用于解析发送者姓名,避免群聊/私聊把不同人当成同一说话者) |
200
- | `im:message` | 消息 | 发送和接收消息 |
201
- | `im:message.p2p_msg:readonly` | 私聊 | 读取发给机器人的私聊消息 |
202
- | `im:message.group_at_msg:readonly` | 群聊 | 接收群内 @机器人 的消息 |
203
- | `im:message:send_as_bot` | 发送 | 以机器人身份发送消息 |
204
- | `im:resource` | 媒体 | 上传和下载图片/文件 |
205
-
206
- #### 可选权限
207
-
208
- | 权限 | 范围 | 说明 |
209
- |------|------|------|
210
- | `im:message.group_msg` | 群聊 | 读取所有群消息(敏感) |
211
- | `im:message:readonly` | 读取 | 获取历史消息 |
212
- | `im:message:update` | 编辑 | 更新/编辑已发送消息 |
213
- | `im:message:recall` | 撤回 | 撤回已发送消息 |
214
- | `im:message.reactions:read` | 表情 | 查看消息表情回复 |
215
-
216
- #### 事件订阅 ⚠️
217
-
218
- > **这是最容易遗漏的配置!** 如果机器人能发消息但收不到消息,请检查此项。
219
-
220
- 在飞书开放平台的应用后台,进入 **事件与回调** 页面:
221
-
222
- 1. **事件配置方式**:选择 **使用长连接接收事件**(推荐)
223
- 2. **添加事件订阅**,勾选以下事件:
224
-
225
- | 事件 | 说明 |
226
- |------|------|
227
- | `im.message.receive_v1` | 接收消息(必需) |
228
- | `im.message.message_read_v1` | 消息已读回执 |
229
- | `im.chat.member.bot.added_v1` | 机器人进群 |
230
- | `im.chat.member.bot.deleted_v1` | 机器人被移出群 |
231
-
232
- 3. 确保事件订阅的权限已申请并通过审核
233
-
234
- ```bash
235
- openclaw config set channels.feishu.appId "cli_xxxxx"
236
- openclaw config set channels.feishu.appSecret "your_app_secret"
237
- openclaw config set channels.feishu.enabled true
238
- ```
239
-
240
- ### 配置选项
241
-
242
- ```yaml
243
- channels:
244
- feishu:
245
- enabled: true
246
- appId: "cli_xxxxx"
247
- appSecret: "secret"
248
- # 域名: "feishu" (国内) "lark" (国际)
249
- domain: "feishu"
250
- # 连接模式: "websocket" (推荐) 或 "webhook"
251
- connectionMode: "websocket"
252
- # 私聊策略: "pairing" | "open" | "allowlist"
253
- dmPolicy: "pairing"
254
- # 群聊策略: "open" | "allowlist" | "disabled"
255
- groupPolicy: "allowlist"
256
- # 群聊是否需要 @机器人
257
- requireMention: true
258
- # 媒体文件最大大小 (MB, 默认 30)
259
- mediaMaxMb: 30
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
- - WebSocket 和 Webhook 连接模式
276
- - 私聊和群聊
277
- - 消息回复和引用上下文
278
- - **入站媒体支持**:AI 可以看到图片、读取文件(PDF、Excel 等)、处理富文本中的嵌入图片
279
- - 图片和文件上传(出站)
280
- - 输入指示器(通过表情回复实现)
281
- - 私聊配对审批流程
282
- - 用户和群组目录查询
283
- - **卡片渲染模式**:支持语法高亮的 Markdown 渲染
284
- - **@ 转发功能**:在消息中 @ 某人,机器人的回复会自动 @ 该用户
285
-
286
- #### @ 转发功能
287
-
288
- 如果你希望机器人的回复中 @ 某人,只需在你的消息中 @ 他们:
289
-
290
- - **私聊**:`@张三 跟他问好` → 机器人回复 `@张三 你好!`
291
- - **群聊**:`@机器人 @张三 跟他问好` → 机器人回复 `@张三 你好!`
292
-
293
- 机器人会自动检测消息中的 @ 并在回复时带上。无需额外权限。
294
-
295
- ### 常见问题
296
-
297
- #### 机器人收不到消息
298
-
299
- 检查以下配置:
300
- 1. 是否配置了 **事件订阅**?(见上方事件订阅章节)
301
- 2. 事件配置方式是否选择了 **长连接**?
302
- 3. 是否添加了 `im.message.receive_v1` 事件?
303
- 4. 相关权限是否已申请并审核通过?
304
-
305
- #### 返回消息时 403 错误
306
-
307
- 确保已申请 `im:message:send_as_bot` 权限,并且权限已审核通过。
308
-
309
- #### 如何清理历史会话 / 开启新对话
310
-
311
- 在聊天中发送 `/new` 命令即可开启新对话。
312
-
313
- #### 消息为什么不是流式输出
314
-
315
- 飞书 API 有请求频率限制,流式更新消息很容易触发限流。当前采用完整回复后一次性发送的方式,以保证稳定性。
316
-
317
- #### Windows 安装报错 `spawn npm ENOENT`
318
-
319
- 如果 `openclaw plugins install` 失败,可以手动安装:
320
-
321
- ```bash
322
- # 1. 下载插件包
323
- curl -O https://registry.npmjs.org/@m1heng-clawd/feishu/-/feishu-0.1.3.tgz
324
-
325
- # 2. 从本地安装
326
- openclaw plugins install ./feishu-0.1.3.tgz
327
- ```
328
-
329
- #### 在飞书里找不到机器人
330
-
331
- 1. 确保应用已发布(至少发布到测试版本)
332
- 2. 在飞书搜索框中搜索机器人名称
333
- 3. 检查应用可用范围是否包含你的账号
334
-
335
- ---
336
-
337
- ## License
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