ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

feishu-card

飞书互动卡片发送技能(国际版 Feishu 兼容)。当需要发送格式丰富的飞书卡片消息时使用。支持标题、Markdown 内容、颜色主题。关键:必须使用 schema 2.0 格式 + 双重 JSON stringify,否则国际版飞书(Feishu)无法渲染。

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/dadaniya99/xiaolongxia-feishu-card
Or

飞书互动卡片发送技能

核心要点(必读)

飞书卡片有新旧两种格式:

  • 旧版 components 格式:部分版本不兼容,显示"请升级至最新版本客户端"
  • schema 2.0 格式:✅ 推荐,飞书 7.x 均支持

统一用 schema 2.0 即可,不管飞书是中文界面还是英文界面都能用。

关键:双重 JSON.stringify

import json

card = { ... }  # 卡片对象
content = json.dumps(json.dumps(card))  # 必须 dumps 两次!

一次 stringify 不够,飞书 API 的 content 字段要求是 JSON 字符串。

卡片结构(schema 2.0)

{
  "schema": "2.0",
  "header": {
    "title": {
      "tag": "plain_text",
      "content": "标题文字"
    },
    "template": "blue"
  },
  "body": {
    "elements": [
      {
        "tag": "markdown",
        "content": "**加粗** 普通文字\n\n支持换行"
      }
    ]
  }
}

header.template 颜色选项

  • blue — 蓝色(默认推荐)
  • green — 绿色
  • red — 红色
  • orange — 橙色
  • purple — 紫色
  • grey — 灰色

body.elements 支持的 tag

  • markdown — Markdown 文本(支持 加粗斜体代码、链接)
  • hr — 分割线:{"tag": "hr"}
  • note — 底部备注

发送方式

方法一:用脚本(推荐)

python3 /root/.openclaw/workspace/skills/feishu-card/scripts/send_card.py \
  --open-id "ou_xxxx" \
  --title "标题" \
  --content "**内容** 支持 Markdown" \
  --template "blue"

方法二:用 message tool

直接调用 message tool,msg_type 需要写 interactivecontent 需要双重 stringify(先序列化卡片对象,再序列化整个字符串)。

方法三:curl(手动)

APP_SECRET=$(cat /root/.openclaw/openclaw.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['channels']['feishu']['appSecret'])")
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\":\"cli_a9f5877b3378dbd8\",\"app_secret\":\"$APP_SECRET\"}" \
  | python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])")

python3 -c "
import json
card = {
    'schema': '2.0',
    'header': {'title': {'tag': 'plain_text', 'content': '标题'}, 'template': 'blue'},
    'body': {'elements': [{'tag': 'markdown', 'content': '内容'}]}
}
print(json.dumps(json.dumps(card)))
" | xargs -I{} curl -s -X POST \
  "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"receive_id\":\"ou_xxxx\",\"msg_type\":\"interactive\",\"content\":{}}"

已知信息(猫南北账号)

  • open_id: ou_22f2eefd5abe63e0cd67f4882cec06d4
  • app_id: cli_a9f5877b3378dbd8
  • app_secret: 从 /root/.openclaw/openclaw.json 读取
  • 客户端版本: 飞书 7.62.6,schema 2.0 验证通过

排错

现象原因解决
"请升级至最新版本客户端"用了旧版 components 格式换成 schema 2.0
code 400 JSON parse errorcontent 没有双重 stringifyjson.dumps(json.dumps(card))
消息发出但内容为空schema 字段缺失确保 "schema": "2.0"

Metadata

Stars3409
Views0
Updated2026-03-25
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-dadaniya99-xiaolongxia-feishu-card": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.

Related Skills

evomap-gep

Connect any OpenClaw agent to the EvoMap collaborative evolution marketplace via the GEP-A2A protocol — no evolver required. Activate when the user or agent mentions EvoMap, wants to search for capsules or genes from other agents, publish a solution, or learn the GEP protocol. sender_id is auto-detected from MEMORY.md — each agent just saves their node ID once and the scripts handle the rest.

dadaniya99 3409

pdf-ocr

PDF扫描件转Word文档。支持中文OCR识别,自动裁掉页眉页脚,保留插图,彩色章节封面页保留为图片。使用百度OCR API(免费额度1000次/月)。当用户要求把扫描PDF转成文字/Word时触发。

dadaniya99 3409

sketch-illustration

插画图片生成技能,支持多种手绘风格。使用 Imagen 3(ZenMux API)生成插图,适合流程图、功能说明、PPT配图、教程配图、知识图和手绘信息图等场景。支持四种风格:A) Sketch 极简手绘风(Notion/Linear 风格,简笔人物,冷淡低饱和);B) Watercolor 奶油彩铅水彩风(暖色调,纸纹彩铅,适合PPT讲义);C) Flat Vector Retro 扁平矢量复古风(黑色轮廓线,几何简化,复古配色,适合NotebookLM PPT/课程封面);D) Doodle Infographic 白纸手绘知识图风(白纸背景、拟人角色、高信息密度、手账/课堂板书感,适合概念对比、方法论、拖延机制、知识卡片)。生成后自动上传发送到飞书。当用户要求生成插画、配图、手绘风格图、流程示意图、产品插图、PPT配图、知识图、信息图、手绘知识海报时触发此技能。

dadaniya99 3409

cn-video-gen

国产AI视频生成技能。支持通义万相(Wan2.6文生视频/图生视频)和可灵(Kling V2)。适合创意视频制作、图生视频、动态内容生成等场景。当用户要求生成视频、将图片生成动态视频、或基于描述生成视频片段时触发。

dadaniya99 3409

eudic-vocab

欧路词典生词本管理与每日测试技能。支持自动从欧路词典收藏夹出题、管理单词、删除已掌握词汇。适合每日背单词使用。

dadaniya99 3409