Rechercher

PythonReactSEOPDF
OpenClaw

feishu-send-file

飞书发送文件技能。当需要通过飞书向用户发送文件附件(HTML、ZIP、PDF、代码文件等非图片/视频的普通文件)时使用。图片和视频用 message tool 的 media 参数即可,普通文件必须用本技能的两步流程:先上传获取 file_key,再发送消息。

dadaniya990 installations selon la source☆ 0 Étoiles du dépôt

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

SkillHub CLI

skillhub install dadaniya99/feishu-send-file

Examinez la source et la compatibilité, puis suivez les étapes d’installation.

Donnez le lien à votre agent et demandez-lui d’examiner instructions et dépendances avant d’expliquer les étapes.

Voir la source ↗Guides

Instructions

飞书发送文件

飞书机器人发送普通文件(非图片/视频)需要两步:先上传文件获取 file_key,再用 file_key 发消息。

快速流程

方式一:用脚本(推荐)
python3 scripts/send_file.py <file_path> <open_id> <app_id> <app_secret> [file_name]

参数说明:

  • file_path: 要发送的文件路径(HTML/PDF/ZIP/代码文件等)
  • open_id: 接收者的 open_id(从 inbound_meta 的 chat_id 字段获取,格式为 user:ou_xxx,取 ou_xxx 部分)
  • app_id: 飞书应用 ID(从 openclaw.json 的 channels.feishu.appId 读取)
  • app_secret: 飞书应用密钥(从 openclaw.json 的 channels.feishu.appSecret 读取)
  • file_name: 可选,自定义文件名(不填则用原文件名)

快速获取配置:

# 获取 app_id 和 app_secret
grep -A 2 '"feishu"' /root/.openclaw/openclaw.json | grep -E '(appId|appSecret)'

完整示例:

python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_file.py \
  /root/myfiles/report.html \
  <USER_OPEN_ID> \
  <YOUR_APP_ID> \
  <YOUR_APP_SECRET> \
  report.html

AI 助手使用示例:

# 当需要发送文件给用户时,直接调用脚本
exec(f"""
python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_file.py \\
  {file_path} \\
  {user_open_id} \\
  {app_id} \\
  {app_secret} \\
  {custom_filename}
""")
方式二:手动两步

Step 1 - 上传文件:

TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d '{"app_id":"<APP_ID>","app_secret":"<APP_SECRET>"}' | python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])")

FILE_KEY=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file_type=stream" \
  -F "file_name=<文件名>" \
  -F "file=@<文件路径>" | python3 -c "import json,sys; print(json.load(sys.stdin)['data']['file_key'])")

Step 2 - 发送消息:

curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_i...

Informations sur la source

Source
github
Repository
openclaw/skills
Path
skills/dadaniya99/feishu-send-file
Version
—
Commit
cf7a141ca0e2d5735fb16655b9153adba78fba69
Source de classification
rules
Statut
active
Visibilité
public

Ces informations proviennent de l’analyse indexée et peuvent être anciennes. Vérifiez les fichiers actuels.

Contenu extrait

SKILL.md
# 飞书发送文件

飞书机器人发送普通文件(非图片/视频)需要两步:先上传文件获取 file_key,再用 file_key 发消息。

## 快速流程

### 方式一:用脚本(推荐)

```bash
python3 scripts/send_file.py <file_path> <open_id> <app_id> <app_secret> [file_name]
```

**参数说明:**
- `file_path`: 要发送的文件路径(HTML/PDF/ZIP/代码文件等)
- `open_id`: 接收者的 open_id(从 inbound_meta 的 chat_id 字段获取,格式为 `user:ou_xxx`,取 `ou_xxx` 部分)
- `app_id`: 飞书应用 ID(从 `openclaw.json` 的 `channels.feishu.appId` 读取)
- `app_secret`: 飞书应用密钥(从 `openclaw.json` 的 `channels.feishu.appSecret` 读取)
- `file_name`: 可选,自定义文件名(不填则用原文件名)

**快速获取配置:**
```bash
# 获取 app_id 和 app_secret
grep -A 2 '"feishu"' /root/.openclaw/openclaw.json | grep -E '(appId|appSecret)'
```

**完整示例:**
```bash
python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_file.py \
  /root/myfiles/report.html \
  <USER_OPEN_ID> \
  <YOUR_APP_ID> \
  <YOUR_APP_SECRET> \
  report.html
```

**AI 助手使用示例:**
```python
# 当需要发送文件给用户时,直接调用脚本
exec(f"""
python3 /root/.openclaw/workspace/skills/feishu-send-file/scripts/send_file.py \\
  {file_path} \\
  {user_open_id} \\
  {app_id} \\
  {app_secret} \\
  {custom_filename}
""")
```

### 方式二:手动两步

**Step 1 - 上传文件:**
```bash
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d '{"app_id":"<APP_ID>","app_secret":"<APP_SECRET>"}' | python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])")

FILE_KEY=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/files" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file_type=stream" \
  -F "file_name=<文件名>" \
  -F "file=@<文件路径>" | python3 -c "import json,sys; print(json.load(sys.stdin)['data']['file_key'])")
```

**Step 2 - 发送消息:**
```bash
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_i...

Skills associés

OpenClaw

dojo.md

edholofy

University for AI agents. 92 courses, 4400+ scenarios, any model via OpenRouter. Auto-training loops generate per-model SKILL.md documents. Works with Claude Code, OpenClaw, Cursor, Windsurf. No fine-tuning req...

OpenClaw

wps-macos-helper

lethehades

macOS WPS Office workflow helper skill for safer document preparation, conversion, export, and compatibility guidance