← 返回
未分类

feishubutton

feishu message button approve
培岳
未分类 community v1.0.1 2 版本 100000 Key: 无需
★ 1
Stars
📥 127
下载
💾 0
安装
2
版本
#latest

概述

Feishu Interactive Cards & Buttons Skill

Complete skill package for Hermes Agent to send interactive cards with buttons in Feishu.

Package Structure

feishu-buttons/
├── SKILL.md          # This documentation
├── src/              # Python source files
│   ├── approval.py   # Main approval workflow with buttons
│   ├── builder.py    # Card building utilities
│   └── cardkit.py   # Card sending helpers
└── scripts/         # Utility scripts (optional)

Installation

  1. Copy this skill folder to your Hermes Agent's skills/social-media/ directory
  2. The Python files in src/ should be accessible from your Hermes installation
  3. Requires hermes_feishu_plugin to be installed for full functionality

Core Concepts

1. Interactive Card Format

Feishu interactive cards use a JSON structure:

{
  "config": {"wide_screen_mode": true},
  "header": {
    "title": {"content": "Title", "tag": "plain_text"},
    "template": "orange"
  },
  "elements": [
    {"tag": "markdown", "content": "Message content"},
    {
      "tag": "action",
      "actions": [
        {
          "tag": "button",
          "text": {"tag": "plain_text", "content": "Button Label"},
          "type": "primary",
          "value": {"action": "value", "data": "payload"}
        }
      ]
    }
  ]
}

2. Button Types

typeColorUse Case
-----------------------
primaryBlueMain action
defaultGreySecondary action
dangerRedDestructive action

3. Action Value

The value field in a button is passed back when clicked:

"value": {
  "hermes_action": "approve_once",
  "approval_id": "123",
  "session_key": "session123",
  "chat_id": "chat123"
}

Usage Example

Send Approval Card

from src.approval import send_approval_card

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)

Handle Button Callback

async def handle_callback(callback_data):
    action = callback_data.get("action")
    if action == "confirm":
        # Process confirmation
        pass
    elif action == "cancel":
        # Process cancellation
        pass

Source Files Reference

approval.py

Main implementation for approval workflow with buttons:

  • send_exec_approval() - Send approval card with buttons
  • handle_card_action() - Process button click callbacks
  • update_approval_card() - Update card after action

builder.py

Card building utilities:

  • build_streaming_pre_answer_card() - Build streaming response card
  • build_complete_card() - Build final response card
  • split_reasoning_text() - Extract reasoning from response

cardkit.py

Low-level card sending:

  • send_interactive_card() - Send interactive card
  • patch_interactive_card() - Update existing card

Dependencies

  • Python 3.11+
  • hermes_feishu_plugin (for Feishu adapter)
  • json (standard library)
  • asyncio (standard library)

Platform Notes

This skill is specifically designed for Feishu (Lark) platform. For other messaging platforms:

  • Discord: Use Discord's component-based buttons
  • Telegram: Use inline keyboards
  • Slack: Use interactive buttons

Each platform has its own message format for interactive elements.

版本历史

共 2 个版本

  • v1.0.1 append import py files 当前
    2026-05-02 15:49 安全 安全
  • v1.0.0 Initial release
    2026-05-02 15:30 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

腾讯文档编辑技能

user_a5827f21
腾讯文档(docs.qq.com)-在线云文档平台,是创建、编辑、管理文档的首选 skill。涉及"新建文档"、"创建文档"、"写文档"、"在线文档"、"云文档"、"腾讯文档"、"docs.qq.com"等操作,请优先使用本 skill。支
★ 0 📥 280

灵声工坊视频配音

user_a5827f21
智能视频配音与字幕同步工具。支持TTS语音生成、语速自适应加速、自动识别填充静音段、逐句精校字幕,一键输出成品视频。让配音流程更灵活、更专业。
★ 1 📥 151

subtitle-editor

user_a5827f21
subtitle-editor
★ 1 📥 129