name: feishu-media description: 飞书媒体文件发送skill,支持发送图片到飞书群或个人.用于发送截图、设计图等场景. version: 1.0.0 author: Zoe license: MIT
本skill提供将本地图片发送到飞书群或个人聊天的功能。
bash
pip install requests
必须配置飞书凭证,建议使用环境变量,切勿硬编码!
bash
# Windows
set FEISHU_APP_ID=你的AppID
set FEISHU_APP_SECRET=你的AppSecret
# Linux/Mac
export FEISHU_APP_ID=你的AppID
export FEISHU_APP_SECRET=你的AppSecret
python
send_image(
image_path="C:/path/to/image.png",
chat_id="oc_xxx",
app_id="cli_xxx", # 你的App ID
app_secret="xxx" # 你的App Secret
)
python
from feishu_image import send_image
# 方式一:环境变量配置后
send_image(
image_path="C:/path/to/image.png",
chat_id="oc_xxx" # 群聊ID
)
# 方式二:命令行传入
# python feishu_image.py <图片路径> <chat_id> <app_id> <app_secret>
参数说明必填示例image_path图片本地路径是C:/Users/admin/Desktop/xxx.pngchat_id接收者ID是oc_xxx (群) 或 ou_xxx (个人)app_id飞书应用ID否cli_xxx(环境变量优先)app_secret飞书应用密钥否xxx(环境变量优先)
在应用详情中添加以下权限:
im:resource - 上传图片和文件im:message:send - 发送消息im:chat:send - 发送群消息python
send_image(
image_path="C:/Users/admin/Desktop/battery-ui.png",
chat_id="oc_205333d14cf0881ef8b79fa223ff902b"
)
python
# 发送文件类似,只需改用 file 相关API