← 返回
未分类 Key

imageReader

Reads and analyzes images from messages across 10+ chat platforms using platform-specific APIs and unified image processing.
跨10+个聊天平台读取消息图片,通过平台专属API和统一图像处理技术进行分析。
zqy15306762317
未分类 clawhub v1.0.1 1 版本 100000 Key: 需要
★ 1
Stars
📥 330
下载
💾 0
安装
1
版本
#latest

概述

Chat Image Reader

Universal image reading and analysis skill for multiple chat platforms.

Supported Platforms

PlatformChannelImage SourceDownload Method
--------------------------------------------------
Feishu (飞书)feishuMessage image_keyAPI + Tenant Token
DingTalk (钉钉)dingtalkMessage downloadCodeAPI + Access Token
WeChat (微信)wechatMedia file_idAPI + Access Token
DiscorddiscordAttachment URLDirect download
Telegramtelegramfile_idBot API
WhatsAppwhatsappMedia URLDirect download
SignalsignalAttachmentDirect download
SlackslackFile URLDirect download
iMessageimessageAttachment pathLocal file
LINElineMessage contentAPI

Required Credentials

This skill requires API credentials to access chat platform messages. Configure at least one platform to use the skill.

Platform Credentials

PlatformRequired Environment VariablesNotes
------------------------------------------------
Feishu (飞书)FEISHU_APP_ID, FEISHU_APP_SECRETRequired scopes: im:message:readonly, im:resource
DingTalk (钉钉)DINGTALK_APP_KEY, DINGTALK_APP_SECRETRequired permissions: IMessage, Chat
WeChat (企业微信)WECHAT_CORP_ID, WECHAT_CORP_SECRETRequired permissions: media_get
TelegramTELEGRAM_BOT_TOKENFrom @BotFather
DiscordDISCORD_BOT_TOKENFrom Discord Developer Portal
WhatsAppWHATSAPP_TOKENFrom Meta Business API

Configuration Example

# Feishu (飞书) - Required for Feishu image reading
export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"

# DingTalk (钉钉) - Required for DingTalk image reading
export DINGTALK_APP_KEY="dingxxx"
export DINGTALK_APP_SECRET="xxx"

# WeChat (企业微信) - Required for WeChat image reading
export WECHAT_CORP_ID="xxx"
export WECHAT_CORP_SECRET="xxx"

# Telegram - Required for Telegram image reading
export TELEGRAM_BOT_TOKEN="123456:ABC-xxx"

Security Notes

  • Credentials are only used to download images from respective platforms
  • No data is sent to external servers except the official platform APIs
  • Images are stored temporarily in local temp directory
  • Credentials should be configured via environment variables, not hardcoded

Workflow

Step 1: Detect Platform from Context

Check inbound_meta.channel or inbound_meta.provider to determine the chat platform:

{
  "channel": "feishu",      // Feishu
  "channel": "discord",     // Discord
  "channel": "telegram",    // Telegram
  "channel": "whatsapp",    // WhatsApp
  ...
}

Step 2: Get Image by Platform

Feishu (飞书)

  1. Get message_id and image_key from message
  2. Get tenant access token via API
  3. Download from: GET /open-apis/im/v1/messages/{message_id}/resources/{image_key}
  4. Save to temp file

DingTalk (钉钉)

  1. Get downloadCode from message content
  2. Get access token via API (appKey + appSecret)
  3. Download from: GET /v1.0/robot/messageFiles/download?downloadCode={code}
  4. Save to temp file

WeChat (微信/企业微信)

  1. Get media_id from message
  2. Get access token via API
  3. Download from: GET https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token={token}&media_id={id}
  4. Save to temp file

Discord

  1. Get attachment URL from message (Discord provides direct CDN URLs)
  2. Download directly from URL
  3. No authentication needed for public channels

Telegram

  1. Get file_id from message
  2. Call Bot API: GET https://api.telegram.org/bot{token}/getFile?file_id={file_id}
  3. Download from: https://api.telegram.org/file/bot{token}/{file_path}

WhatsApp / Signal / Slack

  1. Get media URL from message
  2. Download directly (usually with token in header)

Local File Path

If user provides a local path directly:

  1. Verify file exists
  2. Use directly without download

Step 3: Analyze Image

Use the image tool with appropriate prompt:

image(
  image: "<local_path_or_url>",
  prompt: "描述图片内容,包括文字、图表、数据等关键信息"
)

Platform-Specific Implementation

Feishu Implementation

# 1. Get tenant token
$body = @{ app_id = $appId; app_secret = $appSecret } | ConvertTo-Json
$token = (Invoke-RestMethod -Uri "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" -Method Post -Body $body).tenant_access_token

# 2. Get message to find image_key
$message = Invoke-RestMethod -Uri "https://open.feishu.cn/open-apis/im/v1/messages/$messageId" -Headers @{ Authorization = "Bearer $token" }
$imageKey = $message.data.items[0].body.content | ConvertFrom-Json | Select-Object -ExpandProperty image_key

# 3. Download image
Invoke-WebRequest -Uri "https://open.feishu.cn/open-apis/im/v1/messages/$messageId/resources/$imageKey" -Headers @{ Authorization = "Bearer $token" } -OutFile $outputPath

DingTalk Implementation

# 1. Get access token
$body = @{ appKey = $appKey; appSecret = $appSecret } | ConvertTo-Json
$token = (Invoke-RestMethod -Uri "https://api.dingtalk.com/v1.0/oauth2/accessToken" -Method Post -Body $body).accessToken

# 2. Download image using downloadCode
# For robot messages:
Invoke-WebRequest -Uri "https://api.dingtalk.com/v1.0/robot/messageFiles/download?downloadCode=$downloadCode" -Headers @{ "x-acs-dingtalk-access-token" = $token } -OutFile $outputPath

# For user messages (via stream):
# Use conversation message download API

WeChat (企业微信) Implementation

# 1. Get access token
$token = (Invoke-RestMethod -Uri "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$corpId&corpsecret=$corpSecret").access_token

# 2. Download media
Invoke-WebRequest -Uri "https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=$token&media_id=$mediaId" -OutFile $outputPath

Discord Implementation

# Discord attachments are direct URLs
$attachmentUrl = $message.attachments[0].url
Invoke-WebRequest -Uri $attachmentUrl -OutFile $outputPath

Telegram Implementation

# 1. Get file path from file_id
$fileInfo = Invoke-RestMethod -Uri "https://api.telegram.org/bot$token/getFile?file_id=$fileId"
$filePath = $fileInfo.result.file_path

# 2. Download file
Invoke-WebRequest -Uri "https://api.telegram.org/file/bot$token/$filePath" -OutFile $outputPath

Reply Context Handling

When user replies to an image message:

  1. Check reply_to_id in inbound metadata
  2. Fetch the original message using platform-specific API
  3. Extract image from the original message
  4. Proceed with download and analysis

Common Analysis Prompts

Document/Screenshot

识别图片中的所有文字内容,保持原有格式和层次结构。

Chart/Table

分析图片中的图表或表格,提取所有数据和标签。

UI Screenshot

描述界面布局、功能按钮、当前状态等关键信息。

Stock/Finance Chart

识别股票代码、价格、K线形态、成交量等财务信息。

Job Posting

提取招聘信息,包括职位名称、职责、要求、薪资等关键内容。

General Image

描述图片内容,包括主要元素、文字、数据等关键信息。

Error Handling

ErrorCauseSolution
------------------------
Image not foundNo image in messageAsk user to resend or provide path
Download failedPermission/Network issueCheck permissions, retry
API errorToken expired/invalidRefresh token and retry
Analysis failedImage unclear/unsupportedTry alternative prompt

Fallback Strategy

When automatic image retrieval fails:

  1. Ask user to provide path: "请提供图片的本地路径"
  2. Ask user to describe: "请描述图片内容或复制图片中的文字"
  3. Request resend: "请重新发送图片"

Temp File Management

  • Save images to $workspace/temp_images/ or system temp
  • Clean up after analysis (optional, for disk space)
  • Use unique filenames with timestamp: img_{channel}_{timestamp}.jpg

Configuration Required

Feishu (飞书)

  • FEISHU_APP_ID / channels.feishu.appId
  • FEISHU_APP_SECRET / channels.feishu.appSecret
  • Required scope: im:message:readonly, im:resource

DingTalk (钉钉)

  • DINGTALK_APP_KEY / channels.dingtalk.appKey
  • DINGTALK_APP_SECRET / channels.dingtalk.appSecret
  • Required permissions: IMessage, Chat

WeChat (企业微信)

  • WECHAT_CORP_ID / channels.wechat.corpId
  • WECHAT_CORP_SECRET / channels.wechat.corpSecret
  • Required permissions: media_get

Telegram

  • Bot token configured in OpenClaw

Discord

  • Bot token configured in OpenClaw

Notes

  • Most platforms provide images in JPG/PNG format
  • Large images may need resizing before analysis
  • Consider rate limits for API calls
  • Always validate user has permission to access the image

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 13:39 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

Video Frames

steipete
使用 ffmpeg 从视频中提取帧或短片。
★ 134 📥 52,815
design-media

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 429 📥 116,724
design-media

UI/UX Pro Max

xobi667
提供 UI/UX 设计智能与实现指导,帮助打造精美界面。适用于 UI 设计、UX 流程、信息架构、视觉风格、设计系统/标记、组件规格、文案/微文案、无障碍及前端 UI(HTML/CSS/JS、React、Next.js、Vue、Svelte
★ 216 📥 47,259