feishu-card

Send rich interactive card messages to Feishu via Open API. Activate when: user wants to send a Feishu card, interactive message, rich notification, formatted alert, news digest card, data dashboard with charts, or any styled message beyond plain text in Feishu. Supports: markdown cards, raw card JSON, template-based cards (news_digest, report, alert, data_dashboard), and chart components (line/bar/pie). NOT for: plain text messages, reading messages, or managing Feishu docs/wiki.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "feishu-card" with this command: npx skills add dr-xiaoming/feishu-rich-card

Feishu Card Message Skill

Send rich interactive card messages through Feishu Open API via scripts/feishu_card.py.

Prerequisites

  • FEISHU_APP_ID and FEISHU_APP_SECRET env vars (or --app-id/--app-secret flags)
  • Feishu app must have im:message:send_as_bot permission
  • Target user/chat must be reachable by the bot

Quick Start

SKILL_DIR=~/.openclaw/skills/feishu-card

# Simple markdown card
python3 $SKILL_DIR/scripts/feishu_card.py \
  --to <receive_id> --type open_id \
  --markdown "**Hello!** This is a card." \
  --title "Greeting" --color blue

# Raw card JSON file
python3 $SKILL_DIR/scripts/feishu_card.py \
  --to <receive_id> --type chat_id \
  --card /path/to/card.json

# Template-based card
python3 $SKILL_DIR/scripts/feishu_card.py \
  --to <receive_id> --type open_id \
  --template news_digest --data /path/to/news.json

Three Modes

1. Markdown Mode (--markdown)

Wrap markdown text into a card. Combine with --title and --color.

Colors: blue wathet turquoise green yellow orange red carmine violet purple indigo grey default

2. Raw Card Mode (--card)

Pass a pre-built card JSON file (schema 2.0). Full control over all components.

3. Template Mode (--template + --data)

Use bundled templates with a data JSON file.

TemplateUse CaseKey Data Fields
news_digestMulti-item newstitle, footer, items[] (title, summary, source, time, url)
reportStructured reporttitle, summary, conclusion, footer, items[] (title, content)
alertAlert/notificationtitle, level, time, detail, action, footer
data_dashboardData dashboard with charttitle, metric_1..3, chart_type, chart_title, chart_data, x_field, y_field, series_field, details, footer

Chart Support

Feishu Schema 2.0 supports chart components (VChart-based). Three chart types: line, bar, pie.

Image Support

Upload and embed images in cards. Supports local files and URLs.

# Append image to any card mode
python3 $SKILL_DIR/scripts/feishu_card.py \
  --to <id> --type open_id \
  --markdown "Check this out:" --title "Photo" \
  --image /path/to/photo.png

# URL also works (auto-downloads then uploads to Feishu)
python3 $SKILL_DIR/scripts/feishu_card.py \
  --to <id> --type open_id \
  --markdown "News image:" \
  --image "https://example.com/image.jpg"

Programmatic image upload

from feishu_card import get_tenant_token, upload_image, build_image_element

token = get_tenant_token(app_id, app_secret)

# From local file or URL
img_key = upload_image(token, "/path/to/image.png")
# or: img_key = upload_image(token, "https://example.com/photo.jpg")

# Build card element
img_el = build_image_element(img_key, alt_text="描述", mode="fit_horizontal")
# Insert img_el into card["body"]["elements"]

Note: Feishu only accepts real image files (PNG/JPG/GIF/BMP). SVG and HTML pages disguised as images will fail with error 234011.

Programmatic chart building

import sys; sys.path.insert(0, "~/.openclaw/skills/feishu-card/scripts")
from feishu_card import build_chart_element, get_tenant_token, send_card

chart = build_chart_element(
    chart_type="line",
    data_values=[
        {"date": "1月", "value": 100},
        {"date": "2月", "value": 150},
    ],
    title="月度趋势",
    x_field="date",
    y_field="value",
)

card = {
    "schema": "2.0",
    "config": {"wide_screen_mode": True},
    "header": {"title": {"tag": "plain_text", "content": "📊 报表"}, "template": "blue"},
    "body": {"elements": [chart]},
}

token = get_tenant_token(app_id, app_secret)
send_card(token, receive_id, "open_id", card)

For chart JSON structure details, see references/card-components.md → Chart 图表。

Additional Options

  • --reply-to <message_id> — Reply to an existing message
  • --type open_id|chat_id — Receiver ID type

Programmatic Use

from feishu_card import get_tenant_token, build_card_from_markdown, send_card

token = get_tenant_token(app_id, app_secret)
card = build_card_from_markdown("**Hello**", title="Test", color="blue")
send_card(token, receive_id, "open_id", card)

Building complex cards programmatically

import json
from feishu_card import get_tenant_token, send_card, build_chart_element

token = get_tenant_token(app_id, app_secret)

card = {
    "schema": "2.0",
    "config": {"wide_screen_mode": True},
    "header": {
        "title": {"tag": "plain_text", "content": "周报"},
        "template": "purple",
    },
    "body": {
        "elements": [
            {"tag": "markdown", "content": "**本周总结**\n完成了 3 个里程碑"},
            {"tag": "hr"},
            {
                "tag": "column_set",
                "flex_mode": "none",
                "columns": [
                    {"tag": "column", "width": "weighted", "weight": 1,
                     "elements": [{"tag": "markdown", "content": "**完成率**\n<font color='green'>92%</font>"}]},
                    {"tag": "column", "width": "weighted", "weight": 1,
                     "elements": [{"tag": "markdown", "content": "**延期项**\n<font color='red'>2</font>"}]},
                ],
            },
            {"tag": "hr"},
            build_chart_element("bar", [
                {"task": "需求", "count": 15, "type": "完成"},
                {"task": "需求", "count": 3, "type": "进行中"},
                {"task": "Bug", "count": 8, "type": "完成"},
                {"task": "Bug", "count": 1, "type": "进行中"},
            ], title="任务统计", x_field="task", y_field="count", series_field="type", stack=True),
            {"tag": "hr"},
            {
                "tag": "collapsible_panel",
                "expanded": False,
                "header": {"title": {"tag": "plain_text", "content": "查看详情"}},
                "elements": [{"tag": "markdown", "content": "详细内容..."}],
            },
            {"tag": "hr"},
            {"tag": "markdown", "content": "<font color='grey'>自动生成 | 周报系统</font>"},
        ]
    },
}

send_card(token, receive_id, "open_id", card)

⚠️ Schema 2.0 陷阱(实测踩坑记录)

这些是实际发送卡片时遇到的兼容性问题,会导致 200861 unsupported tag 错误:

陷阱说明解决方案
action 标签已废弃按钮容器在 Schema 2.0 中不可用用 markdown [文字](url) 链接替代
note 标签已废弃底部备注标签不可用markdown + <font color='grey'>...</font>
collapsible_panel.vertical_spacing不接受 "default" 字符串值省略此属性,或用 "8px" 等像素值

已实测可用组件

组件状态说明
markdown✅ 已验证支持粗体/链接/列表/font color
hr✅ 已验证分割线
column_set✅ 已验证多列布局
collapsible_panel✅ 已验证折叠面板(注意 vertical_spacing 陷阱)
img✅ 已验证图片(upload_image 上传后嵌入,支持本地文件和URL)
chart✅ 已验证VChart 图表(line/bar/pie)

完整组件参考:references/card-components.md

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Multi Edge-TTS CN

Edge-TTS 在线语音合成 skill。基于微软 Edge TTS 引擎,生成速度快(1-2秒),支持多种音色和输出格式。同时支持飞书(OGG/Opus)和企业微信(AMR)。默认音色 xiaoxiao_lively。需联网。

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated
General

One Person Company OS

Build a visual operating cockpit for an AI-native one-person company across promise, buyer, product, delivery, cash, learning, and assets. / 为 AI 一人公司建立可视化经营...

Registry SourceRecently Updated
General

健康追踪

健康追踪技能 - 追踪饮水、睡眠、步数等健康数据,JSON存储。

Registry SourceRecently Updated