← 返回
开发者工具 Key 中文

feishu-doc-editor

Feishu document creation and editing operations using OpenAPI. Activate when user needs to create, edit, or read Feishu documents programmatically.
使用 OpenAPI 创建、编辑或读取 Feishu 文档,适用于需要编程方式操作文档的场景。
zhuligu
开发者工具 clawhub v1.0.0 1 版本 99664.3 Key: 需要
★ 1
Stars
📥 2,652
下载
💾 47
安装
1
版本
#latest

概述

Feishu Document Editor Skill

This skill provides comprehensive guidance for creating and editing Feishu documents using the Feishu OpenAPI.

Prerequisites

1. App Creation and Configuration

Create enterprise self-built app: Login to Feishu Open Platform, create an app and add "Bot" capability.

Apply for API permissions: In "Permission Management", apply for the following permissions:

  • Document editing: docx:document:write_only
  • Document viewing: docx:document:readonly

Publish app: Submit version and publish, ensuring the app coverage includes target users/departments.

2. Get Access Token

Call the self-built app get tenant_access_token interface:

curl -X POST https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal \
  -H "Content-Type: application/json" \
  -d '{"app_id": "your_app_id", "app_secret": "your_app_secret"}'

Response example:

{
  "code": 0,
  "tenant_access_token": "t-xxx",
  "expire": 7200
}

Core Operations

Extract Document ID

Get document_id from document URL:

Example URL: https://bigdatacenter.feishu.cn/docx/HpK2dtGu9omhMAxV12zcB6i7ngd

document_id = HpK2dtGu9omhMAxV12zcB6i7ngd

Grant App Document Permission

Manually add collaborator:

  • Open document in Feishu client → Click "..." in top right → "More" → "Add document app"
  • Search and add your app, grant "Can edit" permission.

Write Text Content

Interface: Create Block

  • Path parameters: document_id = document ID, block_id = document ID (root node is the document itself)
  • Request headers:

```http

Authorization: Bearer {tenant_access_token}

Content-Type: application/json

```

  • Request body example (write "hello"):

```json

{

"index": -1,

"children": [

{

"block_type": 2,

"text": {

"elements": [

{

"text_run": {

"content": "hello"

}

}

]

}

}

]

}

```

Read Document Content

Interface: Get Document Plain Text

curl -X GET "https://open.feishu.cn/open-apis/docx/v1/documents/{document_id}/plaintext" \
  -H "Authorization: Bearer {tenant_access_token}"

Response example:

{
  "code": 0,
  "data": {
    "content": "Document text content here"
  }
}

Common Issues

1. Permission Error (403 Forbidden)

  • Diagnosis: App not added as document collaborator, or tenant_access_token is invalid.
  • Solution: Re-add app as collaborator, or re-get tenant_access_token.

2. Missing Access Token (99991661)

  • Diagnosis: Request header does not carry Authorization: Bearer {token}.
  • Solution: Ensure tenant_access_token is correctly added to request header.

3. Document Not Found (404 Not Found)

  • Diagnosis: document_id is incorrect or document has been deleted.
  • Solution: Re-extract document_id from document URL.

Reference Documentation

  • Create Block Interface
  • Get Document Plain Text Interface
  • Permission Configuration Guide

Through the above steps, you can achieve editing Feishu documents via API, supporting add/delete/modify/query operations for multiple content types including text, tables, and images.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 01:12 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,954
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,758
developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 426 📥 118,085