Files
gru_emoney_token-factory/api/services/webhook-service
defiQUG e8ae376e90 Enhance API services with validation and error handling improvements
- Integrated Zod validation schemas across various API routes to ensure input integrity and improve error handling.
- Updated `mapping-service`, `orchestrator`, `packet-service`, and `webhook-service` to utilize validation middleware for request parameters and bodies.
- Improved error handling in webhook management, packet generation, and compliance routes to provide clearer feedback on request failures.
- Added new validation schemas for various endpoints, enhancing overall API robustness and maintainability.
- Updated dependencies in `package.json` to include the new validation library.
2025-12-12 20:23:45 -08:00
..

Webhook Service

Webhook delivery service with retry logic and dead letter queue.

Features

  • Webhook registration and management
  • Event-based webhook delivery
  • Exponential backoff retry logic
  • Dead letter queue (DLQ) for failed deliveries
  • HMAC-SHA256 payload signing
  • Delivery attempt tracking

API Endpoints

  • POST /v1/webhooks - Create webhook
  • GET /v1/webhooks/:id - Get webhook
  • GET /v1/webhooks - List webhooks
  • PATCH /v1/webhooks/:id - Update webhook
  • DELETE /v1/webhooks/:id - Delete webhook
  • POST /v1/webhooks/:id/test - Test webhook
  • POST /v1/webhooks/:id/replay - Replay webhooks
  • GET /v1/webhooks/:id/attempts - Get delivery attempts
  • GET /v1/webhooks/dlq - List DLQ entries
  • POST /v1/webhooks/dlq/:id/retry - Retry DLQ entry

Retry Logic

  • Max retries: 3
  • Exponential backoff: 1s, 2s, 4s
  • Failed deliveries moved to DLQ after max retries

Webhook Signing

Webhooks can be signed with HMAC-SHA256 using a secret:

  • Header: X-Webhook-Signature
  • Algorithm: HMAC-SHA256
  • Secret: Provided during webhook creation

Configuration

  • REST_API_URL - Main REST API URL
  • KAFKA_BROKERS or NATS_URL - Event bus connection
  • DLQ_RETENTION_DAYS - DLQ retention period (default: 30)