📦 Ali Feishu Sender — 飞书多媒体发送
v1.0.0通过 API 向飞书发送多媒体内容。适用于:(1) 向飞书用户/群发送图片、音频、视频、富文本或卡片,(2) 上传媒体到飞书,(3) 用户说“发送到飞书”,(4) 发布 MiniMax 生成的内容(图片、TTS、音乐、视频)到飞书。支持内联图片、语音气泡、视频播放器、富文本和交互式卡片。
详细分析 ▾
运行时依赖
版本
ali-feishu-sender 初始版本。——通过 API 向飞书用户或群发送多媒体(图片、音频、视频、富文本、交互式卡片)。支持内联图片、原生语音气泡(opus+时长)、内联视频播放器(mp4+时长+封面),以及嵌入媒体的富文本。自动处理媒体格式要求(如音频转 opus、视频 faststart、时长提取)。提供函数和 CLI 用于发送内容和上传媒体到飞书。专为轻松发布生成内容(如 MiniMax 图片、音频、视频)到飞书而设计。
安装命令
点击复制技能文档
Send multimedia messages to Feishu with proper formatting: inline images, voice bubbles, video players, rich text, and cards.
Dependencies
ffmpegatD:\ffmpeg\bin\ffmpeg.exe(for audio conversion, video fix)ffprobeatD:\ffmpeg\bin\ffprobe.exe(for duration detection)- Python 3.7+
- Feishu app credentials (pre-configured in script defaults)
Quick Reference
Run the script at scripts/feishu_media.py:
import sys; sys.path.insert(0, r'/scripts'); from feishu_media import *
Available Functions
| Function | Message Type | Key Features |
|---|---|---|
send_text(text) | text | Plain text |
send_image(filepath) | image | Inline embed, auto-detect mime |
send_audio(filepath) | audio | Voice bubble, auto→opus, auto duration |
send_video(filepath, cover_image=None) | media | Inline player, faststart, auto duration |
send_rich_text(title, elements) | post | Rich text with embedded media |
send_card(title, elements) | interactive | Card with header color |
open_id, token, app_id, app_secret.Key Rules (learned from testing)
- Audio: Must be opus format, must include
duration(ms). Auto-converts non-opus via ffmpeg. - Video: Must upload as
file_type=mp4, must includeduration(ms). Script auto-applies-movflags +faststart. - Video message type: Use
msg_type=media(notvideo), content usesfile_key+ optionalimage_keyfor cover. - Image in video:
image_keyis the cover thumbnail. Without it, video has no preview frame. - Rich text media: Use
{'tag': 'media', 'file_key': '...', 'image_key': '...'}as an independent paragraph. - File upload types:
opus(audio),mp4(video),stream(generic file),pdf,doc,xls,ppt.
Example: Send MiniMax content to Feishu
# Image send_image('minimax-output/kitten.png')# TTS voice bubble (auto converts mp3→opus) send_audio('minimax-output/greeting.mp3')
# Video with cover (auto faststart + duration) send_video('minimax-output/kitten_video.mp4', cover_image='minimax-output/kitten.png')
# Rich text with video send_rich_text('阿离的报告', [ [{'tag': 'text', 'text': '一舞剑气动四方~'}], [{'tag': 'media', 'file_key': 'file_xxx', 'image_key': 'img_xxx'}], ])
CLI Usage
python scripts/feishu_media.py text "Hello"
python scripts/feishu_media.py image photo.png
python scripts/feishu_media.py audio greeting.mp3
python scripts/feishu_media.py video clip.mp4 --cover thumb.png