飞书发送文件技能。用于通过飞书向用户发送普通文件附件(HTML、ZIP、PDF、代码文件等)以及处理“本地图片路径被发成路径文本”的可靠补救场景。普通文件必须先上传获取 `file_key` 再发送;当本地图片用 `message`/`media` 发送后在飞书里只显示 `/root/...png` 路径而不显示...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install feishu-send-file或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install feishu-send-file⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/feishu-send-file/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: feishu-send-file description: 飞书发送文件技能。用于通过飞书向用户发送普通文件附件(HTML、ZIP、PDF、代码文件等)以及处理“本地图片路径被发成路径文本”的可靠补救场景。普通文件必须先上传获取 file_key 再发送;当本地图片用 message/media 发送后在飞书里只显示 /root/...png 路径而不显示图片时,改用本技能内的稳定图片上传脚本(im/v1/images -> image_key -> msg_type=image)。 ---
飞书机器人发送普通文件(非图片/视频)需要两步:先上传文件获取 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.json 的 channels.feishu.appId 读取)app_secret: 飞书应用密钥(从 openclaw.json 的 channels.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\\\"}\"}"
message + media如果你把本地图片路径(尤其是 /root/myfiles/...)传给飞书消息链路后,用户在飞书里看到的是:
📎 /root/myfiles/xxx.png那就说明这次没有真正发成图片。不要继续重试同一种参数组合。
im/v1/images,拿到 image_key,再发送 msg_type=image/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:
python3 scripts/send_image.py <image_path> <open_id> <app_id> <app_secret> lark
im/v1/files -> file_key -> msg_type=fileim/v1/images -> image_key -> msg_type=image这两条链路不要混用。
filePath 参数只会显示路径message tool 的 media 参数可以工作;但如果用户看到的是路径文本而不是图片本体,立刻改用 scripts/send_image.py/root/myfiles/... 本地路径回显误判为发送成功receive_id_type=open_id 对应个人用户;群聊用 chat_id 并替换类型stream 适用于所有普通文件类型安装 feishu-send-file 后,可以对 AI 说这些话来触发它
Send a Slack message to the #engineering channel about the deployment
Formats and sends the message with relevant context, tagging the right people
Summarize all unread messages in my inbox from today
Reads messages across connected channels and returns a prioritized summary
Draft a reply to this customer complaint and send it for review
Writes an empathetic, professional response and routes it to the approval queue
将技能文件夹放到 ~/.claude/skills/feishu-send-file/ 目录(个人级,所有项目可用),或 .claude/skills/feishu-send-file/(项目级)。重启 AI 客户端后,用 /feishu-send-file 主动调用,或让 AI 根据上下文自动发现并使用。
feishu-send-file 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
feishu-send-file 可免费安装使用。请查阅仓库了解许可证信息。
飞书发送文件技能。用于通过飞书向用户发送普通文件附件(HTML、ZIP、PDF、代码文件等)以及处理“本地图片路径被发成路径文本”的可靠补救场景。普通文件必须先上传获取 `file_key` 再发送;当本地图片用 `message`/`media` 发送后在飞书里只显示 `/root/...png` 路径而不显示...
feishu-send-file 属于「Communication」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。