feishu-docs飞书文档(Docx)API技能。用于创建、读取、更新和删除飞书文档。支持Markdown/HTML内容转换、文档权限管理。
Install via ClawdBot CLI:
clawdbot install StevenLikeWatermelon/feishu-docs操作飞书新版文档(Docx)的openClaw技能,基于飞书开放平台 API 实现文档全生命周期管理。
| 功能 | 说明 |
|------|------|
| 文档 CRUD | 创建、获取、更新(全量替换)、删除文档 |
| 内容追加 | 向已有文档末尾追加 Markdown/HTML 内容 |
| 内容转换 | 通过飞书服务端 API 将 Markdown/HTML 转换为文档块 |
| 块操作 | 获取文档块列表(自动分页)、插入子块、删除块 |
| 权限管理 | 添加协作者、查看权限成员列表 |
| 文件管理 | 按文件夹列出文件、按关键词搜索文档 |
export FEISHU_APP_ID=cli_xxxxxx # 飞书应用 App ID
export FEISHU_APP_SECRET=your_app_secret # 飞书应用 App Secret
也可通过 .env 文件配置(项目使用 dotenv 自动加载)。
# 安装依赖
npm install
# 查看帮助
node bin/cli.js --help
# 创建文档(含 Markdown 内容)
node bin/cli.js create -f fldxxxxxx -t "项目计划" -c "# 概述\n\n内容..."
# 获取文档
node bin/cli.js get -d dcnxxxxxx --format markdown --include-content
# 全量替换文档内容
node bin/cli.js update -d dcnxxxxxx --content-file new-content.md
# 追加内容
node bin/cli.js update -d dcnxxxxxx --append -c "## 补充\n\n新增内容"
# 删除文档
node bin/cli.js delete -d dcnxxxxxx
| 命令 | 说明 | 必要参数 |
|------|------|----------|
| create | 创建文档(有内容时自动使用转换流程) | -f文件夹token, -t标题 |
| create-with-content | 创建文档并通过转换API插入内容 | -f文件夹token, -t标题 |
| get | 获取文档信息 | -d文档ID |
| update | 替换或追加文档内容 | -d文档ID, -c内容或--content-file |
| delete | 删除文档 | -d文档ID |
| search | 搜索文档 | -q关键词 |
| list | 列出文件夹中的文件 | -f文件夹token |
| share | 分享文档给用户 | -d文档ID, -u用户ID |
| permissions | 查看文档权限成员 | -d文档ID |
| convert | 将Markdown/HTML转换为文档块(预览) | -t内容类型 |
所有命令均支持 --app-id 和 --app-secret 参数覆盖环境变量。
| 方法 | 说明 |
|------|------|
| createDocument(folderToken, title) | 创建空文档 |
| createDocumentWithContent(folderToken, title, content, contentType) | 创建文档并插入内容 |
| getDocument(documentId) | 获取文档信息 |
| getDocumentRawContent(documentId) | 获取文档纯文本内容 |
| deleteDocument(documentId) | 删除文档(通过 Drive API) |
| 方法 | 说明 |
|------|------|
| getDocumentBlocks(documentId, pageSize, pageToken) | 获取文档块列表(单页) |
| getAllDocumentBlocks(documentId) | 获取所有块(自动分页) |
| updateDocumentBlock(documentId, blockId, updateRequest) | 更新指定块 |
| createDocumentBlocks(documentId, blockId, children, index) | 在指定块下插入子块 |
| deleteDocumentBlock(documentId, blockId) | 删除指定块 |
| batchDeleteBlocks(documentId, blockIds) | 批量删除块 |
| 方法 | 说明 |
|------|------|
| appendToDocument(documentId, content, contentType) | 向文档末尾追加内容 |
| replaceDocumentContent(documentId, content, contentType) | 全量替换文档内容 |
| convertContent(contentType, content, userIdType) | 将 Markdown/HTML 转换为文档块 |
| 方法 | 说明 |
|------|------|
| listFolderFiles(folderToken, type) | 列出文件夹下的文件 |
| searchDocuments(query, folderToken) | 按关键词搜索文档 |
| 方法 | 说明 |
|------|------|
| addPermissionMember(token, memberId, memberType, perm) | 添加权限成员 |
| getPermissionMembers(token) | 获取权限成员列表 |
| 方法 | 说明 |
|------|------|
| markdownToBlocks(markdown) | Markdown → 飞书块结构(本地转换) |
| blocksToMarkdown(blocks) | 飞书块结构 → Markdown(支持数字/字符串 block_type) |
代码实际调用的飞书开放平台端点:
POST /docx/v1/documents # 创建文档
GET /docx/v1/documents/{document_id} # 获取文档信息
GET /docx/v1/documents/{document_id}/raw_content # 获取文档纯文本
GET /docx/v1/documents/{document_id}/blocks # 获取文档块列表
PATCH /docx/v1/documents/{document_id}/blocks/{block_id} # 更新块
DELETE /docx/v1/documents/{document_id}/blocks/{block_id} # 删除块
POST /docx/v1/documents/{document_id}/blocks/{block_id}/children # 插入子块
POST /docx/v1/documents/blocks/convert # Markdown/HTML→块
DELETE /drive/v1/files/{file_token}?type=docx # 删除文档
GET /drive/v1/files?folder_token=xxx # 列出文件夹文件
POST /drive/v1/permissions/{token}/members?type=docx # 添加权限成员
GET /drive/v1/permissions/{token}/members?type=docx # 获取权限成员
POST /auth/v3/tenant_access_token/internal/ # 获取 tenant_access_token
99991663/99991661 自动刷新 tokenerror.response.data,避免非 JSON 响应导致崩溃docs:doc、drive:drive、drive:file 等相关权限create 命令含 content 时自动走 convertContent → createDocumentBlocks 流程,确保文档结构正确merge_info 字段;block_type 为 31/32 的表格块暂被过滤├── src/api.js # FeishuDocsAPI 类(所有 API 方法 + 格式转换)
├── bin/cli.js # Commander 命令行工具
├── package.json # 依赖:axios, commander, dotenv
├── test-convert.js # 转换接口测试
├── SKILL.md # 本文件
└── README.md # 项目说明Generated Feb 23, 2026
Teams can use this skill to automate the creation and updating of project documentation in Feishu Docs. For example, it can generate weekly reports by appending markdown content, ensuring all project plans and updates are centralized and accessible to collaborators.
Publishers or content creators can leverage this skill to streamline the publishing process. It allows converting markdown drafts into structured Feishu documents, managing permissions for editors, and searching for documents by keywords to organize content libraries efficiently.
Educational institutions can utilize this skill to create and distribute course materials. Teachers can automatically generate documents with lesson plans, share them with students via permission management, and update content in real-time, enhancing collaboration in remote learning environments.
Companies can implement this skill to maintain an internal knowledge base in Feishu Docs. It enables automated updates to policies or procedures, bulk content replacement for version control, and efficient document search to support employee onboarding and training.
Offer this skill as part of a subscription-based service that integrates Feishu Docs with other business tools. Clients pay monthly for automated document workflows, such as syncing data from CRMs or project management platforms into Feishu, reducing manual effort.
Provide bespoke development services using this skill to build tailored solutions for enterprises. This includes creating custom CLI scripts or API integrations that automate specific document processes, with revenue generated from project-based contracts and ongoing support.
Generate revenue by offering training workshops and consulting services on how to effectively use this skill. Help organizations optimize their Feishu Docs usage for productivity, covering topics like API integration, content conversion, and permission management best practices.
💬 Integration Tip
Ensure the Feishu app has necessary permissions like docs:doc and drive:file, and use environment variables for secure credential management to avoid hardcoding sensitive data.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Read and send email via IMAP/SMTP. Check for new/unread messages, fetch content, search mailboxes, mark as read/unread, and send emails with attachments. Works with any IMAP/SMTP server including Gmail, Outlook, 163.com, vip.163.com, 126.com, vip.126.com, 188.com, and vip.188.com.
Gmail API integration with managed OAuth. Read, send, and manage emails, threads, labels, and drafts. Use this skill when users want to interact with Gmail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Automatically logs into email accounts (Gmail, Outlook, QQ Mail, etc.) and generates daily email summaries. Use when the user wants to get a summary of their emails, check important messages, or create daily email digests.
Fetch content from Feishu (Lark) Wiki, Docs, Sheets, and Bitable. Automatically resolves Wiki URLs to real entities and converts content to Markdown.
Manage Feishu (Lark) calendars by listing, searching, checking schedules, syncing events, and marking tasks with automated date extraction.