← Back to Skills Marketplace
hanl754

Feishu Messenger

by hanl754 · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ Security Clean
240
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install feishu-messenger
Description
通过飞书频道发送文本、图片和多格式文件消息,支持私聊和群聊,需使用相对路径提供媒体文件。
README (SKILL.md)

Feishu Messenger - 飞书消息发送技能

📋 技能概述

提供飞书消息发送能力,支持文本、图片、文件等多种消息类型。

核心能力:

  • 📝 发送文本消息
  • 📸 发送图片(自动预览)
  • 📄 发送文件(任意格式)
  • 🎯 支持私聊和群聊

🚀 快速开始

基础用法

# 发送文本消息
openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "你好,这是一条测试消息"

发送图片

# 1. 复制图片到工作区
cp /path/to/image.png ~/.openclaw/workspace/

# 2. 发送(使用相对路径)
openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "📸 测试图片" \
  --media ./image.png

发送文件

# 1. 复制文件到工作区
cp /path/to/document.pdf ~/.openclaw/workspace/

# 2. 发送(使用相对路径)
openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "📄 文档请查收" \
  --media ./document.pdf

📚 完整参数

参数 简写 说明 必填
--channel - 渠道类型 (feishu)
--target - 接收者 ID (open_id 或 chat_id)
--message - 消息文本
--media - 媒体文件路径(相对路径)
--filename - 自定义文件名

Target 格式

# 私聊用户
ou_6650e2645a6e8f4c7363cbbfd6bbcf33

# 群聊
chat_xxxxx

🎯 使用场景

场景 1: 发送通知消息

openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "⏰ 提醒:下午 3 点有会议"

场景 2: 发送截图

# 截取屏幕
screenshot /tmp/screenshot.png

# 复制到工作区并发送
cp /tmp/screenshot.png ~/.openclaw/workspace/
cd ~/.openclaw/workspace
openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "📸 问题截图" \
  --media ./screenshot.png

场景 3: 发送日志文件

# 打包日志
tar -czf logs.tar.gz logs/

# 发送
cp logs.tar.gz ~/.openclaw/workspace/
cd ~/.openclaw/workspace
openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "📦 日志文件已打包" \
  --media ./logs.tar.gz

场景 4: 批量发送通知

# 发送给多人
for user in ou_001 ou_002 ou_003; do
  openclaw message send \
    --channel feishu \
    --target $user \
    --message "📢 系统维护通知:今晚 23:00-01:00"
done

⚠️ 重要注意事项

路径要求(关键!)

路径类型 示例 结果
相对路径 ./image.png 正常显示
❌ 绝对路径 /tmp/image.png 可能失败或显示为附件
❌ 波浪号路径 ~/image.png 被安全策略阻止

最佳实践: 始终将文件复制到工作区后使用 ./ 相对路径。

文件大小限制

类型 限制
图片 最大 10MB
文件 最大 50MB
视频 最大 100MB

支持的文件格式

图片: PNG, JPG, GIF, WebP, BMP
文档: PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX
压缩: ZIP, RAR, 7Z, TAR.GZ
其他: TXT, CSV, MD, JSON, XML


🔧 Python API 调用

import subprocess

def send_feishu_message(target, message, media_path=None):
    """发送飞书消息"""
    cmd = [
        'openclaw', 'message', 'send',
        '--channel', 'feishu',
        '--target', target,
        '--message', message
    ]
    
    if media_path:
        cmd.extend(['--media', media_path])
    
    result = subprocess.run(cmd, capture_output=True, text=True)
    return result.returncode == 0

# 使用示例
send_feishu_message(
    'ou_xxxxx',
    '📄 报告已生成',
    './report.pdf'
)

📝 完整工作流程

步骤 1: 准备文件

# 确保文件在工作区
cd ~/.openclaw/workspace

# 如果需要,从其他地方复制
cp /path/to/file.ext ./

步骤 2: 发送消息

openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "消息内容" \
  --media ./file.ext

步骤 3: 验证结果

检查返回:

  • ✅ Sent via Feishu. Message ID: om_xxxxx
  • ❌ 错误信息(检查路径、权限等)

⚠️ 常见问题

问题 1: 文件发送失败

症状: 提示找不到文件或发送失败

解决:

# 检查文件是否存在
ls -la ./file.ext

# 确保使用相对路径
# ✅ 正确:./file.ext
# ❌ 错误:/home/user/file.ext

问题 2: 图片显示为附件而不是预览

症状: 收到的是文件附件,不是图片预览

原因: 使用了绝对路径

解决:

# 复制文件到工作区
cp /tmp/image.png ~/.openclaw/workspace/

# 使用相对路径发送
cd ~/.openclaw/workspace
openclaw message send --media ./image.png ...

问题 3: 提示权限不足

症状: Permission denied

解决:

# 检查文件权限
chmod 644 ./file.ext

# 或重新复制文件
cp /path/to/file.ext ./

问题 4: 找不到 target ID

症状: 不知道用户的 open_id

解决:

# 方法 1: 从飞书 URL 获取
# 用户个人资料页面 URL 包含 open_id

# 方法 2: 使用飞书 API 查询
# 参考飞书开放平台文档

# 方法 3: 从消息事件获取
# 当用户发消息给你时,sender_id 就是 open_id

🎯 最佳实践

1. 文件管理

# 创建临时文件夹
mkdir -p ~/.openclaw/workspace/temp/

# 使用后清理
rm ~/.openclaw/workspace/temp/*

2. 消息模板

# 定义消息模板
NOTIFY_MSG="⏰ 提醒:{{content}}"
ERROR_MSG="❌ 错误:{{content}}"
SUCCESS_MSG="✅ 成功:{{content}}"

# 使用
openclaw message send \
  --channel feishu \
  --target ou_xxxxx \
  --message "${SUCCESS_MSG//\{\{content\}\}/任务完成}"

3. 错误处理

#!/bin/bash

send_with_retry() {
    local target=$1
    local message=$2
    local media=$3
    
    for i in {1..3}; do
        if openclaw message send \
            --channel feishu \
            --target "$target" \
            --message "$message" \
            --media "$media" 2>&1 | grep -q "✅ Sent"; then
            echo "发送成功"
            return 0
        fi
        echo "重试 $i/3..."
        sleep 2
    done
    
    echo "发送失败"
    return 1
}

📚 相关资源


🧪 测试清单

已完成测试 ✅

类型 文件 状态 消息 ID
文本消息 - -
PNG 图片 smiley_test.png om_x100b547f66ac7ca4c4acde68c243266
TXT 文件 test_file.txt om_x100b547f735e00a0b27929fac63a897
PDF 文档 test_doc.pdf om_x100b547f09b4e500c2a36e51156b11b
Word 文档 test_doc.docx om_x100b547f092a08acc3e8972049d6347
相对路径 ./xxx -

待测试 ⏳

  • 发送群聊消息
  • 发送大文件 (>10MB)
  • 发送 Excel 表格
  • 发送 PPT 演示文稿

版本: v1.1
创建时间: 2026-03-14 09:05 AM
更新时间: 2026-03-14 09:06 AM
作者: Han's AI Assistant
状态: ✅ 已验证 (文本/图片/TXT/PDF/Word)

Usage Guidance
This skill is an instruction-only wrapper that calls your existing OpenClaw CLI to send Feishu messages. Before installing or using it: (1) confirm your OpenClaw environment already holds valid Feishu credentials (app ID/secret or access token) — the skill does not declare or request them; (2) be mindful that any file you copy into ~/.openclaw/workspace will be sent if referenced, so avoid placing sensitive data there; (3) verify file size/type limits with your Feishu tenant and OpenClaw configuration; (4) because there is no code to inspect, check how OpenClaw stores/uses Feishu tokens (so you understand where credentials live). Overall the skill is coherent and contains no obvious red flags.
Capability Analysis
Type: OpenClaw Skill Name: feishu-messenger Version: 1.1.0 The Feishu Messenger skill provides legitimate functionality for sending text, images, and files via the Feishu (Lark) platform. The documentation (SKILL.md and README.md) focuses on standard usage patterns, including safety recommendations for file path management within the OpenClaw workspace and secure Python subprocess execution. No evidence of data exfiltration, malicious execution, or prompt injection was found.
Capability Assessment
Purpose & Capability
Name/description (send Feishu messages with text/media) matches the instructions: all examples call 'openclaw message send --channel feishu' and describe sending files from the OpenClaw workspace. Nothing requested appears unrelated to messaging.
Instruction Scope
SKILL.md confines actions to copying files into ~/.openclaw/workspace and invoking the openclaw CLI. It does not instruct reading unrelated system files, exfiltrating data, or posting to unexpected endpoints. Examples and the Python snippet simply call the CLI.
Install Mechanism
No install spec or code is included; this instruction-only skill writes nothing to disk and does not download or install external packages.
Credentials
The skill declares no required env vars or credentials. That is plausible because authentication appears delegated to the platform's OpenClaw CLI/config, but the SKILL.md does not say where Feishu credentials are stored or how they are provisioned — verify OpenClaw already has the appropriate Feishu app credentials or tokens before use.
Persistence & Privilege
always is false and the skill is user-invocable. It doesn't request persistent/system-wide privileges or attempt to modify other skills or global config.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install feishu-messenger
  3. After installation, invoke the skill by name or use /feishu-messenger
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
Complete guide for sending messages/images/files to Feishu with relative path support
Metadata
Slug feishu-messenger
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Feishu Messenger?

通过飞书频道发送文本、图片和多格式文件消息,支持私聊和群聊,需使用相对路径提供媒体文件。 It is an AI Agent Skill for Claude Code / OpenClaw, with 240 downloads so far.

How do I install Feishu Messenger?

Run "/install feishu-messenger" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Feishu Messenger free?

Yes, Feishu Messenger is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Feishu Messenger support?

Feishu Messenger is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Feishu Messenger?

It is built and maintained by hanl754 (@hanl754); the current version is v1.1.0.

💬 Comments