FeishuButton: Creating Button Approvals with Interactive Cards in Feishu

Introduction

When asking an Agent to perform sensitive operations (deleting files, running shell commands, modifying configurations) in a Feishu group, plain text prompts like “Proceed?” are difficult to audit and do not align with the “human-in-the-loop” workflow. Manually checking Feishu Open Platform documentation, stitching together interactive card JSON, and connecting button callbacks involves many steps and is prone to missing fields. The following introduces feishubutton on SkillHub: it encapsulates the conventions for “Feishu message cards with buttons” and approval-based interactions into a Skill package, enabling Agents to send cards and parse callbacks using a standardized structure.

What is this

feishubutton is a community-published Agent Skill (SkillHub ID @indiv-zhangwei/feishubutton, also listed as @user_a5827f21/feishubutton on the webpage). The current latest version is v1.0.1, authored by Shengtong Education - Zhang Wei. The official one-line description is: feishu message button approve.

The Skill is categorized under office-efficiency, with a subcategory of workflow automation. The package follows the standard SKILL.md format and includes Python source code and example scripts. The documentation specifies that it is designed for Hermes Agent to send interactive cards with buttons on the Feishu side, and its full capabilities rely on the Feishu adaptation layer such as hermes_feishu_plugin.

The SkillHub page shows an AI rating of approximately 4.3/5.0. Security scans by Cohen Lab and Yunding Lab both rate it as “Safe, No Risk.” The metadata is marked as requires_api_key: false.

Core Features

The following content is derived from the SKILL.md and scripts/example.py within the installed v1.0.1 package, listing only the capabilities explicitly documented.

Interactive Cards and Buttons

  1. Explains the JSON structure of Feishu interactive cards: config, header, elements (containing markdown and action blocks).
  2. Summarizes button types: primary (main action), default (secondary), danger (destructive actions).
  3. Defines the convention for button value transmission upon clicking, including fields like hermes_action, approval_id, session_key, and chat_id in approval scenarios.

Approval and Card Tools (Python)

The SKILL.md describes the responsibilities of the modules in src/ as follows:

Module Function
approval.py Approval flow with buttons: send_exec_approval(), handling callbacks handle_card_action(), post-action updates update_approval_card()
builder.py Assembles streaming/completed state cards, split_reasoning_text(), etc.
cardkit.py Sends and PATCH updates interactive cards

scripts/example.py provides locally runnable example functions, including:

  • create_confirmation_card(): A confirmation/cancellation dual-button card;
  • create_approval_card(): Displays commands waiting for execution and provides four button types: Allow Once, Allow Session, Allow Always, and Deny;
  • parse_button_callback(), create_result_card(): Parses callbacks and displays approval result cards.

To run the example (inside the Skill package directory):

python3 scripts/example.py

The documentation requires Python 3.11+ and lists dependencies on hermes_feishu_plugin; if the adapter is not installed, the example still demonstrates the structure by printing the card JSON.

Installation and Activation

First, check if skillhub is already on your machine:

command -v skillhub && skillhub --version

If not installed, follow the official SkillHub installation instructions (full installation example):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

When installing the Skill, you must use --dir to point to the skills directory recognized by your current Agent; otherwise, it defaults to ./skills/ and may not be loaded. Common paths (excerpt from SkillHub installation docs):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

Install feishubutton:

skillhub install feishubutton --namespace indiv-zhangwei --dir ~/.cursor/skills

Replace ~/.cursor/skills with the Agent directory you are actually using. The package name parsed by the CLI is @indiv-zhangwei/feishubutton, and the directory slug after installation is feishubutton.

Via Conversational Agent Installation

The prompt provided on the SkillHub page is: Ask the Agent to install according to the SkillHub Installation Instructions:

@indiv-zhangwei/feishubutton

Additional Steps for Hermes

The installation instructions in SKILL.md also mention: placing the Skill directory under the Hermes Agent’s skills/social-media/ and ensuring src/ is referenceable by Hermes. This exists parallel to the general Agent directory conventions of SkillHub; when deploying for Hermes, verify the path against that documentation.

Typical Usage

1. Sending a Card with Confirmation Buttons

The pattern in the documentation is to construct a card dict and send it as an interactive message via the Feishu adapter (pseudo-code hierarchy consistent with SKILL.md):

card = {
    "config": {"wide_screen_mode": True},
    "header": {
        "title": {"content": "Confirm Action", "tag": "plain_text"},
        "template": "orange"
    },
    "elements": [
        {"tag": "markdown", "content": "Do you want to proceed?"},
        {
            "tag": "action",
            "actions": [
                {
                    "tag": "button",
                    "text": {"tag": "plain_text", "content": "Confirm"},
                    "type": "primary",
                    "value": {"action": "confirm"}
                },
                {
                    "tag": "button",
                    "text": {"tag": "plain_text", "content": "Cancel"},
                    "type": "danger",
                    "value": {"action": "cancel"}
                }
            ]
        }
    ]
}

# await adapter.send_card(chat_id, card)

2. Handling Button Callbacks

async def handle_callback(callback_data):
    action = callback_data.get("action")
    if action == "confirm":
        pass  # Execute business confirmation logic
    elif action == "cancel":
        pass  # Cancel

For approval-type buttons, fields such as hermes_action are used; create_approval_card() in scripts/example.py demonstrates how to write command previews and multi-level authorization buttons into the same card.

3. Previewing JSON Structure Locally

Without connecting to Feishu, you can run the example script first to verify if the card meets expectations before connecting to a real chat_id and callback service.

Scenarios and Notes

Who is it for

  • Teams already running Agents within Feishu (especially Hermes + Feishu plugin) who need “button-click” approval for dangerous operations in groups.
  • Developers who need to unify card JSON, button types, and callback field conventions, hoping the Agent can read the Skill and generate messages using the same template.

Limitations and Notes

  1. Platform Binding: The Skill is explicitly designed for Feishu (Lark); Discord, Telegram, and Slack require their own message component formats and cannot directly adopt this JSON.
  2. Runtime Dependencies: Full sending/updating of cards depends on hermes_feishu_plugin and the Hermes adapter; if only installing the Skill to clients like Cursor, the Agent mainly obtains documentation and example code guidance. Feishu connectivity still requires you to configure app credentials and callbacks yourself.
  3. Source Code and Hermes Integration: Files like src/approval.py implement Hermes approval patch logic, existing alongside standalone script examples; it is recommended to verify import paths and plugin versions in the target environment before integration.
  4. Version: The v1.0.1 changelog on SkillHub is “append import py files”; after upgrading, check for conflicts with the local Hermes directory.

Conclusion

feishubutton consolidates Feishu interactive cards, button types, and approval callback fields into a single Skill specification and Python reference implementation, making it suitable for “message button approval” automation in Feishu groups. To view details, download the Zip, or copy the installation prompt, open the SkillHub skill page:

  • https://www.skillhub.cn/skills/feishubutton
  • https://api.skillhub.cn/user_a5827f21/feishubutton (Site API entry; direct browser access may return 405, skill metadata can be queried via https://api.skillhub.cn/api/v1/skills/feishubutton)
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye