Skills for Reading and Writing in Feishu Docs

389544 80119 Updated: 2026-07-13 18:51:06

Feishu Doc is a capability that enables comprehensive read and write operations on Feishu documents (Docx) using a single `feishu_doc` tool—with specific actions determined by the `action` parameter. It supports a wide range of functions, including document creation, reading, writing, and appending; table creation and data insertion; image and file uploads; and block-level management.

Install
npx skills add https://github.com/openclaw/openclaw --skill feishu-doc
Skill Details readonly

I. Skill Overview

This skill serves as the core document operation layer for the OpenClaw Feishu extension, activated when users reference Feishu documents, cloud docs, or docx links. It exposes a unified set of tool interfaces covering all common Feishu Doc operations, with full native support for Docx table creation & cell writing, plus image and file attachment upload capabilities.

II. Core Functional Capabilities

1. Token Extraction

Parse the unique document identifier from standard Feishu Doc URLs:
  • URL Format: https://xxx.feishu.cn/docx/ABC123def
  • Extracted Output: doc_token = ABC123def

2. Document Read Operation

json
{ "action": "read", "doc_token": "ABC123def" }
Returned payload includes document title, plaintext content, and block type statistics. If the response contains a hint field, structured content (tables, images, etc.) exists within the document; invoke list_blocks to retrieve full detailed structured data.

3. Full Document Overwrite Write

json
{ "action": "write", "doc_token": "ABC123def", "content": "# Title\n\nMarkdown content..." }
Replaces the entire document body with input Markdown. Supported Markdown elements: headings, bullet/numbered lists, code blocks, blockquotes, hyperlinks, embedded images (![](url) auto-triggers image upload), bold, italic, strikethrough text.
 
 Limitation: Markdown table syntax is unsupported.

4. Append Content to Document End

json
{ "action": "append", "doc_token": "ABC123def", "content": "Additional content" }
Inserts supplied Markdown content at the bottom of the target document.

5. New Document Creation

Basic creation syntax:
json
{ "action": "create", "title": "New Document", "owner_open_id": "ou_xxx" }
Specify target parent folder with folder_token:
json
{ "action": "create", "title": "New Document", "folder_token": "fldcnXXX", "owner_open_id": "ou_xxx" }
 Critical Mandatory Rule: The owner_open_id parameter (pulled from inbound request metadata sender_id) must be provided. If omitted, only the bot application gains document access, and the end user cannot view the generated document.

6. Granular Block-Level Operations

Operation Description
list_blocks Returns complete raw block dataset including tables and images for structured content parsing
get_block Fetch full detailed metadata for a single specified block
update_block Modify text content of a target block
delete_block Permanently remove a specified block from the document

7. Docx Table Block Dedicated Operations

Operation Description
create_table Initialize an empty table with defined row/column counts, configurable fixed column widths
write_table_cells Batch inject cell values into an existing table
create_table_with_values One-step workflow to generate a table and populate all cell data in a single call
All table operations accept an optional parent_block_id parameter to insert the table as a child of a designated parent block.

8. Image Upload Workflow

Upload images via remote public URL:
json
{ "action": "upload_image", "doc_token": "ABC123def", "url": "https://example.com/image.png" }
Upload local file with positional insertion control:
json
{ "action": "upload_image", "doc_token": "ABC123def", "file_path": "/tmp/image.png", "parent_block_id": "doxcnParent", "index": 5 }
  • index: Zero-based integer defining insertion order among sibling blocks; omitted values append the image to the document bottom.
     
     Display Note: Rendered image size is determined by native pixel dimensions. Small assets (e.g. 480×270 GIFs) must be scaled to a minimum width of 800px prior to upload to guarantee normal visible rendering.

9. File Attachment Upload Workflow

Upload attachments via remote URL source:
json
{ "action": "upload_file", "doc_token": "ABC123def", "url": "https://example.com/report.pdf" }
Upload local file with custom filename override:
json
{ "action": "upload_file", "doc_token": "ABC123def", "file_path": "/tmp/report.pdf", "filename": "Q1-report.pdf" }
 
Enforced Upload Rules:
  1. Exactly one source parameter (url or file_path) must be supplied; simultaneous dual input is prohibited.
  2. Optional filename field overrides the default stored file display name.
  3. Optional parent_block_id defines the target parent block for attachment embedding.

III. Standard Document Read Workflow

  1. Execute action: "read" to retrieve plaintext body and high-level block statistics
  2. Inspect returned block_types to detect structured elements (Tables, Images, Code blocks, etc.)
  3. If structured content exists, run action: "list_blocks" to pull complete raw structured block data

IV. Configuration Snippet

yaml
channels:
  feishu:
    tools:
      doc: true  # Default enabled state: true
Dependency Note: The feishu_wiki skill relies entirely on this tool; all Wiki page read/write logic is powered by the feishu_doc operation layer.

V. Required API Permission Scopes

  • docx:document
  • docx:document:readonly
  • docx:document.block:convert
  • drive:drive

VI. Primary Applicable Use Cases

  1. Feishu Document Content Retrieval: Extract document titles, body text, and block statistics for downstream analysis and automated processing pipelines
  2. Automated Document Creation: Generate new Feishu Doc instances with guaranteed full end-user access permissions
  3. Bulk Write & Incremental Append: Batch replace full document bodies via Markdown input, or append supplementary content to existing docs
  4. Structured Table Management: Create empty tables, batch populate cell datasets, or initialize pre-filled tables in one atomic operation
  5. Media & Attachment Embedding: Upload images and arbitrary file attachments to precise target positions within Feishu Docs
  6. Fine-Grained Block Editing: Isolate, modify, or delete individual discrete blocks inside a document
  7. Wiki Page Backend Dependency: Acts as the underlying data layer for the feishu_wiki skill to enable full Wiki page read/write functionality

VII. Critical Governing Principles

  1. Mandatory owner_open_id for document creation: Omission restricts document visibility exclusively to the bot application, blocking end user access.
  2. Markdown table syntax unsupported: Tables cannot be generated via standard Markdown write actions; dedicated table operation endpoints must be used instead.
  3. Pre-scale small image assets: Resize narrow visual assets to a minimum 800px width before upload to avoid broken rendering.
  4. Two-stage structured content retrieval: The read action only returns a hint flag for tables/images; full structured data requires a subsequent list_blocks call.
  5. Mutually exclusive file upload sources: Only one of url or file_path may be specified per upload request.

VIII. Summary

Feishu Doc is the foundational document manipulation skill powering OpenClaw’s Feishu integration extension. The unified feishu_doc tool delivers full CRUD functionality for Feishu Docx files: full document reading, overwrites, incremental appends, new document generation, structured table operations, media/file attachment uploads, and precise block-level editing. It functions both as a standalone tool for direct Feishu Doc automation and a mandatory backend dependency for the feishu_wiki skill to support Wiki content workflows. Built for end-to-end automated document management within the Feishu ecosystem, it constitutes the core content processing layer of OpenClaw’s Feishu platform integration.