← Back to Skills Marketplace
alfredxia-ai

Feishu Doc Reader

by AlfredXia-AI · GitHub ↗ · v0.1.2 · MIT-0
cross-platform ⚠ suspicious
433
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install feishu-document-reader
Description
Read and extract content from all Feishu (Lark) document types using the official Feishu Open API
README (SKILL.md)

Feishu Document Reader

This skill enables reading and extracting content from all Feishu (Lark) document types using the official Feishu Open API.

Configuration

Set Up the Skill

  1. Create the configuration file at ./reference/feishu_config.json with your Feishu app credentials:
{
  "app_id": "your_feishu_app_id_here",
  "app_secret": "your_feishu_app_secret_here"
}
  1. Make sure the scripts are executable:
chmod +x scripts/read_doc.sh
chmod +x scripts/read_feishu.sh
chmod +x scripts/get_blocks.sh

Security Note: The configuration file should be kept secure and not committed to version control. Consider using proper file permissions (chmod 600 ./reference/feishu_config.json).

Usage

Unified Document Reader (推荐)

使用统一文档读取器可以自动识别并读取所有支持的文档类型:

# 自动识别文档类型并读取
./scripts/read_feishu.sh "docx_xxxxxxxxxxxxxx"
./scripts/read_feishu.sh "sheet_xxxxxxxxxxxxx"
./scripts/read_feishu.sh "basexxxxxxxxxxxxxx"
./scripts/read_feishu.sh "wikcnxxxxxxxxxxxxx"

# 从URL直接读取
./scripts/read_feishu.sh "https://xxx.feishu.cn/docx/xxxxx"

# 指定文档类型
./scripts/read_feishu.sh "token" --type bitable

# 格式化JSON输出
./scripts/read_feishu.sh "token" --pretty

# 只输出文本内容
./scripts/read_feishu.sh "docx_token" --output text

Wiki Knowledge Base (知识库)

读取飞书知识库节点和内容:

# 读取单个Wiki节点
./scripts/read_feishu.sh "wikcnxxxxxxxxxxxxxx" --type wiki

# 读取整个知识空间
./scripts/read_feishu.sh --wiki-space "SPACE_ID"

# 递归读取所有子节点内容
./scripts/read_feishu.sh --wiki-space "SPACE_ID" --recursive

Bitable (多维表格)

读取飞书多维表格数据:

# 读取多维表格(包含所有数据表和记录)
./scripts/read_feishu.sh "basexxxxxxxxxxxxxx" --type bitable

Basic Document Reading

# 读取新版文档
./scripts/read_doc.sh "docx_xxxxxxxxxxxxxx"

# 读取电子表格
./scripts/read_doc.sh "sheet_xxxxxxxxxxxxx" sheet

# 读取多维表格
./scripts/read_doc.sh "basexxxxxxxxxxxxxx" bitable

# 读取知识库节点
./scripts/read_doc.sh "wikcnxxxxxxxxxxxxx" wiki

Get Detailed Document Blocks

For complete document structure with all blocks:

# Get full document blocks structure
./scripts/get_blocks.sh "docx_AbCdEfGhIjKlMnOpQrStUv"

Using Python directly:

python scripts/feishu_reader.py "docx_token" --pretty
python scripts/feishu_reader.py "sheet_token" --type sheet
python scripts/feishu_reader.py --wiki-space "SPACE_ID" --recursive

Supported Document Types

类型 Token前缀 说明 支持程度
docx docx_ 新版飞书文档 ✅ 完整支持
doc doc_ 旧版飞书文档 ✅ 基本支持
sheet sheet_, shtcn 电子表格 ✅ 完整支持
bitable base, bascn 多维表格 ✅ 完整支持
wiki wikcn 知识库节点 ✅ 完整支持
slides - 幻灯片 ⚠️ 仅元数据

Features

Enhanced Content Extraction

  • Structured output: Clean JSON with document metadata, content blocks, and hierarchy
  • Complete blocks access: Full access to all document blocks including text, tables, images, headings, lists, etc.
  • Block hierarchy: Proper parent-child relationships between blocks
  • Text extraction: Automatic text extraction from complex block structures
  • Table support: Proper table parsing with row/column structure
  • Image handling: Image URLs and metadata extraction
  • Link resolution: Internal and external link extraction

Block Types Supported

  • text: Plain text and rich text content
  • heading1/2/3: Document headings with proper hierarchy
  • bullet/ordered: List items with nesting support
  • table: Complete table structures with cells and formatting
  • image: Image blocks with tokens and metadata
  • quote: Block quotes
  • code: Code blocks with language detection
  • equation: Mathematical equations
  • divider: Horizontal dividers
  • page: Page breaks (in multi-page documents)

Error Handling & Diagnostics

  • Detailed error messages: Clear explanations for common issues
  • Permission validation: Checks required permissions before making requests
  • Token validation: Validates document tokens before processing
  • Retry logic: Automatic retries for transient network errors
  • Rate limiting: Handles API rate limits gracefully

Security Features

  • Secure credential storage: Supports both environment variables and secure file storage
  • No credential logging: Credentials never appear in logs or output
  • Minimal permissions: Uses only required API permissions
  • Access token caching: Efficient token reuse to minimize API calls

Command Line Options

Main Document Reader

# Python script options
python scripts/read_feishu_doc.py --help

# Shell script usage
./scripts/read_doc.sh \x3Cdoc_token> [doc|sheet|slide]

Blocks Reader (NEW)

# Get full document blocks
./scripts/get_blocks.sh \x3Cdoc_token>

# Get specific block
./scripts/get_blocks.sh \x3Cdoc_token> \x3Cblock_id>

# Include children blocks
./scripts/get_blocks.sh \x3Cdoc_token> "" true

# Python options
python scripts/get_feishu_doc_blocks.py --help

API Permissions Required

Your Feishu app needs the following permissions based on document types:

基础权限(必需)

  • docx:document:readonly - 读取新版文档内容
  • doc:document:readonly - 读取旧版文档内容

电子表格

  • sheets:spreadsheet:readonly - 读取电子表格内容

多维表格 (Bitable)

  • bitable:app:readonly - 读取多维表格元信息
  • bitable:record:read - 读取多维表格记录

知识库 (Wiki)

  • wiki:wiki:readonly - 读取知识库节点信息

云空间(可选)

  • drive:drive:readonly - 读取云空间文件信息

Error Handling

Common errors and solutions:

认证错误

  • 401 Unauthorized: 检查 App ID 和 App Secret 是否正确
  • Token expired: 访问令牌2小时过期,会自动刷新

权限错误

  • 403 Forbidden: 检查应用权限配置和文档共享设置
  • 99991663: 应用没有访问该文档的权限
  • 10002: 应用权限不足,请在开放平台配置所需权限

资源错误

  • 404 Not Found: 检查文档token是否正确
  • 99991664: 文档不存在或已被删除

特定类型错误

  • Wiki节点无法读取: 检查 wiki:wiki:readonly 权限
  • Bitable记录为空: 检查 bitable:record:read 权限
  • Sheet数据缺失: 检查工作表是否有数据,权限是否足够

Examples

读取各类文档

# 新版文档 (docx)
./scripts/read_feishu.sh "docx_AbCdEfGhIjKlMnOp" --pretty

# 电子表格 (sheet)
./scripts/read_feishu.sh "sheet_XyZ123AbCdEfGh" --type sheet

# 多维表格 (bitable)
./scripts/read_feishu.sh "baseAbCdEfGhIjKlMn" --type bitable --pretty

# 知识库节点 (wiki)
./scripts/read_feishu.sh "wikcnAbCdEfGhIjKl" --type wiki

知识库操作

# 读取单个节点及其内容
./scripts/read_feishu.sh "wikcnAbCdEfGhIjKl" --type wiki --pretty

# 读取整个知识空间
./scripts/read_feishu.sh --wiki-space "7xxxxxxxxxx" --pretty

# 递归读取知识空间所有内容
./scripts/read_feishu.sh --wiki-space "7xxxxxxxxxx" --recursive

从URL读取

# 直接从飞书URL读取(自动识别类型)
./scripts/read_feishu.sh "https://xxx.feishu.cn/docx/xxxxx"
./scripts/read_feishu.sh "https://xxx.feishu.cn/wiki/xxxxx"
./scripts/read_feishu.sh "https://xxx.feishu.cn/base/xxxxx"

输出格式控制

# JSON格式(默认)
./scripts/read_feishu.sh "docx_token"

# 格式化JSON
./scripts/read_feishu.sh "docx_token" --pretty

# 仅输出纯文本
./scripts/read_feishu.sh "docx_token" --output text

Python直接调用

# 统一读取器
python scripts/feishu_reader.py "docx_token" --pretty
python scripts/feishu_reader.py "base_token" --type bitable
python scripts/feishu_reader.py --wiki-space "SPACE_ID" --recursive

# 文档blocks专用
python scripts/get_feishu_doc_blocks.py "docx_token"

Security Notes

  • Never commit credentials: Keep app secrets out of version control
  • Use minimal permissions: Only request permissions your use case requires
  • Secure file permissions: Set proper file permissions on secret files (chmod 600)
  • Environment isolation: Use separate apps for development and production
  • Audit access: Regularly review which documents your app can access

Troubleshooting

Authentication Issues

  1. Verify your App ID and App Secret in Feishu Open Platform
  2. Ensure the app has been published with required permissions
  3. Check that environment variables or config files are properly set
  4. Test with the test_auth.py script to verify credentials

Document Access Issues

  1. Ensure the document is shared with your app or in an accessible space
  2. Verify the document token format (should start with docx_, doc_, or sheet_)
  3. Check if the document requires additional sharing permissions

Network Issues

  1. Ensure your server can reach open.feishu.cn
  2. Check firewall rules if running in restricted environments
  3. The script includes retry logic for transient network failures

Blocks-Specific Issues

  1. Empty blocks response: Document might be empty or have no accessible blocks
  2. Missing block types: Some block types require additional permissions
  3. Incomplete hierarchy: Use --include-children flag for complete block tree

References

官方文档

文档相关

表格相关

知识库相关

Usage Guidance
This skill appears to implement what it claims (reading Feishu/Lark documents via the official API) and only needs a Feishu app_id and app_secret. Before installing: (1) don't rely on the registry metadata — create ./reference/feishu_config.json or set FEISHU_APP_ID and FEISHU_APP_SECRET and protect it (chmod 600). (2) Inspect and avoid running test_auth.py in production because it prints a truncated token (could leak); similarly avoid enabling debug logs that might reveal secrets. (3) Confirm you trust the source; the package has no remote install steps but will execute local Python/shell scripts. (4) Ask the publisher to correct the registry metadata to list required credentials and binaries so automated vetting and permission reviews are accurate.
Capability Analysis
Type: OpenClaw Skill Name: feishu-document-reader Version: 0.1.2 The skill bundle is a legitimate tool for interacting with the Feishu (Lark) Open API to read and extract content from various document types. The implementation in scripts like `feishu_reader.py` and `get_feishu_doc_blocks.py` follows official Feishu documentation for authentication and data retrieval, using standard practices for credential management via local configuration files or environment variables. No evidence of malicious behavior, data exfiltration to unauthorized endpoints, or prompt injection was found; all network activity is directed to the official `open.feishu.cn` domain.
Capability Assessment
Purpose & Capability
The Python and shell scripts implement Feishu Open API calls and clearly match the described purpose of reading Feishu (Lark) documents. However, the skill metadata in the registry declares no required credentials or binaries while the SKILL.md and scripts require Python (python3) and an app_id/app_secret (either in ./reference/feishu_config.json or FEISHU_APP_ID / FEISHU_APP_SECRET). The missing declaration of required credentials/binaries in registry metadata is an inconsistency.
Instruction Scope
SKILL.md and the included scripts limit their actions to loading credentials from a local config file or environment variables and calling official Feishu API endpoints (open.feishu.cn). The instructions do not instruct the agent to read arbitrary unrelated files or call external endpoints beyond Feishu. One minor scope mismatch: documentation states 'credentials never appear in logs', but the provided test_auth.py prints a truncated tenant_access_token, which contradicts that claim and could leak sensitive info if run carelessly.
Install Mechanism
There is no install spec (instruction-only in registry), and the repository provides Python scripts and shell wrappers that are intended to be executed directly. No remote downloads, obscure URLs, or archive extraction steps are present. Running the included scripts will execute local code, so standard caution about running third-party scripts applies.
Credentials
The code legitimately needs Feishu app credentials (app_id and app_secret). The registry metadata claims no required environment variables or primary credential, which is incorrect and reduces transparency. Sensitive values (app_secret / tenant_access_token) are used at runtime; while main scripts avoid printing them, the test helper script (test_auth.py) prints a truncated tenant token and some docs mention DEBUG logging—these could lead to accidental exposure if used without care. The required credentials are proportionate to the skill's purpose, but the omission from metadata is a red flag.
Persistence & Privilege
The skill does not request always: true, does not modify other skills' configurations, and does not attempt system-wide persistence. It only reads local config files or environment variables and makes network calls to Feishu APIs.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install feishu-document-reader
  3. After installation, invoke the skill by name or use /feishu-document-reader
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.2
Remove credentials from config example
v0.1.1
Fix script file permissions (chmod +x)
Metadata
Slug feishu-document-reader
Version 0.1.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Feishu Doc Reader?

Read and extract content from all Feishu (Lark) document types using the official Feishu Open API. It is an AI Agent Skill for Claude Code / OpenClaw, with 433 downloads so far.

How do I install Feishu Doc Reader?

Run "/install feishu-document-reader" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Feishu Doc Reader free?

Yes, Feishu Doc Reader is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Feishu Doc Reader support?

Feishu Doc Reader is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Feishu Doc Reader?

It is built and maintained by AlfredXia-AI (@alfredxia-ai); the current version is v0.1.2.

💬 Comments