Skip to content

feat: Webhook Event System with retry and HMAC signing#1049

Open
zp6 wants to merge 1 commit into
rohitdash08:mainfrom
zp6:feature/webhook-system
Open

feat: Webhook Event System with retry and HMAC signing#1049
zp6 wants to merge 1 commit into
rohitdash08:mainfrom
zp6:feature/webhook-system

Conversation

@zp6
Copy link
Copy Markdown

@zp6 zp6 commented May 14, 2026

Webhook Event System

Implements #77 - Signed webhook delivery for key FinMind events.

What's included

packages/backend/app/services/webhooks.py

  • WebhookManager class with full lifecycle management

egister_webhook(url, events) - register endpoints with optional custom secret

  • rigger_event(event_type, data) - dispatch events to all matching webhooks
  • Exponential backoff retry (configurable max_retries, �ase_delay, max_delay)
  • HMAC-SHA256 payload signing via X-FinMind-Signature header
  • Delivery history with filtering by webhook ID or event type
  • Thread-safe operations

Supported event types:

Event Description
rade_signal Trading signals generated by AI analysis
portfolio_update Portfolio value or composition changes

|
isk_alert | Risk threshold breaches or warnings |
| market_anomaly | Detected market anomalies |

packages/backend/tests/test_webhooks.py

  • 20+ tests covering registration, triggering, retry logic, signatures, delivery history, payload structure, and edge cases

Acceptance Criteria

  • ? Signed delivery (HMAC-SHA256)
  • ? Retry & failure handling (exponential backoff)
  • ? Event types documented

- WebhookManager class with register/unregister/trigger operations
- Support for event types: trade_signal, portfolio_update, risk_alert, market_anomaly
- Exponential backoff retry mechanism (configurable max retries, base/max delay)
- HMAC-SHA256 payload signing (X-FinMind-Signature header)
- Delivery tracking with history and filtering
- Comprehensive test suite (registration, trigger, retry, signatures, payload structure)

Closes rohitdash08#77
@zp6 zp6 requested a review from rohitdash08 as a code owner May 14, 2026 15:54
@zp6 zp6 mentioned this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant