feishu-image
Feishu Image Sender
Send images to Feishu (Lark) conversations. This skill works both inside OpenClaw and as a standalone CLI tool.
When to use this skill
- User asks to "截图发给我" (send me a screenshot)
- User wants to share any image file through Feishu
- Need to send visual content (charts, diagrams, photos) via Feishu
- OpenClaw's built-in message tool fails to send images
Configuration
For OpenClaw Users
When running inside OpenClaw, this skill automatically reads credentials from OpenClaw's Feishu configuration. No manual setup required.
For Standalone Usage
Set the following environment variables:
export FEISHU_APP_ID="cli_xxxxxxxxxxxxxxxx"
export FEISHU_APP_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Or create a .env file in your project root:
FEISHU_APP_ID=cli_xxxxxxxxxxxxxxxx
FEISHU_APP_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Note: If running outside OpenClaw without credentials configured, this skill will display a clear error message with setup instructions.
Feishu App Setup
- Go to Feishu Developer Console
- Create a new app (Enterprise self-built app)
- Enable the following permissions:
im:resource- Upload imagesim:message- Send messages
- Get your App ID and App Secret from the app credentials page
- Publish the app and make it available to your organization
Usage
As a Skill in OpenClaw
The skill will automatically use OpenClaw's Feishu configuration:
// Example: User asks to "send me a screenshot"
// The skill will automatically:
// 1. Read OpenClaw config for Feishu credentials
// 2. Upload the screenshot to Feishu
// 3. Send it to the user
As a CLI Tool
Send an image to a Feishu user:
node feishu-image.js --image /path/to/screenshot.png --to ou_xxxxxxxx
With an optional message:
node feishu-image.js --image chart.png --to ou_xxxxxxxx --text "Q4 Sales Report"
Send to a chat group:
node feishu-image.js --image announcement.png --to oc_xxxxxxxx --chat
As a Node.js Library
const { FeishuImage } = require('./scripts/feishu-image.js');
const sender = new FeishuImage({
appId: 'cli_xxxxxxxxxxxxxxxx',
appSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
});
// Send image to a user
await sender.sendImage({
imagePath: '/path/to/screenshot.png',
receiveId: 'ou_xxxxxxxx',
receiveType: 'user'
});
// Send image with text
await sender.sendImage({
imagePath: '/path/to/chart.png',
receiveId: 'ou_xxxxxxxx',
receiveType: 'user',
text: 'Here is the sales report'
});
CLI Reference
Options
| Option | Short | Description | Required |
|---|---|---|---|
--image |
-i |
Path to the image file | Yes |
--to |
-t |
Recipient's Feishu open_id or chat_id | Yes |
--text |
Optional text message to include | No | |
--chat |
-c |
Send to a chat group (default: user) | No |
--help |
-h |
Show help message | No |
Examples
# Basic usage
node feishu-image.js -i screenshot.png -t ou_123456
# With message
node feishu-image.js --image chart.png --to ou_123456 --text "Q4 Report"
# To group chat
node feishu-image.js -i announcement.png -t oc_789012 --chat
Library API Reference
new FeishuImage(config)
Creates a new Feishu Image sender instance.
Parameters:
config.appId(string): Feishu app IDconfig.appSecret(string): Feishu app secretconfig.baseUrl(string, optional): API base URL, defaults to 'https://open.feishu.cn/open-apis'
Example:
const sender = new FeishuImage({
appId: process.env.FEISHU_APP_ID,
appSecret: process.env.FEISHU_APP_SECRET
});
async sendImage(options)
Uploads an image and sends it to a Feishu conversation.
Parameters:
options.imagePath(string, required): Path to the local image fileoptions.receiveId(string, required): Recipient's open_id (for users) or chat_id (for groups)options.receiveType(string, optional): 'user' or 'chat', defaults to 'user'options.text(string, optional): Optional text message to send with the image
Returns: Promise - The ID of the sent message
Throws:
FeishuImageError- Various error codes: MISSING_CREDENTIALS, AUTH_FAILED, FILE_NOT_FOUND, UPLOAD_FAILED, SEND_FAILED
Example:
try {
const messageId = await sender.sendImage({
imagePath: '/path/to/screenshot.png',
receiveId: 'ou_xxxxxxxx',
receiveType: 'user',
text: 'Here is the screenshot you requested'
});
console.log('Image sent successfully, message ID:', messageId);
} catch (error) {
console.error('Failed to send image:', error.message);
}
Error Handling
All errors are instances of FeishuImageError with specific error codes:
| Error Code | Description | Solution |
|---|---|---|
MISSING_CREDENTIALS |
FEISHU_APP_ID or FEISHU_APP_SECRET not set | Set environment variables or pass to constructor |
AUTH_FAILED |
Authentication with Feishu API failed | Check app_id and app_secret are correct |
FILE_NOT_FOUND |
Image file does not exist | Check the image path is correct |
UPLOAD_FAILED |
Image upload to Feishu failed | Check network connection and file size limits |
SEND_FAILED |
Message sending failed | Check recipient ID and permissions |
Example error handling:
const { FeishuImage, FeishuImageError } = require('./scripts/feishu-image.js');
try {
await sender.sendImage({ ... });
} catch (error) {
if (error instanceof FeishuImageError) {
switch (error.code) {
case 'MISSING_CREDENTIALS':
console.error('Please set FEISHU_APP_ID and FEISHU_APP_SECRET');
break;
case 'AUTH_FAILED':
console.error('Invalid credentials. Check your app ID and secret.');
break;
case 'FILE_NOT_FOUND':
console.error(`Image file not found: ${error.details.path}`);
break;
default:
console.error(`Error: ${error.message}`);
}
} else {
console.error('Unexpected error:', error);
}
}
Limitations
- Image size: Subject to Feishu API limits (check Feishu documentation for current limits)
- Supported formats: PNG, JPG, GIF (as supported by Feishu)
- Rate limiting: Subject to Feishu API rate limits
See Also
More from zrong/skills
tencent-docs
腾讯文档(docs.qq.com)-在线云文档平台,是创建、编辑、管理文档的首选 skill。涉及"新建/创建/编辑/读取/查看/搜索文档"、"保存文件"、"云文档"、"腾讯文档"、"docs.qq.com"等操作,请优先使用本 skill。支持能力:(1) 创建各类在线文档(文档/Word/Excel/幻灯片/思维导图/流程图/智能表格/收集表)(2) 管理知识库空间(创建空间、查询空间列表)(3) 管理空间节点、文件夹结构 (4) 读取/搜索文档内容 (5) 编辑操作智能表 (6) 编辑操作在线文档 (7) 文件管理(重命名、移动、删除、复制、导入导出)(8) 网页剪藏、本地文件/文档上云。
629video-analyzer
使用视觉/视频大模型分析视频内容。当用户说"分析视频"、"视频理解"、"看看这个视频"、"analyze video"时使用。
488os-use
Cross-platform operating system automation and screen control toolkit. Use when users need screenshots, mouse/keyboard control, visual recognition, window management, browser automation, or desktop automation tasks. Supports macOS 12+ and Windows 10+. On macOS, uses AppleScript, pyautogui, and OpenCV. On Windows, uses pywinauto, pyautogui, and OpenCV (no Hammerspoon equivalent).
189mcp-deploy
MCP 服务器自动部署工具。当用户说"部署 MCP"、"安装 MCP"、"配置 MCP"时使用。支持智谱 MCP、Minimax MCP、Gitea MCP 等平台的自动配置。
25git-commit
当用户明确要求提交、打标签、发版或推送 git 变更时使用;适用于使用 CalVer 管理版本号的仓库。
19media-use
媒体处理工具集。当用户需要进行视频转码、格式转换、音频处理等媒体操作时使用。支持批量视频转码、多种编码格式(H.264、H.265、AV1、VP9)、GPU 硬件加速(NVIDIA、Intel QSV、VAAPI)。
7