TopRank Skills

Home / Claw Skills / Analyse des données / feishu-img-tool
Official OpenClaw rules 36%

feishu-img-tool

Feishu image upload and send tool. Send images to Feishu chats by uploading first then sending with image_key. Usage: `node feishu-image-tool.js send --target <open_id> --file <path>`

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 feishu-img-tool 技能。 若已安装,则直接安装 feishu-img-tool 技能。

Overview

Skill Key
bo170814/feishu-img-tool
Author
bo170814
Source Repo
openclaw/skills
Version
-
Source Path
skills/bo170814/feishu-img-tool
Latest Commit SHA
51b5b2b974724aceef19d544202f04d6de6ab4da

Extracted Content

SKILL.md excerpt

# Feishu Image Tool

Tool `feishu_image` for uploading and sending images to Feishu chats.

## How It Works

Feishu requires a two-step process to send images:

1. **Upload Image** - Call `/open-apis/im/v1/images` to upload the image and get `image_key`
2. **Send Message** - Call `/open-apis/im/v1/messages` with `msg_type: "image"` and the `image_key`

## Actions

### Upload and Send Image

```json
{
  "action": "send",
  "target": "ou_xxx",  // User open_id or chat_id
  "file_path": "/path/to/image.png",
  "message": "Optional caption"
}
```

**Parameters:**
- `action`: `"send"`
- `target`: Feishu user open_id or chat_id (omit for current conversation)
- `file_path`: Path to the image file on the server
- `message`: Optional text message to send with the image

**Returns:**
- `success`: boolean
- `image_key`: The uploaded image key
- `message_id`: The sent message ID

### Upload Image Only

```json
{
  "action": "upload",
  "file_path": "/path/to/image.png"
}
```

Returns `image_key` for later use.

### Send Image with Key

```json
{
  "action": "send_with_key",
  "target": "ou_xxx",
  "image_key": "img_v3_xxx"
}
```

## Image Limits

- **Max size**: 10 MB
- **Supported formats**: JPG, JPEG, PNG, WEBP, GIF, BMP, ICO
- **Resolution**: 
  - GIF: max 2000 x 2000 pixels
  - Other formats: max 12000 x 12000 pixels

## Configuration

### Feishu App Credentials

Required credentials (in order of priority):
1. Environment variables: `FEISHU_APP_ID`, `FEISHU_APP_SECRET`
2. Config file: `~/.feishu-image/config.json`

```bash
# Method 1: Environment variables
export FEISHU_APP_ID="cli_xxx"
export FEISHU_APP_SECRET="xxx"

# Method 2: Config file (~/.feishu-image/config.json)
{
  "appId": "cli_xxx",
  "appSecret": "xxx"
}
```

### Required Permissions

- `im:message` - Send messages as bot
- `im:image` - Upload images

## Permissions

- `im:message` - Send messages as bot
- `im:image` - Upload images

## Example Usage

### Send stock chart to user

```json
{
  "action": "send",...

README excerpt

# Feishu Image Skill - 飞书图片发送技能

这个技能允许你在飞书中发送图片消息。

## 安装

```bash
clawhub install feishu-image-send
```

技能将安装到 ClawHub 技能目录。

## 使用方法

### 方法 1:直接使用 Node.js 脚本

```bash
# 发送图片给用户(带文字说明)
node feishu-image-tool.js send \
  --target ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
  --file /tmp/stock-report.png \
  --message "📊 今日股票报告"

# 仅上传图片,获取 image_key
node feishu-image-tool.js upload \
  --file /tmp/image.png

# 使用已有的 image_key 发送消息
node feishu-image-tool.js send-with-key \
  --target ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
  --image-key img_v3_xxx
```

### 方法 2:在 OpenClaw 中调用

```javascript
const { exec } = require('child_process');

exec(`node feishu-image-tool.js send --target ${userId} --file ${filePath}`, (error, stdout, stderr) => {
  if (error) {
    console.error(`Error: ${error}`);
    return;
  }
  const result = JSON.parse(stdout);
  console.log('Image sent:', result.message_id);
});
```

## 配置

### 方法 1:环境变量(推荐)

```bash
export FEISHU_APP_ID="cli_xxxxxxxxxxxxxxxx"
export FEISHU_APP_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

### 方法 2:配置文件

创建 `~/.feishu-image/config.json`:

```json
{
  "appId": "cli_xxxxxxxxxxxxxxxx",
  "appSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
```

可从示例配置复制:
```bash
cp config.example.json ~/.feishu-image/config.json
# 然后编辑 ~/.feishu-image/config.json 填入你的凭证
```

### 获取飞书应用凭证

1. 访问 [飞书开放平台](https://open.feishu.cn/app)
2. 创建企业自建应用
3. 获取 App ID 和 App Secret
4. 确保应用有以下权限:
   - `im:message` - 发送消息
   - `im:image` - 上传图片

## 限制

- 图片大小:最大 10 MB
- 支持格式:JPG, JPEG, PNG, WEBP, GIF, BMP, ICO
- 分辨率限制:
  - GIF: 最大 2000 x 2000 像素
  - 其他格式:最大 12000 x 12000 像素

## 输出示例

成功响应:
```json
{
  "success": true,
  "image_key": "img_v3_02vd_xxx",
  "message_id": "om_x100b5560xxx"
}
```

## 故障排除

### 错误:Cannot find module '@lark...

Related Claw Skills