Feishu Media Delivery
Use this skill as the last-mile delivery layer for multimodal agents.
It does not generate content.
It only makes sure already-generated files are sent to Feishu with the correct protocol.
What this skill is for
Use this skill when you already have a generated result and need to deliver it to a Feishu user/chat.
Typical cases:
- - A generated jpg/png must be sent as a real Feishu image message
- A generated mp4 must be sent as a real Feishu media message
- A multimodal agent finished generation and now needs reliable delivery
- You want to avoid protocol mistakes like sending jpg/mp4 as the wrong message type
Hard rules
Images
For images, do
not send the local file as plain text or guess a generic attachment format.
Correct flow:
- 1. Upload image to Feishu IM resource API
- Get INLINECODE0
- Send message with INLINECODE1
Use:
Videos
For mp4 videos, do
not send them as
file messages.
Correct flow:
- 1. Upload mp4 to Feishu IM file API
- Get INLINECODE4
- Send message with INLINECODE5
Use:
Required environment
The scripts expect:
- - INLINECODE7
- INLINECODE8 or default secret file at INLINECODE9
Default secret path:
Receive ID assumptions
The bundled scripts default to receive_id_type=open_id.
Use them directly when the target is a Feishu user open_id like:
If you need group delivery later, extend the script to accept chat_id and switch receive_id_type.
Commands
Send image to a Feishu user
CODEBLOCK0
Example:
CODEBLOCK1
Send mp4 video to a Feishu user
CODEBLOCK2
Arguments:
- - arg1: target open_id
- arg2: local mp4 path
- arg3: file type, usually INLINECODE16
- arg4: duration in milliseconds, optional but recommended
Example:
CODEBLOCK3
Output expectations
A successful send should return Feishu success payloads such as:
- - INLINECODE17
- INLINECODE18
Do not assume transport success only from local script execution.
Check the returned Feishu response.
Fallback policy
Image fallback
If real Feishu image sending fails, report that image delivery failed.
Do not silently pretend the image was delivered.
Video fallback
If Feishu media sending fails, fallback to sending a direct link if one exists.
State clearly that this is a fallback.
Recommended agent usage
For a multimodal content agent, use this skill after generation:
- - image result -> INLINECODE19
- mp4 result -> INLINECODE20
This keeps protocol details out of the model prompt and reduces failure risk for weaker models.
飞书媒体投递
将此技能用作多模态智能体的最后一公里投递层。
它不生成内容。
它仅确保已生成的文件通过正确的协议发送到飞书。
此技能的用途
当你已有生成结果并需要将其投递给飞书用户/会话时,使用此技能。
典型场景:
- - 生成的jpg/png文件必须以真实的飞书图片消息发送
- 生成的mp4文件必须以真实的飞书媒体消息发送
- 多模态智能体完成生成后,需要可靠的投递
- 你想避免协议错误,例如将jpg/mp4以错误的消息类型发送
硬性规则
图片
对于图片,
不要将本地文件作为纯文本发送,也不要猜测为通用附件格式。
正确流程:
- 1. 将图片上传至飞书IM资源API
- 获取imagekey
- 使用msgtype=image发送消息
使用:
视频
对于mp4视频,
不要将其作为file消息发送。
正确流程:
- 1. 将mp4上传至飞书IM文件API
- 获取filekey
- 使用msgtype=media发送消息
使用:
所需环境
脚本需要:
- - FEISHUAPPID
- FEISHUAPPSECRETPATH或默认密钥文件~/.openclaw/secrets/feishuapp_secret
默认密钥路径:
- - ~/.openclaw/secrets/feishuappsecret
接收ID假设
捆绑脚本默认使用receiveidtype=open_id。
当目标为飞书用户openid(如ouxxx)时,直接使用它们。
如果后续需要群组投递,请扩展脚本以接受chatid并切换receiveid_type。
命令
向飞书用户发送图片
bash
cd scripts
node send-image.mjs /path/to/image.jpg
示例:
bash
cd scripts
node send-image.mjs ou_xxx /tmp/result.jpg
向飞书用户发送mp4视频
bash
cd scripts
node send-media.mjs /path/to/video.mp4 mp4 5000
参数:
- - 参数1:目标open_id
- 参数2:本地mp4路径
- 参数3:文件类型,通常为mp4
- 参数4:时长(毫秒),可选但推荐
示例:
bash
cd scripts
node send-media.mjs ou_xxx /tmp/result.mp4 mp4 5000
输出预期
成功发送应返回飞书成功负载,例如:
不要仅凭本地脚本执行就认为传输成功。
请检查返回的飞书响应。
降级策略
图片降级
如果真实的飞书图片发送失败,报告图片投递失败。
不要默默假装图片已投递。
视频降级
如果飞书媒体发送失败,若存在直接链接则降级为发送链接。
明确说明这是降级方案。
推荐智能体用法
对于多模态内容智能体,在生成后使用此技能:
- - 图片结果 -> send-image.mjs
- mp4结果 -> send-media.mjs
这可以将协议细节从模型提示中剥离,并降低弱模型的失败风险。