shuliuzhenhua-sys/shuliu-skills · Archived

feishu-card

Use when 用户提到“飞书卡片”“交互卡片”“按钮消息”“interactive 消息”“卡片回调”“给某个 open_id 发卡片”这类场景,需要构建、发送或更新飞书 IM 交互卡片。

First seen Mar 27, 2026

Installation

$ npx skills add shuliuzhenhua-sys/shuliu-skills --skill feishu-card

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from shuliuzhenhua-sys/shuliu-skills.

npx skills add shuliuzhenhua-sys/shuliu-skills

Browse all from shuliuzhenhua-sys/shuliu-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Default branch main
Open issues 0
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,558 B
  • docs SUMMARY.md 239 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Feishu Card

构建、发送和更新飞书交互卡片。

优先保持主技能简洁;只有当任务明确需要卡片样例时,再读取 references/ 下的 JSON 模板。

Base URL: https://open.feishu.cn/open-apis/im/v1

何时使用

当用户有这些诉求时直接用:

  • 给某个 openid、chatid 或用户发送交互卡片
  • 构建带按钮、备注、分割线的飞书消息卡片
  • 把 JSON 卡片作为 interactive 消息发出去
  • 用户点击卡片按钮后,需要根据回调里的 action.value 做处理
  • 已经发过卡片,现在要更新同一条消息而不是重发

Token 获取

本 skill 默认复用 [feishu-user-auth](../feishu-user-auth/SKILL.md) 提供的系统 token 能力。

优先顺序如下:

  1. 如果 PATH 里已经有 feishu-auth,直接执行:
feishu-auth system-token
  1. 如果没有 PATH 命令,就执行安装目录里的 bin:
./.agents/skills/feishu-user-auth/bin/feishu-auth.js system-token

全局安装时:

~/.agents/skills/feishu-user-auth/bin/feishu-auth.js system-token

如果返回的是 JSON,取其中的 accessToken 作为 Authorization: Bearer <token>。

发送卡片

POST /open-apis/im/v1/messages?receive_id_type=open_id
POST /open-apis/im/v1/messages?receive_id_type=chat_id

请求体:

{
  "receive_id": "ou_xxx",
  "msg_type": "interactive",
  "content": "{\"config\":{\"wide_screen_mode\":true},\"header\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"标题\"}},\"elements\":[...]}"
}

关键点:

  • msg_type 必须是 interactive
  • content 必须是“字符串化后的 JSON”,不是对象
  • receiveidtype 要和 receive_id 的类型一致

卡片结构

{
  "config": { "wide_screen_mode": true },
  "header": {
    "title": { "tag": "plain_text", "content": "标题" },
    "template": "blue"
  },
  "elements": [
    {
      "tag": "div",
      "text": { "tag": "lark_md", "content": "**加粗内容**" }
    },
    {
      "tag": "action",
      "actions": [
        {
          "tag": "button",
          "text": { "tag": "plain_text", "content": "确认" },
          "type": "primary",
          "value": { "action": "confirm" }
        }
      ]
    }
  ]
}

常用元素:

  • div: 文本块
  • hr: 分割线
  • action: 按钮区
  • note: 备注区

回调与更新

用户点击按钮后,回调事件里通常关注:

{
  "type": "card.action.trigger",
  "action": {
    "value": {
      "action": "confirm",
      "data": "extra_info"
    }
  }
}

处理完回调后,可更新原卡片消息:

PATCH /open-apis/im/v1/messages/{message_id}

参考模板

仅当任务需要现成模板时,再读取这些文件:

  • references/card-alert.json
  • references/card-morning-briefing.json
  • references/card-skill-test.json

最佳实践

  1. 按钮必须带 value,否则回调难以识别具体动作。
  2. 需要改状态时优先更新原卡片,避免重复刷屏。
  3. 危险操作按钮用 danger 类型。
  4. 发卡片前先确认 receiveidtype 和 receive_id 是否匹配。
  5. 如果 feishu-auth system-token 返回 JSON,不要把整个 JSON 原样塞进请求头,只取 accessToken。