SuperAPI AI 工具集

webhook-subscriptions

智能体与模型

查看项目

更新于 10-16 02:32

技能介绍

用途:为 Hermes Agent 创建动态 Webhook 订阅,使外部服务(GitHub、GitLab、Stripe、CI/CD、IoT 传感器、监控工具)通过向 URL POST 事件来触发智能体运行。

前置设置:需先启用 webhook 平台。用 hermes webhook list 检查;若提示未启用,可用 hermes gateway setup 向导,或在 ~/.hermes/config.yaml 的 platforms.webhook 下设置 enabled、host、port、secret,或通过 ~/.hermes/.env 设置 WEBHOOK_ENABLED、WEBHOOK_PORT、WEBHOOK_SECRET。之后启动或重启网关:hermes gateway run,或 systemctl --user restart hermes-gateway;用 curl http://localhost:8644/health 验证。

主要能力:通过 hermes webhook CLI 管理订阅。创建:hermes webhook subscribe <name>,可带 --prompt、--events、--description、--skills、--deliver、--deliver-chat-id、--secret。返回 webhook URL 与 HMAC 密钥。列表:hermes webhook list;删除:hermes webhook remove <name>;测试:hermes webhook test <name>,可加 --payload。提示词支持 {dot.notation} 访问嵌套字段,如 {issue.title}、{data.object.amount};未指定 prompt 时整段 JSON 会注入提示词。

使用方式:在外部服务中把返回的 URL 配为回调地址,Content-Type 用 application/json,填入返回的 secret,并选择对应事件。支持 GitHub issues、PR、Stripe 支付、CI/CD 构建、通用监控告警等模式。加 --deliver-only 可跳过智能体直接投递消息,POST 成功返回 200,目标失败返回 502,便于上游重试。

安全与限制:每个订阅自动生成 HMAC-SHA256 密钥,也可用 --secret 自定义;适配器校验每次 POST 签名;config.yaml 中的静态路由不可被动态订阅覆盖;订阅持久化到 ~/.hermes/webhook_subscriptions.json。--deliver-only 要求 --deliver 为真实目标,不接受 log。若 webhook 不工作,检查网关是否运行、端口是否监听、日志、签名是否匹配、URL 是否可达(本地可用 ngrok、cloudflared 隧道)以及事件过滤是否匹配。