微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🖼️

飞书原生图片消息直发工具

Feishu Send Image · v1.0.0
办公 安全 B 级 作者 jasonzhang2015 公开目录收录
954 下载 0 安装 2.8k 收藏 6 浏览

简介

通过飞书机器人API直接发送本地图片为原生图片消息,解决OpenClaw内置工具只能发文件附件的局限,适用于图表、截图等场景。

原始描述

Send images directly in Feishu chat as native image messages (not file attachments). Use when: need to send a generated image, chart, screenshot, or any loca...

通过你的 Agent 添加

安装目录:feishu-send-image/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/feishu-send-image/
Codex CLI~/.codex/skills/feishu-send-image/
DeepSeek Harness~/.agents/skills/feishu-send-image/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

feishu-send-image 是一个专门用于飞书(Feishu)平台的图片发送技能。它通过调用飞书机器人 API,将本地图片文件(PNG/JPG/GIF/WebP)以原生图片消息形式发送给指定用户或群聊,而非文件附件。

关键问题:OpenClaw 内置的 message 工具即使使用 filePath、media 或 buffer 参数,在飞书平台也只能生成文件附件,无法显示为内联图片。本技能通过直接调用飞书 Bot API 的三步流程解决此问题:

  1. 获取租户访问令牌(auth/v3/tenant_access_token/internal)
  2. 上传图片获取 image_key(im/v1/images)
  3. 发送图片消息(im/v1/messages,msg_type=image)

显著优点

  • 原生体验:图片直接显示在聊天记录中,而非需要点击下载的附件
  • 格式兼容:支持 PNG、JPG、GIF、WebP 等常见格式
  • 灵活接收:支持 open_id(单聊)和 chat_id(群聊)两种接收方式
  • 凭证复用:自动读取 ~/.openclaw/openclaw.json 中的飞书应用凭证

潜在缺点与局限性

  • 依赖外部脚本:需调用 bash scripts/feishu_send_image.sh,存在 shell 注入风险若输入未校验
  • 凭证管理:需手动配置 appId 和 appSecret,存在密钥泄露风险
  • 平台锁定:仅支持飞书,无多平台适配
  • 无图片处理:不支持图片压缩、水印、格式转换等二次处理
  • 失败处理简单:仅返回退出码 1 和错误打印,无重试机制

适合人群

  • 需要发送数据可视化图表(Matplotlib、ECharts 等生成)的开发者
  • 自动化报告场景中需要发送截图的工作流
  • 飞书企业内部机器人开发者

常规风险

  • 密钥泄露:appSecret 以明文形式出现在命令行参数中,可能被历史记录、进程列表捕获
  • 路径遍历:若 image_path 参数未严格校验,可能导致任意文件读取
  • API 限流:高频调用可能触发飞书 API 频率限制
  • 依赖稳定性:依赖飞书开放平台 API 可用性和稳定性

技能正文


name: feishu-send-image description: | Send images directly in Feishu chat as native image messages (not file attachments). Use when: need to send a generated image, chart, screenshot, or any local image file to a Feishu user or group chat. Triggers: "发图", "send image", "发送图片", sending charts/graphs/screenshots via Feishu. Note: OpenClaw's built-in message tool (filePath/media/buffer) does NOT work for Feishu image sending — it only produces file attachments. This skill bypasses that limitation by calling Feishu Bot API directly.

Feishu Send Image

Send local image files as native Feishu image messages via the Feishu Bot API.

Why This Skill Exists

OpenClaw's message tool with filePath, media, or buffer parameters only sends file attachments in Feishu, not inline images. This skill calls the Feishu API directly to send proper image messages.

Quick Usage

Run the script:

bash scripts/feishu_send_image.sh <image_path> <receive_id> <app_id> <app_secret> [receive_id_type]

Arguments

Arg Description
image_path Local path to image (png/jpg/gif/webp)
receive_id Feishu open_id (user) or chat_id (group)
app_id Feishu app ID from ~/.openclaw/openclaw.json → feishu.accounts.default.appId
app_secret Feishu app secret from ~/.openclaw/openclaw.json → feishu.accounts.default.appSecret
receive_id_type open_id (default) or chat_id

Example

bash scripts/feishu_send_image.sh /tmp/chart.png \
  ou_38470740452f6083ce189b7ddec722f8 \
  cli_a92c368412f9dcb1 \
  7uM7aLqeqYqm0Fsy0IP5QhOyTBSwxlfT

Getting Credentials

Read ~/.openclaw/openclaw.json and extract:

  • channels.feishu.accounts.default.appId
  • channels.feishu.accounts.default.appSecret

The receiver's open_id comes from inbound message metadata (sender_id).

How It Works

  1. Get token — POST /auth/v3/tenant_access_token/internal with appId/appSecret
  2. Upload image — POST /im/v1/images with image_type=message, returns image_key
  3. Send message — POST /im/v1/messages with msg_type=image and the image_key

Output

On success: OK: image_key=<key> message_id=<id> On failure: prints error and exits with code 1.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

feishularkimage-messagingbot-apienterprise-imautomationchart-sharingscreenshot

同类 Skill