feat(alerts): add OpenClaw webhook delivery support#300
feat(alerts): add OpenClaw webhook delivery support#300
Conversation
Add --openclaw channel flag for alert create/update and a new `alerts openclaw-relay` subcommand that polls for alerts and forwards them to OpenClaw's /hooks/agent endpoint with exponential backoff retry. Supports one-shot (--once) and long-running polling modes, with filtering by alert type or ID, and configurable OpenClaw agent options. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pr-reviewer Summary📝 3 findings Review completed. Please address the findings below. Findings by Severity
Review effort: 3/5 (Moderate) SummaryThis PR adds a clean multi-provider webhook delivery system (Slack, Discord, generic, OpenClaw) with full backward compatibility for the previous Findings
|
Refactors OpenClaw-specific webhook into a multi-provider system: - openclaw: /hooks/agent format (original behavior) - generic: simple JSON POST with raw alert data - slack: Slack incoming webhook with blocks - discord: Discord webhook with embeds New flags: --webhook <url> --webhook-type <type> Backward compat: --openclaw still works as alias. webhook-relay replaces openclaw-relay (alias preserved). All 1069 tests pass.
Summary
Adds provider-agnostic webhook delivery for Smart Alerts. Supports multiple webhook targets out of the box.
Providers
/hooks/agentwith agent payload formatUsage
Env vars
WEBHOOK_RELAY_URL/WEBHOOK_RELAY_TOKEN(falls back toOPENCLAW_HOOKS_URL/OPENCLAW_HOOKS_TOKEN)Changes
src/webhook.js— Provider registry, formatters for all 4 providers, delivery with retry, relay pollersrc/commands/alerts.js—--webhook/--webhook-typeflags,webhook-relaysubcommand, backward compat aliasessrc/schema.json— Updated schemasrc/__tests__/webhook.test.js— Tests for all providers, backward compat, relay modesAll 1069 tests pass.