ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

feishu-file-manager

飞书云盘文件管理技能。用于读取、下载和管理飞书云盘中的文件。 当用户需要:访问飞书文件、下载文档、读取PDF/Word/PPT文件、分析飞书云盘内容时使用。 核心方法:使用 tenant_access_token 调用 Drive API 下载文件,解析内容返回给用户。

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/caspian9/feishu-file-manager
Or

Feishu File Manager | 飞书文件管理器

快速开始

1. 获取凭据

飞书凭据在 ~/.openclaw/openclaw.json 中:

{
  "channels": {
    "feishu": {
      "appId": "cli_xxx",
      "appSecret": "xxx"
    }
  }
}

2. 获取 Token

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

返回:{"tenant_access_token": "t-xxx", "expire": 7200, "msg": "ok"}

Token 有效期:约 2 小时,超时后重新获取

3. 访问文件

3.1 从链接提取文件 Token

链接格式Token 位置
/file/XXXXXXXXXX
/docx/XXXXXXXXXX
/drive/folder/XXXXXXXXXX

3.2 下载文件

curl -s -X GET 'https://open.feishu.cn/open-apis/drive/v1/files/{file_token}/download' \
  -H 'Authorization: Bearer {tenant_access_token}' \
  -o /tmp/filename.ext

3.3 读取内容

文件类型读取方法
.docxPython unzip 解析 word/document.xml
.pdfpdftotext 或 pdf 工具
.pptxpython-pptx 库
.xlsxopenpyxl 库

权限清单 | Required Permissions

云盘 Drive

权限 scope说明
drive:drive云盘能力总览
drive:file文件基础操作
drive:file:readonly只读文件
drive:file:download下载文件
drive:drive:readonly只读云盘元信息

文档 Docx

权限 scope说明
docx:document文档基础能力
docx:document:readonly只读文档内容
docx:document:write_only写入文档

表格 Sheets

权限 scope说明
sheets:spreadsheet表格基础能力
sheets:spreadsheet:read读取表格

多维表格 Bitable

权限 scope说明
bitable:app多维表格应用
bitable:app:readonly只读多维表格

知识库 Wiki

权限 scope说明
wiki:wiki知识库基础
wiki:node:read读取知识库节点

验证方法 | Validation

验证 Token 有效性

curl -s 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal' \
  -H 'Content-Type: application/json' \
  -d '{"app_id": "cli_xxx", "app_secret": "xxx"}'
  • 返回 {"msg": "ok"} = 有效
  • 返回 {"msg": "invalid app_id or app_secret"} = 无效

验证文件访问权限

curl -s 'https://open.feishu.cn/open-apis/drive/v1/files/{file_token}' \
  -H 'Authorization: Bearer {token}'
  • 返回文件信息 = 有权限
  • 返回 {"code": 99, "msg": "file not found"} = 无权限或文件不存在

验证文件夹访问

curl -s 'https://open.feishu.cn/open-apis/drive/v1/files?parent_node={folder_token}' \
  -H 'Authorization: Bearer {token}'
  • 返回文件列表 = 有权限
  • 返回空列表可能无权限或文件夹为空

错误处理 | Error Handling

错误码含义解决方案
99文件不存在/无权限检查 token 或文件是否分享给机器人
404API 路径错误检查 API URL
401Token 过期重新获取 tenant_access_token
10001系统错误稍后重试

文件读取示例

Python 读取 DOCX

from zipfile import ZipFile
import re

Metadata

Author@caspian9
Stars4072
Views1
Updated2026-04-13
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-caspian9-feishu-file-manager": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.