|
飞书凭据在 ~/.openclaw/openclaw.json 中:
json
{
channels: {
feishu: {
appId: cli_xxx,
appSecret: xxx
}
}
}
bash
curl -s -X POST https://open.feishu.cn/open-apis/auth/v3/tenantaccesstoken/internal \
-H Content-Type: application/json \
-d {appid: clixxx, app_secret: xxx}
返回:{tenantaccesstoken: t-xxx, expire: 7200, msg: ok}
Token 有效期:约 2 小时,超时后重新获取
| 链接格式 | Token 位置 |
|---|---|
| /file/XXXXX | XXXXX |
| /docx/XXXXX |
bash
curl -s -X GET https://open.feishu.cn/open-apis/drive/v1/files/{file_token}/download \
-H Authorization: Bearer {tenantaccesstoken} \
-o /tmp/filename.ext
| 文件类型 | 读取方法 |
|---|---|
| .docx | Python unzip 解析 word/document.xml |
| 权限 scope | 说明 |
|---|---|
| drive:drive | 云盘能力总览 |
| drive:file |
| 权限 scope | 说明 |
|---|---|
| docx:document | 文档基础能力 |
| docx:document:readonly |
| 权限 scope | 说明 |
|---|---|
| sheets:spreadsheet | 表格基础能力 |
| sheets:spreadsheet:read |
| 权限 scope | 说明 |
|---|---|
| bitable:app | 多维表格应用 |
| bitable:app:readonly |
| 权限 scope | 说明 |
|---|---|
| wiki:wiki | 知识库基础 |
| wiki:node:read |
bash
curl -s https://open.feishu.cn/open-apis/auth/v3/tenantaccesstoken/internal \
-H Content-Type: application/json \
-d {appid: clixxx, app_secret: xxx}
bash
curl -s https://open.feishu.cn/open-apis/drive/v1/files/{file_token} \
-H Authorization: Bearer {token}
bash
curl -s https://open.feishu.cn/open-apis/drive/v1/files?parentnode={foldertoken} \
-H Authorization: Bearer {token}
| 错误码 | 含义 | 解决方案 |
|---|---|---|
| 99 | 文件不存在/无权限 | 检查 token 或文件是否分享给机器人 |
| 404 |
python
from zipfile import ZipFile
import re
def read_docx(filepath):
with ZipFile(filepath) as z:
with z.open(word/document.xml) as f:
content = f.read().decode(utf-8)
text = re.sub(r<[^>]+>, , content)
return .join(text.split())
bash
pdftotext file.pdf - | head -100
python
from pptx import Presentation
def read_pptx(filepath):
prs = Presentation(filepath)
text = []
for slide in prs.slides:
for shape in slide.shapes:
if hasattr(shape, text):
text.append(shape.text)
return \n.join(text)
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 feishu-file-manager-1776206311 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 feishu-file-manager-1776206311 技能
skillhub install feishu-file-manager-1776206311
文件大小: 2.77 KB | 发布时间: 2026-4-15 12:05