返回顶部
f

feishu-send-media

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.2
安全检测
已通过
154
下载量
0
收藏
概述
安装方式
版本历史

feishu-send-media

# Feishu Send Media Send media files (images, documents, audio, video) directly to Feishu users or chats using the `message` tool. ## Sending Media ### Basic File Send Use the `message` tool with `action: send` and `path` parameter: ```json { "action": "send", "target": "ou_xxx", // user open_id or chat_id "path": "/path/to/file.pdf" } ``` **Supported types:** - Images: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp` - Documents: `.doc`, `.docx`, `.pdf`, `.txt`, `.rtf` - Audio: `.mp3`, `.wav`, `.m4a` - Video: `.mp4`, `.mov` **Parameters:** - `target`: User `open_id` (e.g., `ou_3ac66d1ad7b8c1xxxxxxxxxxxxxxs`) or chat ID - `path`: Absolute path to local file - Optional `filename`: Override display name ### Sending to Group Chats Use chat_id as target: ```json { "action": "send", "target": "oc_xxx", // group chat ID "path": "/path/to/file.pdf" } ``` ### Inline Images For images to display inline in the message (not as attachments), use the `image` parameter with base64: ```json { "action": "send", "target": "ou_xxx", "image": "data:image/png;base64,..." } ``` ## High-Reliability Workflow (Recommended) **Follow these steps exactly for maximum success rate:** ### Step 1: Copy file to workspace (with deduplication) ```bash # Extract filename from source path filename=$(basename "/source/path/to/file.png") # Copy to workspace (overwrite if exists) cp -f "/source/path/to/file.png" "~/.openclaw/workspace/${filename}" # Verify copy succeeded if [ ! -f "~/.openclaw/workspace/${filename}" ]; then echo "ERROR: File copy failed" exit 1 fi ``` **Why overwrite (-f):** Ensures fresh copy every time, avoids stale file issues. ### Step 2: Get absolute path and validate ```bash # Get absolute path abs_path=$(cd ~/.openclaw/workspace && pwd)/${filename} # Validate file exists and is readable if [ ! -r "$abs_path" ]; then echo "ERROR: File not readable: $abs_path" exit 1 fi # Log for debugging echo "Sending: $abs_path" ``` ### Step 3: Send with message tool ```json { "action": "send", "target": "ou_xxx", "path": "/Users/casia/.openclaw/workspace/filename.png" } ``` ### Step 4: Verify response Check tool response: - ✅ Success: `"messageId"` field present - ❌ Failure: `"error"` field present ## Automatic Error Recovery (Critical) If Step 4 fails, automatically attempt fallbacks in order: ### Fallback 1: Retry once with workspace path ```bash # Sometimes transient failure, retry cp -f "/source/path/to/file.png" "~/.openclaw/workspace/${filename}" # Resend ``` ### Fallback 2: Use base64 for images (especially .png, .gif) ```bash # Convert to base64 base64_string=$(base64 -i "$abs_path") # Send as inline image { "action": "send", "target": "ou_xxx", "image": "data:image/png;base64,${base64_string}" } ``` **When to use:** Path method fails, small images (<3MB), .png/.gif files ### Fallback 3: Upload to Feishu drive then share ```json { "action": "upload_file", "doc_token": "xxx", "file_path": "$abs_path" } ``` Then send the returned file URL. **When to use:** Files >20MB, persistent path failures ## Error Handling Checklist | Error | Cause | Solution | |-------|-------|----------| | File not found | Wrong path | Verify source path exists | | Permission denied | File permission issue | `chmod 644` on file | | Tool error | Feishu API issue | Retry → base64 → drive | | Empty file | Zero-byte file | Check source before copying | | File too large | >20MB | Use Feishu drive | ## Quick Reference | Scenario | Primary Method | Fallback 1 | Fallback 2 | |----------|---------------|------------|------------| | Small image (<3MB) | path | base64 | - | | Large image (3-20MB) | path | base64 | drive | | Document | path | drive | - | | Audio/Video | path | drive | - | | Very large (>20MB) | drive | - | - | ## Mandatory Rules 1. **ALWAYS copy to workspace first** - Never send from /tmp, Downloads, or other临时路径 2. **ALWAYS verify copy succeeded** - Check file exists before sending 3. **ALWAYS use absolute path** - No relative paths in message tool 4. **ALWAYS attempt fallback on failure** - Never give up after one try 5. **ALWAYS extract basename** - Preserve original filename, don't rename

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 feishu-send-media-1776053108 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 feishu-send-media-1776053108 技能

通过命令行安装

skillhub install feishu-send-media-1776053108

下载 Zip 包

⬇ 下载 feishu-send-media v1.0.2

文件大小: 2.52 KB | 发布时间: 2026-4-14 12:42

v1.0.2 最新 2026-4-14 12:42
优化发送流程:强制复制到workspace、验证步骤更严格、自动错误恢复(重试/base64/云盘)、错误处理表、5条强制规则

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部