Skip to content

Commit 2267d58

Browse files
doodlewindclaude
authored andcommitted
feat(feishu): replace built-in SDK with community plugin
Replace the built-in Feishu SDK with the community-maintained clawdbot-feishu plugin by @m1heng. Changes: - Remove src/feishu/ directory (19 files) - Remove src/channels/plugins/outbound/feishu.ts - Remove src/channels/plugins/normalize/feishu.ts - Remove src/config/types.feishu.ts - Remove feishu exports from plugin-sdk/index.ts - Remove FeishuConfig from types.channels.ts New features in community plugin: - Document tools (read/create/edit Feishu docs) - Wiki tools (navigate/manage knowledge base) - Drive tools (folder/file management) - Bitable tools (read/write table records) - Permission tools (collaborator management) - Emoji reactions support - Typing indicators - Rich media support (bidirectional image/file transfer) - @mention handling - Skills for feishu-doc, feishu-wiki, feishu-drive, feishu-perm Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 02842be commit 2267d58

66 files changed

Lines changed: 5694 additions & 4478 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/feishu/README.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

extensions/feishu/index.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,62 @@
11
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
22
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3+
import { registerFeishuBitableTools } from "./src/bitable.js";
34
import { feishuPlugin } from "./src/channel.js";
5+
import { registerFeishuDocTools } from "./src/docx.js";
6+
import { registerFeishuDriveTools } from "./src/drive.js";
7+
import { registerFeishuPermTools } from "./src/perm.js";
8+
import { setFeishuRuntime } from "./src/runtime.js";
9+
import { registerFeishuWikiTools } from "./src/wiki.js";
10+
11+
export { monitorFeishuProvider } from "./src/monitor.js";
12+
export {
13+
sendMessageFeishu,
14+
sendCardFeishu,
15+
updateCardFeishu,
16+
editMessageFeishu,
17+
getMessageFeishu,
18+
} from "./src/send.js";
19+
export {
20+
uploadImageFeishu,
21+
uploadFileFeishu,
22+
sendImageFeishu,
23+
sendFileFeishu,
24+
sendMediaFeishu,
25+
} from "./src/media.js";
26+
export { probeFeishu } from "./src/probe.js";
27+
export {
28+
addReactionFeishu,
29+
removeReactionFeishu,
30+
listReactionsFeishu,
31+
FeishuEmoji,
32+
} from "./src/reactions.js";
33+
export {
34+
extractMentionTargets,
35+
extractMessageBody,
36+
isMentionForwardRequest,
37+
formatMentionForText,
38+
formatMentionForCard,
39+
formatMentionAllForText,
40+
formatMentionAllForCard,
41+
buildMentionedMessage,
42+
buildMentionedCardContent,
43+
type MentionTarget,
44+
} from "./src/mention.js";
45+
export { feishuPlugin } from "./src/channel.js";
446

547
const plugin = {
648
id: "feishu",
749
name: "Feishu",
8-
description: "Feishu (Lark) channel plugin",
50+
description: "Feishu/Lark channel plugin",
951
configSchema: emptyPluginConfigSchema(),
1052
register(api: OpenClawPluginApi) {
53+
setFeishuRuntime(api.runtime);
1154
api.registerChannel({ plugin: feishuPlugin });
55+
registerFeishuDocTools(api);
56+
registerFeishuWikiTools(api);
57+
registerFeishuDriveTools(api);
58+
registerFeishuPermTools(api);
59+
registerFeishuBitableTools(api);
1260
},
1361
};
1462

extensions/feishu/openclaw.plugin.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"id": "feishu",
33
"channels": ["feishu"],
4+
"skills": ["./skills"],
45
"configSchema": {
56
"type": "object",
67
"additionalProperties": false,

extensions/feishu/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"name": "@openclaw/feishu",
33
"version": "2026.2.4",
4-
"description": "OpenClaw Feishu channel plugin",
4+
"description": "OpenClaw Feishu/Lark channel plugin (community maintained by @m1heng)",
55
"type": "module",
6+
"dependencies": {
7+
"@larksuiteoapi/node-sdk": "^1.56.1",
8+
"@sinclair/typebox": "^0.34.48",
9+
"zod": "^4.3.6"
10+
},
611
"devDependencies": {
712
"openclaw": "workspace:*"
813
},
@@ -13,11 +18,10 @@
1318
"channel": {
1419
"id": "feishu",
1520
"label": "Feishu",
16-
"selectionLabel": "Feishu (Lark Open Platform)",
17-
"detailLabel": "Feishu Bot",
21+
"selectionLabel": "Feishu/Lark (飞书)",
1822
"docsPath": "/channels/feishu",
1923
"docsLabel": "feishu",
20-
"blurb": "Feishu/Lark bot via WebSocket.",
24+
"blurb": "飞书/Lark enterprise messaging with doc/wiki/drive tools.",
2125
"aliases": [
2226
"lark"
2327
],
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
name: feishu-doc
3+
description: |
4+
Feishu document read/write operations. Activate when user mentions Feishu docs, cloud docs, or docx links.
5+
---
6+
7+
# Feishu Document Tool
8+
9+
Single tool `feishu_doc` with action parameter for all document operations.
10+
11+
## Token Extraction
12+
13+
From URL `https://xxx.feishu.cn/docx/ABC123def``doc_token` = `ABC123def`
14+
15+
## Actions
16+
17+
### Read Document
18+
19+
```json
20+
{ "action": "read", "doc_token": "ABC123def" }
21+
```
22+
23+
Returns: title, plain text content, block statistics. Check `hint` field - if present, structured content (tables, images) exists that requires `list_blocks`.
24+
25+
### Write Document (Replace All)
26+
27+
```json
28+
{ "action": "write", "doc_token": "ABC123def", "content": "# Title\n\nMarkdown content..." }
29+
```
30+
31+
Replaces entire document with markdown content. Supports: headings, lists, code blocks, quotes, links, images (`![](url)` auto-uploaded), bold/italic/strikethrough.
32+
33+
**Limitation:** Markdown tables are NOT supported.
34+
35+
### Append Content
36+
37+
```json
38+
{ "action": "append", "doc_token": "ABC123def", "content": "Additional content" }
39+
```
40+
41+
Appends markdown to end of document.
42+
43+
### Create Document
44+
45+
```json
46+
{ "action": "create", "title": "New Document" }
47+
```
48+
49+
With folder:
50+
51+
```json
52+
{ "action": "create", "title": "New Document", "folder_token": "fldcnXXX" }
53+
```
54+
55+
### List Blocks
56+
57+
```json
58+
{ "action": "list_blocks", "doc_token": "ABC123def" }
59+
```
60+
61+
Returns full block data including tables, images. Use this to read structured content.
62+
63+
### Get Single Block
64+
65+
```json
66+
{ "action": "get_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }
67+
```
68+
69+
### Update Block Text
70+
71+
```json
72+
{
73+
"action": "update_block",
74+
"doc_token": "ABC123def",
75+
"block_id": "doxcnXXX",
76+
"content": "New text"
77+
}
78+
```
79+
80+
### Delete Block
81+
82+
```json
83+
{ "action": "delete_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }
84+
```
85+
86+
## Reading Workflow
87+
88+
1. Start with `action: "read"` - get plain text + statistics
89+
2. Check `block_types` in response for Table, Image, Code, etc.
90+
3. If structured content exists, use `action: "list_blocks"` for full data
91+
92+
## Configuration
93+
94+
```yaml
95+
channels:
96+
feishu:
97+
tools:
98+
doc: true # default: true
99+
```
100+
101+
**Note:** `feishu_wiki` depends on this tool - wiki page content is read/written via `feishu_doc`.
102+
103+
## Permissions
104+
105+
Required: `docx:document`, `docx:document:readonly`, `docx:document.block:convert`, `drive:drive`
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Feishu Block Types Reference
2+
3+
Complete reference for Feishu document block types. Use with `feishu_doc_list_blocks`, `feishu_doc_update_block`, and `feishu_doc_delete_block`.
4+
5+
## Block Type Table
6+
7+
| block_type | Name | Description | Editable |
8+
| ---------- | --------------- | ------------------------------ | -------- |
9+
| 1 | Page | Document root (contains title) | No |
10+
| 2 | Text | Plain text paragraph | Yes |
11+
| 3 | Heading1 | H1 heading | Yes |
12+
| 4 | Heading2 | H2 heading | Yes |
13+
| 5 | Heading3 | H3 heading | Yes |
14+
| 6 | Heading4 | H4 heading | Yes |
15+
| 7 | Heading5 | H5 heading | Yes |
16+
| 8 | Heading6 | H6 heading | Yes |
17+
| 9 | Heading7 | H7 heading | Yes |
18+
| 10 | Heading8 | H8 heading | Yes |
19+
| 11 | Heading9 | H9 heading | Yes |
20+
| 12 | Bullet | Unordered list item | Yes |
21+
| 13 | Ordered | Ordered list item | Yes |
22+
| 14 | Code | Code block | Yes |
23+
| 15 | Quote | Blockquote | Yes |
24+
| 16 | Equation | LaTeX equation | Partial |
25+
| 17 | Todo | Checkbox / task item | Yes |
26+
| 18 | Bitable | Multi-dimensional table | No |
27+
| 19 | Callout | Highlight block | Yes |
28+
| 20 | ChatCard | Chat card embed | No |
29+
| 21 | Diagram | Diagram embed | No |
30+
| 22 | Divider | Horizontal rule | No |
31+
| 23 | File | File attachment | No |
32+
| 24 | Grid | Grid layout container | No |
33+
| 25 | GridColumn | Grid column | No |
34+
| 26 | Iframe | Embedded iframe | No |
35+
| 27 | Image | Image | Partial |
36+
| 28 | ISV | Third-party widget | No |
37+
| 29 | MindnoteBlock | Mindmap embed | No |
38+
| 30 | Sheet | Spreadsheet embed | No |
39+
| 31 | Table | Table | Partial |
40+
| 32 | TableCell | Table cell | Yes |
41+
| 33 | View | View embed | No |
42+
| 34 | Undefined | Unknown type | No |
43+
| 35 | QuoteContainer | Quote container | No |
44+
| 36 | Task | Lark Tasks integration | No |
45+
| 37 | OKR | OKR integration | No |
46+
| 38 | OKRObjective | OKR objective | No |
47+
| 39 | OKRKeyResult | OKR key result | No |
48+
| 40 | OKRProgress | OKR progress | No |
49+
| 41 | AddOns | Add-ons block | No |
50+
| 42 | JiraIssue | Jira issue embed | No |
51+
| 43 | WikiCatalog | Wiki catalog | No |
52+
| 44 | Board | Board embed | No |
53+
| 45 | Agenda | Agenda block | No |
54+
| 46 | AgendaItem | Agenda item | No |
55+
| 47 | AgendaItemTitle | Agenda item title | No |
56+
| 48 | SyncedBlock | Synced block reference | No |
57+
58+
## Editing Guidelines
59+
60+
### Text-based blocks (2-17, 19)
61+
62+
Update text content using `feishu_doc_update_block`:
63+
64+
```json
65+
{
66+
"doc_token": "ABC123",
67+
"block_id": "block_xxx",
68+
"content": "New text content"
69+
}
70+
```
71+
72+
### Image blocks (27)
73+
74+
Images cannot be updated directly via `update_block`. Use `feishu_doc_write` or `feishu_doc_append` with markdown to add new images.
75+
76+
### Table blocks (31)
77+
78+
**Important:** Table blocks CANNOT be created via the `documentBlockChildren.create` API (error 1770029). This affects `feishu_doc_write` and `feishu_doc_append` - markdown tables will be skipped with a warning.
79+
80+
Tables can only be read (via `list_blocks`) and individual cells (type 32) can be updated, but new tables cannot be inserted programmatically via markdown.
81+
82+
### Container blocks (24, 25, 35)
83+
84+
Grid and QuoteContainer are layout containers. Edit their child blocks instead.
85+
86+
## Common Patterns
87+
88+
### Replace specific paragraph
89+
90+
1. `feishu_doc_list_blocks` - find the block_id
91+
2. `feishu_doc_update_block` - update its content
92+
93+
### Insert content at specific location
94+
95+
Currently, the API only supports appending to document end. For insertion at specific positions, consider:
96+
97+
1. Read existing content
98+
2. Delete affected blocks
99+
3. Rewrite with new content in desired order
100+
101+
### Delete multiple blocks
102+
103+
Blocks must be deleted one at a time. Delete child blocks before parent containers.

0 commit comments

Comments
 (0)