- 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.
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 webhookGET /v1/webhooks/:id- Get webhookGET /v1/webhooks- List webhooksPATCH /v1/webhooks/:id- Update webhookDELETE /v1/webhooks/:id- Delete webhookPOST /v1/webhooks/:id/test- Test webhookPOST /v1/webhooks/:id/replay- Replay webhooksGET /v1/webhooks/:id/attempts- Get delivery attemptsGET /v1/webhooks/dlq- List DLQ entriesPOST /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 URLKAFKA_BROKERSorNATS_URL- Event bus connectionDLQ_RETENTION_DAYS- DLQ retention period (default: 30)