feishu-doc

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Feishu Document Tool

Feishu 文档工具

Single tool
feishu_doc
with action parameter for all document operations.
通过单个工具
feishu_doc
,结合action参数即可完成所有文档操作。

Token Extraction

Token 提取

From URL
https://xxx.feishu.cn/docx/ABC123def
doc_token
=
ABC123def
从URL
https://xxx.feishu.cn/docx/ABC123def
中提取 →
doc_token
=
ABC123def

Actions

操作列表

Read Document

读取文档

json
{ "action": "read", "doc_token": "ABC123def" }
Returns: title, plain text content, block statistics. Check
hint
field - if present, structured content (tables, images) exists that requires
list_blocks
.
json
{ "action": "read", "doc_token": "ABC123def" }
返回:标题、纯文本内容、区块统计信息。检查
hint
字段——如果存在该字段,说明文档中包含表格、图片等结构化内容,需要使用
list_blocks
操作来获取。

Write Document (Replace All)

写入文档(全部替换)

json
{ "action": "write", "doc_token": "ABC123def", "content": "# Title\n\nMarkdown content..." }
Replaces entire document with markdown content. Supports: headings, lists, code blocks, quotes, links, images (
![](url)
auto-uploaded), bold/italic/strikethrough.
Limitation: Markdown tables are NOT supported.
json
{ "action": "write", "doc_token": "ABC123def", "content": "# Title\n\nMarkdown content..." }
使用Markdown内容替换整个文档。支持:标题、列表、代码块、引用、链接、图片(
![](url)
会自动上传)、粗体/斜体/删除线。
限制: 不支持Markdown表格。

Append Content

追加内容

json
{ "action": "append", "doc_token": "ABC123def", "content": "Additional content" }
Appends markdown to end of document.
json
{ "action": "append", "doc_token": "ABC123def", "content": "Additional content" }
在文档末尾追加Markdown内容。

Create Document

创建文档

json
{ "action": "create", "title": "New Document" }
With folder:
json
{ "action": "create", "title": "New Document", "folder_token": "fldcnXXX" }
json
{ "action": "create", "title": "New Document" }
创建到指定文件夹:
json
{ "action": "create", "title": "New Document", "folder_token": "fldcnXXX" }

List Blocks

列出区块

json
{ "action": "list_blocks", "doc_token": "ABC123def" }
Returns full block data including tables, images. Use this to read structured content.
json
{ "action": "list_blocks", "doc_token": "ABC123def" }
返回包含表格、图片在内的完整区块数据。使用此操作读取结构化内容。

Get Single Block

获取单个区块

json
{ "action": "get_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }
json
{ "action": "get_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }

Update Block Text

更新区块文本

json
{ "action": "update_block", "doc_token": "ABC123def", "block_id": "doxcnXXX", "content": "New text" }
json
{ "action": "update_block", "doc_token": "ABC123def", "block_id": "doxcnXXX", "content": "New text" }

Delete Block

删除区块

json
{ "action": "delete_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }
json
{ "action": "delete_block", "doc_token": "ABC123def", "block_id": "doxcnXXX" }

Reading Workflow

读取工作流

  1. Start with
    action: "read"
    - get plain text + statistics
  2. Check
    block_types
    in response for Table, Image, Code, etc.
  3. If structured content exists, use
    action: "list_blocks"
    for full data
  1. 先执行
    action: "read"
    ——获取纯文本内容和统计信息
  2. 检查响应中的
    block_types
    字段,查看是否包含表格、图片、代码等类型
  3. 如果存在结构化内容,使用
    action: "list_blocks"
    获取完整数据

Configuration

配置

yaml
channels:
  feishu:
    tools:
      doc: true  # default: true
Note:
feishu_wiki
depends on this tool - wiki page content is read/written via
feishu_doc
.
yaml
channels:
  feishu:
    tools:
      doc: true  # default: true
注意:
feishu_wiki
依赖此工具——wiki页面的内容通过
feishu_doc
进行读写。

Permissions

权限

Required:
docx:document
,
docx:document:readonly
,
docx:document.block:convert
,
drive:drive
所需权限:
docx:document
,
docx:document:readonly
,
docx:document.block:convert
,
drive:drive