飞书媒体发送技能
name: feishu-media
by a1024708231 · published 2026-04-01
$ claw add gh:a1024708231/a1024708231-feishu-media-new---
name: feishu-media
description: 飞书媒体文件发送技能。适用于:发送文件、图片、URL图片、视频、音频、语音消息,以及打包压缩后发送。当用户要求在飞书中发送任何类型的媒体文件时激活此技能。
---
# 飞书媒体发送技能
通过 `message` 工具向飞书发送各类媒体文件。
核心用法
所有媒体发送都通过 `message` 工具的 `action=send`,关键参数:
---
1. 发送本地文件(PDF/DOC/XLS/PPT/TXT等)
message action=send channel=feishu filePath=/path/to/file.pdf message="文件说明"支持格式:pdf, doc/docx, xls/xlsx, ppt/pptx, txt, csv, zip, tar.gz 等。
2. 发送本地图片
message action=send channel=feishu filePath=/path/to/image.png message="图片说明"支持格式:jpg, jpeg, png, gif, webp, bmp。
3. 发送 URL 图片
message action=send channel=feishu media=https://example.com/image.png message="网络图片"4. 发送视频(重要:需要用 exec+curl 方式)
**⚠️ 注意**:OpenClaw 飞书频道的 `filePath` 参数不支持本地视频文件。
需要用以下 exec+curl 方式发送视频:
# 1. 获取 tenant_access_token(需要飞书应用的 appId 和 appSecret)
TOKEN_RESP=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d '{"app_id":"你的appId","app_secret":"你的appSecret"}')
TOKEN=$(echo $TOKEN_RESP | grep -o '"tenant_access_token":"[^"]*"' | cut -d'"' -f4)
# 2. 上传视频文件(必须用 file_type=stream)
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
-H "Authorization: Bearer $TOKEN" \
-F "file_type=stream" \
-F "file_name=视频文件名.mp4" \
-F "file=@/path/to/video.mp4"
# 3. 用返回的 file_key 发送消息
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\"}"
}'**关键点**:
支持格式:mp4, mov, avi。
5. 发送音频(非语音)
MP3 等音频文件作为普通文件发送:
message action=send channel=feishu filePath=/path/to/audio.mp3 message="音频文件"6. 发送语音消息(可播放的语音条)
语音消息需要 **Ogg/Opus 格式**。飞书会显示为可播放的语音条。
6.1 直接发送 opus/ogg 文件
message action=send channel=feishu filePath=/path/to/voice.opus message="语音消息"6.2 从 MP3 转换后发送
先用 ffmpeg 转换格式:
ffmpeg -i input.mp3 -ar 16000 -ac 1 -acodec libopus output.ogg -y然后发送 output.ogg。
6.3 技术细节
语音消息的底层流程:
1. 上传:`im.file.create`,`file_type: "opus"`,需带 `duration`(毫秒)
2. 发送:`msg_type: "audio"`,content: `{"file_key":"xxx","duration":3007}`
3. duration 由 ffprobe 自动获取,无需手动指定
7. 打压缩包后发送
当需要发送多个文件或不支持的格式时,先打包再发送:
7.1 打 zip 包
zip -j /tmp/archive.zip /path/to/file1 /path/to/file27.2 打 tar.gz 包
tar czf /tmp/archive.tar.gz -C /path/to/dir .7.3 发送压缩包
message action=send channel=feishu filePath=/tmp/archive.zip message="打包文件"---
格式支持速查表
| 类型 | 格式 | 发送方式 | 飞书显示 |
|------|------|----------|----------|
| 图片 | jpg/png/gif/webp | filePath 或 media(URL) | 内嵌图片 |
| 文档 | pdf/doc/xls/ppt | filePath | 文件卡片 |
| 视频 | mp4/mov/avi | exec+curl (file_type=stream) | 文件卡片 |
| 音频 | mp3/wav/flac | filePath | 文件卡片 |
| 语音 | opus/ogg | filePath | 可播放语音条 |
| 压缩包 | zip/tar.gz | filePath | 文件卡片 |
| 网络图片 | URL | media | 内嵌图片 |
注意事项
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...