| name | feishu |
| description | Feishu (Lark) API operations for documents, cloud storage, permissions, wiki, bitables, messaging, and group chat. Use when: (1) reading/writing Feishu documents, (2) managing cloud drive files, (3) managing document permissions, (4) navigating wiki/knowledge base, (5) working with bitable (multidimensional tables), (6) sending messages or managing groups, (7) searching documents/wiki. Triggers on 'feishu', 'lark', '飞书', 'cloud doc', 'wiki', 'bitable', 'im message', 'send message', 'group chat'. NOT for: calendar, audio/video calls, or when the task doesn't involve Feishu. |
Feishu
Feishu (Lark) Open API integration for documents, drive, permissions, wiki, and bitable.
Prerequisites
- A Feishu app with required permissions configured at https://open.feishu.cn
- Environment variables:
export FEISHU_APP_ID="cli_xxxxx"
export FEISHU_APP_SECRET="xxxxx"
Quick Start
All operations use scripts/feishu.mjs. Syntax:
node "$SCRIPT_DIR/scripts/feishu.mjs" <tool> <action> [params...]
Authentication
The script automatically obtains and caches tenant_access_token. No manual token management needed.
Tools
feishu_doc — Document Operations
node scripts/feishu.mjs doc read --doc_token ABC123def
node scripts/feishu.mjs doc write --doc_token ABC123def --content "# Title\n\nHello"
node scripts/feishu.mjs doc append --doc_token ABC123def --content "More text"
node scripts/feishu.mjs doc create --title "New Doc" --folder_token fldcnXXX
node scripts/feishu.mjs doc list_blocks --doc_token ABC123def
node scripts/feishu.mjs doc get_block --doc_token ABC123def --block_id doxcnXXX
node scripts/feishu.mjs doc update_block --doc_token ABC123def --block_id doxcnXXX --content "New text"
node scripts/feishu.mjs doc delete_block --doc_token ABC123def --block_id doxcnXXX
node scripts/feishu.mjs doc create_table --doc_token ABC123def --row_size 3 --column_size 2
node scripts/feishu.mjs doc write_table_cells --doc_token ABC123def --table_block_id doxcnTABLE --values '[["A1","B1"],["A2","B2"]]'
node scripts/feishu.mjs doc create_table_with_values --doc_token ABC123def --row_size 2 --column_size 2 --values '[["A1","B1"],["A2","B2"]]'
node scripts/feishu.mjs doc upload_image --doc_token ABC123def --url "https://example.com/img.png"
node scripts/feishu.mjs doc upload_image --doc_token ABC123def --file_path "path/to/img.png"
node scripts/feishu.mjs doc upload_file --doc_token ABC123def --url "https://example.com/report.pdf"
node scripts/feishu.mjs doc insert --doc_token ABC123def --after_block_id doxcnXXX --content "Inserted text"
Token Extraction
From URL https://xxx.feishu.cn/docx/ABC123def → doc_token = ABC123def
Supported Markdown
Headings, lists, code blocks, quotes, links, images (), bold/italic/strikethrough.
Limitation: Markdown tables are NOT supported in write/append. Use create_table_with_values instead.
Block Types (reference)
| ID | Type | Editable |
|---|
| 2 | Text | Yes |
| 3-11 | Heading1-9 | Yes |
| 12 | Bullet | Yes |
| 13 | Ordered | Yes |
| 14 | Code | Yes |
| 15 | Quote | Yes |
| 17 | Todo | Yes |
| 22 | Divider | No |
| 27 | Image | Partial |
| 31 | Table | Partial |
| 32 | TableCell | Yes |
Required Permissions
docx:document, docx:document:readonly, docx:document.block:convert, drive:drive
feishu_drive — Cloud Storage
node scripts/feishu.mjs drive list
node scripts/feishu.mjs drive list --folder_token fldcnXXX
node scripts/feishu.mjs drive info --file_token ABC123 --type docx
node scripts/feishu.mjs drive create_folder --name "New Folder" --folder_token fldcnXXX
node scripts/feishu.mjs drive move --file_token ABC123 --type docx --folder_token fldcnXXX
node scripts/feishu.mjs drive delete --file_token ABC123 --type docx
File Types
doc, docx, sheet, bitable, folder, file, mindnote, shortcut
Known Limitation: Bots Have No Root Folder
Bots use tenant_access_token and don't have their own "My Space". create_folder without folder_token will fail. User must create a folder and share it with the bot first.
Required Permissions
drive:drive (full), drive:drive:readonly (read only)
feishu_perm — Permission Management
node scripts/feishu.mjs perm list --token ABC123 --type docx
node scripts/feishu.mjs perm add --token ABC123 --type docx --member_type email --member_id user@example.com --perm edit
node scripts/feishu.mjs perm add --token ABC123 --type docx --member_type openid --member_id ou_xxx --perm full_access
node scripts/feishu.mjs perm remove --token ABC123 --type docx --member_type email --member_id user@example.com
Member Types
email, openid, userid, unionid, openchat, opendepartmentid
Permission Levels
view, edit, full_access
Required Permissions
drive:permission
feishu_wiki — Knowledge Base
node scripts/feishu.mjs wiki spaces
node scripts/feishu.mjs wiki nodes --space_id 7xxx
node scripts/feishu.mjs wiki nodes --space_id 7xxx --parent_node_token wikcnXXX
node scripts/feishu.mjs wiki get --token ABC123def
node scripts/feishu.mjs wiki create --space_id 7xxx --title "New Page"
node scripts/feishu.mjs wiki create --space_id 7xxx --title "Sheet" --obj_type sheet --parent_node_token wikcnXXX
node scripts/feishu.mjs wiki move --space_id 7xxx --node_token wikcnXXX
node scripts/feishu.mjs wiki rename --space_id 7xxx --node_token wikcnXXX --title "New Title"
Wiki-Doc Workflow
To edit a wiki page:
- Get node:
wiki get --token wiki_token → returns obj_token
- Read doc:
doc read --doc_token obj_token
- Write doc:
doc write --doc_token obj_token --content "..."
Required Permissions
wiki:wiki or wiki:wiki:readonly
feishu_im — Messaging
node scripts/feishu.mjs im create_message --receive_id oc_xxxxx --msg_type text --content '{"text":"Hello"}'
node scripts/feishu.mjs im list_messages --container_id oc_xxxxx --container_id_type chat --page_size 20
Required Permissions: im:message, im:message:readonly
feishu_chat — Group Management
node scripts/feishu.mjs chat create --name "群名" --owner_id ou_xxxxx --user_id_list '["ou_xxxxx"]'
node scripts/feishu.mjs chat list
node scripts/feishu.mjs chat get_members --chat_id oc_xxxxx
node scripts/feishu.mjs chat add_members --chat_id oc_xxxxx --id_list '["ou_yyyyy"]'
node scripts/feishu.mjs chat remove_members --chat_id oc_xxxxx --id_list '["ou_yyyyy"]'
node scripts/feishu.mjs chat update --chat_id oc_xxxxx --name "新群名" --description "描述"
node scripts/feishu.mjs chat delete --chat_id oc_xxxxx
Required Permissions: im:chat, im:chat:readonly
feishu_docx_search — Document Search
node scripts/feishu.mjs docx_search search --search_key "关键词" --count 10
Note: Requires OAuth (useUAT: true or --oauth flag). Returns 99991663 without it.
Required Permissions: docx:document:readonly
feishu_wiki_search — Knowledge Base Search
node scripts/feishu.mjs wiki_search search --query "关键词" --count 10 --space_id 7xxx
Note: Requires OAuth (useUAT: true or --oauth flag).
Required Permissions: wiki:wiki:readonly
feishu_docx_import — Document Import
node scripts/feishu.mjs docx_import import --file_extension docx --file_name "report.docx" --file_size 12345 --parent_token fldcnXXX
node scripts/feishu.mjs docx_import import_status --job_id job_xxxxx
Supported formats: docx, doc, xlsx, xls, pptx, ppt, pdf
Required Permissions: docx:document, drive:drive
feishu_bitable — Multidimensional Tables
node scripts/feishu.mjs bitable get_meta --url "https://xxx.feishu.cn/base/XXX?table=YYY"
node scripts/feishu.mjs bitable list_fields --app_token XXX --table_id YYY
node scripts/feishu.mjs bitable list_records --app_token XXX --table_id YYY --page_size 100
node scripts/feishu.mjs bitable get_record --app_token XXX --table_id YYY --record_id recXXX
node scripts/feishu.mjs bitable create_record --app_token XXX --table_id YYY --fields '{"Name":"Test","Score":95}'
node scripts/feishu.mjs bitable update_record --app_token XXX --table_id YYY --record_id recXXX --fields '{"Score":100}'
node scripts/feishu.mjs bitable create_app --name "My Table" --folder_token fldcnXXX
node scripts/feishu.mjs bitable create_field --app_token XXX --table_id YYY --field_name "Status" --field_type 3
Field Types
| ID | Type |
|---|
| 1 | Text |
| 2 | Number |
| 3 | SingleSelect |
| 4 | MultiSelect |
| 5 | DateTime |
| 7 | Checkbox |
| 11 | User |
| 13 | Phone |
| 15 | URL |
| 17 | Attachment |
| 18 | SingleLink |
| 19 | Lookup |
| 20 | Formula |
| 1001 | CreatedTime |
| 1002 | ModifiedTime |
| 1003 | CreatedUser |
| 1004 | ModifiedUser |
| 1005 | AutoNumber |
Tips
- Always pass
owner_open_id when creating docs so the requester gets access
- For wiki pages, use
wiki get to find obj_token, then use doc tools to edit content
- Bots have no root folder in drive — always specify
folder_token
- Large documents may need
list_blocks instead of read for structured content
- Use
--json flag for raw JSON output when needed
Output Format
All commands return JSON with the operation result. On error, returns { "error": "message" }.