# Dify 插件：实时事件、推送通知与审批

> Dify 的工具插件，提供四个可用于工作流和 Agent 的工具：发布事件到频道、发送推送通知、请人批准某个步骤，以及读取对方的回答。

Source: https://hibira.io/zh-cn/guides/dify

Dify 的工具插件，提供四个可用于工作流和 Agent 的工具：发布事件到频道、发送推送通知、请人批准某个步骤，以及读取对方的回答。

Package: hibira-io/dify

- Request Approval 会给对方发送一次性链接，用来批准或选择一个选项，并可在节点内等待回答，最长 9 分钟。Get Approval 可以稍后读取回答。
- 每个工具也能在 Dify Agent 中使用，由模型填入频道、消息或问题。
- Send Push Notification 按 interest 或用户 ID 推送到 iOS、Android 和网页设备。
- 请求使用 App secret 签名，secret 本身不会被发送。插件只与 Hibira API 通信，不存储任何数据。

## 1. 安装

```text
Plugins → Install plugin → Marketplace → Hibira
  or: Install plugin → Local package file →
      hibira-0.1.0.difypkg from github.com/hibira-io/dify/releases
```

## 2. 配置

```text
Tools → Hibira → API Key Authorization Configuration
  App ID:            YOUR_APP_ID
  Key:               YOUR_APP_KEY
  Secret:            YOUR_APP_SECRET
  Push Instance ID:  optional, for push notifications
  Push Secret Key:   optional
```

## 3. 请求审批

```text
Start (order, amount)
→ Hibira → Publish Event
    Channels:  orders      Event:  refund-requested
→ Hibira → Request Approval
    Question:  Refund order {{order}} for {{amount}}?
    Options:   Refund, Decline
    Wait for Answer (Minutes):  5
→ IF text starts with Approved → Hibira → Send Push Notification
```

## 开始之前

- 审批适用于在 Hibira 控制台中创建的应用。回答链接只能使用一次，并在你设定的时间后失效。
- Wait for Answer 设为 0 时，Request Approval 会立即返回，回答链接在 url 中。把链接发给对方，再用 Get Approval 等待回答。
- Send Push Notification 需要 App 的 Push 标签页中的 Push Instance ID 和 Push Secret Key。

- [Dify Marketplace](https://marketplace.dify.ai/plugin/hibira/hibira)
- [GitHub](https://github.com/hibira-io/dify)
