ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

feishu-send-file

飞书发送文件技能。用于通过飞书向用户发送普通文件附件(HTML、ZIP、PDF、代码文件等)以及处理“本地图片路径被发成路径文本”的可靠补救场景。普通文件必须先上传获取 `file_key` 再发送;当本地图片用 `message`/`media` 发送后在飞书里只显示 `/root/...png` 路径而不显示图片时,改用本技能内的稳定图片上传脚本(`im/v1/images` -> `image_key` -> `msg_type=image`)。

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/dadaniya99/feishu-send-file
Or

飞书发送文件

飞书机器人发送普通文件(非图片/视频)需要两步:先上传文件获取 file_key,再用 file_key 发消息。

如果本地图片通过常规 message / media 路径发送后,用户在飞书里看到的是 /root/...png 路径文本而不是图片本体,不要继续重试同一种方式;直接改走本技能的稳定图片上传脚本

快速流程

方式一:用脚本(推荐)

python3 scripts/send_file.py <file_path> <open_id> <app_id> <app_secret> [file_name]

参数说明:

  • file_path: 要发送的文件路径(HTML/PDF/ZIP/代码文件等)
  • open_id: 接收者的 open_id(从 inbound_meta 的 chat_id 字段获取,格式为 user:ou_xxx,取 ou_xxx 部分)
  • app_id: 飞书应用 ID(从 openclaw.jsonchannels.feishu.appId 读取)
  • app_secret: 飞书应用密钥(从 openclaw.jsonchannels.feishu.appSecret 读取)
  • file_name: 可选,自定义文件名(不填则用原文件名)

快速获取配置:

# 获取 app_id 和 app_secret
grep -A 2 '"feishu"' /root/.openclaw/openclaw.json | grep -E '(appId|appSecret)'

完整示例:

python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_file.py \
  /root/myfiles/report.html \
  <USER_OPEN_ID> \
  <YOUR_APP_ID> \
  <YOUR_APP_SECRET> \
  report.html

AI 助手使用示例:

# 当需要发送文件给用户时,直接调用脚本
exec(f"""
python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_file.py \\
  {file_path} \\
  {user_open_id} \\
  {app_id} \\
  {app_secret} \\
  {custom_filename}
""")

方式二:手动两步

Step 1 - 上传文件:

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":"<APP_ID>","app_secret":"<APP_SECRET>"}' | python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])")

FILE_KEY=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file_type=stream" \
  -F "file_name=<文件名>" \
  -F "file=@<文件路径>" | python3 -c "import json,sys; print(json.load(sys.stdin)['data']['file_key'])")

Step 2 - 发送消息:

curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"receive_id\":\"<OPEN_ID>\",\"msg_type\":\"file\",\"content\":\"{\\\"file_key\\\":\\\"$FILE_KEY\\\"}\"}"

稳定发送图片(2026-03-15 补充)

什么时候不要再硬用 message + media

如果你把本地图片路径(尤其是 /root/myfiles/...)传给飞书消息链路后,用户在飞书里看到的是:

  • 📎 /root/myfiles/xxx.png
  • 或纯本地路径文本

那就说明这次没有真正发成图片。不要继续重试同一种参数组合。

原因(真实世界版)

  • 飞书真正的图片消息不是“把本地路径塞给消息发送器”
  • 正路是:先上传到 im/v1/images,拿到 image_key,再发送 msg_type=image
  • OpenClaw / Feishu 插件在某些本地路径场景下(特别是 /root/myfiles/...)可能无法走通本地媒体上传链路,随后自动降级成把路径文本发出去
  • 所以:messageId 返回成功 不等于 用户真的看到了图片

成功标准

只有一个成功标准:用户在飞书里实际看到图片本体。

如果回显的是路径文本,就视为失败。

推荐脚本(稳定版)

python3 scripts/send_image.py <image_path> <open_id> <app_id> <app_secret> [domain]

示例:

python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_image.py \
  /root/myfiles/generated-images/demo.png \
  <USER_OPEN_ID> \
  <YOUR_APP_ID> \
  <YOUR_APP_SECRET>

如果是国际版 Lark:

Metadata

Stars3409
Views0
Updated2026-03-25
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-dadaniya99-feishu-send-file": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.

Related Skills

evomap-gep

Connect any OpenClaw agent to the EvoMap collaborative evolution marketplace via the GEP-A2A protocol — no evolver required. Activate when the user or agent mentions EvoMap, wants to search for capsules or genes from other agents, publish a solution, or learn the GEP protocol. sender_id is auto-detected from MEMORY.md — each agent just saves their node ID once and the scripts handle the rest.

dadaniya99 3409

feishu-card

飞书互动卡片发送技能(国际版 Feishu 兼容)。当需要发送格式丰富的飞书卡片消息时使用。支持标题、Markdown 内容、颜色主题。关键:必须使用 schema 2.0 格式 + 双重 JSON stringify,否则国际版飞书(Feishu)无法渲染。

dadaniya99 3409

pdf-ocr

PDF扫描件转Word文档。支持中文OCR识别,自动裁掉页眉页脚,保留插图,彩色章节封面页保留为图片。使用百度OCR API(免费额度1000次/月)。当用户要求把扫描PDF转成文字/Word时触发。

dadaniya99 3409

sketch-illustration

插画图片生成技能,支持多种手绘风格。使用 Imagen 3(ZenMux API)生成插图,适合流程图、功能说明、PPT配图、教程配图、知识图和手绘信息图等场景。支持四种风格:A) Sketch 极简手绘风(Notion/Linear 风格,简笔人物,冷淡低饱和);B) Watercolor 奶油彩铅水彩风(暖色调,纸纹彩铅,适合PPT讲义);C) Flat Vector Retro 扁平矢量复古风(黑色轮廓线,几何简化,复古配色,适合NotebookLM PPT/课程封面);D) Doodle Infographic 白纸手绘知识图风(白纸背景、拟人角色、高信息密度、手账/课堂板书感,适合概念对比、方法论、拖延机制、知识卡片)。生成后自动上传发送到飞书。当用户要求生成插画、配图、手绘风格图、流程示意图、产品插图、PPT配图、知识图、信息图、手绘知识海报时触发此技能。

dadaniya99 3409

eudic-vocab

欧路词典生词本管理与每日测试技能。支持自动从欧路词典收藏夹出题、管理单词、删除已掌握词汇。适合每日背单词使用。

dadaniya99 3409