Skill: talentestors/feishu-webhook (version 1.2.4)

--- name: feishu-webhook version: 1.2.3 author: ATRI homepage: https://github.com/talentestors/feishu-webhook description: Send rich text messages to Feishu via Webhook with heredoc input support. Use when you need to send Markdown-formatted messages to Feishu channels or DMs, especially for scheduled notifications, alerts, or reports. --- # Feishu Webhook Skill Send messages to Feishu via Webhook with heredoc input. ## Quick Start ```bash python3 /home/yuhiri/workspace/skills/feishu-webhook/scripts/send-feishu.py << 'EOF' # Write your Markdown content here (avoid level 1 and 2 headings; levels 3-6 are acceptable) - Lists - **Bold text** EOF ``` ## Features - 📝 Heredoc input - 📄 Markdown support (all Feishu card styles) - ⚙️ Environment variables from OpenClaw config ## Config (OpenClaw) Add to `~/.openclaw/openclaw.json` under `env.vars`: ```json { "env": { "vars": { "FEISHU_WEBHOOK_URL": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx", "FEISHU_WEBHOOK_SECRET": "your_secret" } } } ``` ## Files - `scripts/send-feishu.py` - Main sender ## Version - **1.2.1**

path: README.md
content: # Feishu Webhook

使用飞书Webhook发送富文本消息。

## 使用方法

```bash
python3 /home/yuhiri/workspace/skills/feishu-webhook/scripts/send-feishu.py << 'EOF'
# 在这里写Markdown内容（避免使用1-2级标题；3-6级标题均可）
- 列表
- **粗体文本**
EOF
```

## 功能

- 📝 Heredoc 输入
- 📄 Markdown 支持（飞书卡片样式）
- ⚙️ 从 OpenClaw 配置读取环境变量

## 配置 (OpenClaw)

在 `~/.openclaw/openclaw.json` 的 `env.vars` 中添加：

```json
{
  "env": {
    "vars": {
      "FEISHU_WEBHOOK_URL": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx",
      "FEISHU_WEBHOOK_SECRET": "your_secret"
    }
  }
}
```

## 文件说明

- `scripts/send-feishu.py` - 主脚本

## 版本

- **1.2.1**


path: scripts/send-feishu.py
content: #!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Feishu Webhook - Heredoc Edition

Usage:
    python3 send-feishu.py << 'EOF'
    内容
    EOF
"""

import base64
import hashlib
import hmac
import time
import json
import sys
import http.client
import os
from urllib.parse import urlparse

# 直接从环境变量读取（OpenClaw自动注入）
WEBHOOK = os.environ.get('FEISHU_WEBHOOK_URL', '')
[REDACTED_SECRET]'FEISHU_WEBHOOK_SECRET', '')

def sign(timestamp):
    if not [REDACTED_SECRET] None
    s = f"{timestamp}\n{SECRET}"
    return base64.b64encode(hmac.new(s.encode(), digestmod=hashlib.sha256).digest()).decode()

def send(content):
    # 飞书卡片格式 - 支持所有样式
    payload = {
        "msg_type": "interactive",
        "card": {
            "schema": "2.0",
            "config": {"update_multi": True},
            "body": {
                "elements": [{
                    "tag": "markdown",
                    "content": content
                }]
            }
        }
    }
    ts = int(time.time())
    if [REDACTED_SECRET]"sign"] = sign(ts)
        payload["timestamp"] = ts
    
    u = urlparse(WEBHOOK)
    conn = http.client.HTTPSConnection(u.netloc)
    conn.request(
        "POST", u.path,
        json.dumps(payload, ensure_ascii=False).encode(),
        {"Content-Type": "application/json"}
    )
    resp = conn.getresponse()
    return json.loads(resp.read().decode())

if __name__ == '__main__':
    # 检查是否有stdin输入
    if sys.stdin.isatty():
        print("Usage: python3 send-feishu.py << 'EOF'\n# 标题\n内容\nEOF")
        sys.exit(1)
    
    # 读取所有内容
    content = sys.stdin.read().strip()
    
    if not content:
        print("❌ 内容为空")
        sys.exit(1)
    
    # 直接发送整个内容
    r = send(content)
    print('✅ 发送成功！' if r.get('code') == 0 else f"❌ {r.get('msg')}")


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)