创建动态 webhook 订阅,让外部服务(GitHub、GitLab、Stripe、CI/CD、IoT 传感器、监控工具)可以通过 POST 事件到 URL 触发 Hermes agent 运行。
创建订阅前必须启用 webhook 平台。检查:
hermes webhook list
如果显示"Webhook platform is not enabled",设置它:
hermes gateway setup
按提示启用 webhooks、设置端口和全局 HMAC 密钥。
添加到 ~/.hermes/config.yaml:
platforms:
webhook:
enabled: true
extra:
host: "0.0.0.0"
port: 8644
secret: "generate-a-strong-secret-here"
添加到 ~/.hermes/.env:
WEBHOOK_ENABLED=true
WEBHOOK_PORT=8644
WEBHOOK_SECRET=generate-a-strong-secret-here
配置后启动(或重启)gateway:
hermes gateway run
# 或使用 systemd:
systemctl --user restart hermes-gateway
hermes webhook subscribe
--prompt "Prompt template with {payload.fields}"
--events "event1,event2"
--description "What this does"
--skills "skill1,skill2"
--deliver telegram
--deliver-chat-id "12345"
hermes webhook list
hermes webhook remove
hermes webhook test
hermes webhook test --payload '{"key": "value"}'
Prompt 支持 {dot.notation} 访问嵌套 payload 字段:
{issue.title}——GitHub issue 标题{pull_request.user.login}——PR 作者{data.object.amount}——Stripe 支付金额{sensor.temperature}——IoT 传感器读数
hermes webhook subscribe github-issues
--events "issues"
--prompt "New GitHub issue #{issue.number}: {issue.title}nnAction: {action}nAuthor: {issue.user.login}nBody:n{issue.body}nnPlease triage this issue."
--deliver telegram
--deliver-chat-id "-100123456789"
hermes webhook subscribe stripe-payments
--events "payment_intent.succeeded,payment_intent.payment_failed"
--prompt "Payment {data.object.status}: {data.object.amount} cents from {data.object.receipt_email}"
--deliver telegram
--deliver-chat-id "-100123456789"
对于只需推送通知到用户聊天——无需推理、无 agent 循环——添加 --deliver-only。渲染的 --prompt 模板成为字面消息体,直接分发到目标适配器。
hermes webhook subscribe antenna-matches
--deliver telegram
--deliver-chat-id "123456789"
--deliver-only
--prompt "🎉 New match: {match.user_name} matched with you!"
--description "Antenna match notifications"
--secret 提供自己的)~/.hermes/webhook_subscriptions.jsonsystemctl --user status hermes-gateway 检查curl http://localhost:8644/health 应返回 {"status": "ok"}hermes webhook list 中的一致
评论区