概述
hermes webhook 用于创建、列出和删除动态 Webhook 订阅,实现事件驱动的 Agent 激活。每个订阅都会暴露一个 Webhook 路由;当外部服务向该路由发送 POST 请求时,Hermes 会验证请求,然后使用渲染后的提示词运行 Agent,或将消息直接投递到聊天平台。
hermes webhook <subscribe|add|list|ls|remove|rm|test>
add、ls 和 rm 分别是 subscribe、list 和 remove 的别名。
子命令
subscribe(别名 add)— 创建 Webhook 订阅
hermes webhook subscribe <name> [选项]
<name> 是路由名称,用于 URL:/webhooks/<name>。
| 选项 | 说明 |
|---|---|
--prompt PROMPT |
提示词模板,支持 {dot.notation} 载荷引用。 |
--events EVENTS |
接受的逗号分隔的事件类型。 |
--description DESCRIPTION |
该订阅的用途说明。 |
--skills SKILLS |
为 Agent 运行加载的技能名称,逗号分隔。 |
--deliver DELIVER |
投递目标:log、telegram、discord、slack 等。 |
--deliver-chat-id ID |
跨平台投递的目标聊天 ID。 |
--secret SECRET |
HMAC 密钥(省略时自动生成)。 |
--deliver-only |
跳过 Agent——直接将渲染后的提示词作为消息投递。零 LLM 成本。要求 --deliver 是真实目标(不能是 log)。 |
--script SCRIPT |
~/.hermes/scripts/ 下的过滤/转换脚本。路由载荷通过 stdin 以 JSON 传入;stdout 为空、输出 [SILENT] 或非零退出码都会忽略该 webhook。 |
list(别名 ls)— 列出所有订阅
hermes webhook list
remove(别名 rm)— 删除订阅
hermes webhook remove <name>
test — 发送测试 POST
hermes webhook test <name>
hermes webhook test <name> --payload '{"issue": {"number": 42}}'
向订阅的 Webhook 路由发送测试 POST。--payload 用自定义 JSON 替换默认测试载荷。
示例
# 订阅 GitHub issues,并将渲染后的摘要投递到 Telegram
hermes webhook subscribe github-issues \
--events "issues" \
--prompt "New issue #{issue.number}: {issue.title}" \
--deliver telegram \
--deliver-chat-id "-1001234567890" \
--description "Triage new GitHub issues"
# 纯通知,零 LLM 成本
hermes webhook subscribe critical-alerts \
--prompt "🚨 {service} critical: {metric}" \
--deliver telegram --deliver-chat-id "-1001234567890" --deliver-only
# 生命周期管理
hermes webhook list # 查看所有订阅
hermes webhook test github-issues # 使用前先测试
hermes webhook rm github-issues # 清理不再使用的订阅
提示
subscribe/add、list/ls和remove/rm是可以互换的别名。- 每个订阅都会自动生成唯一的 HMAC 密钥,除非你通过
--secret指定。 - 纯通知场景使用
--deliver-only:零 LLM 成本,不运行 Agent。 - 使用
--script在载荷到达 Agent 之前进行过滤或转换。 - 正式使用前,务必用
hermes webhook test测试订阅。