Smart Routing
Not all endpoints are equal. Smart routing distributes webhooks intelligently across multiple endpoints.
The Problem
If you have multiple servers receiving webhooks, you need to decide which one gets each delivery. Simple round-robin doesn't account for server health or response times.
Quick Start
Configure smart routing in 2 steps:
1. Select an Endpoint
Go to Dashboard β Routing. Select the endpoint you want to configure.
2. Choose a Strategy
Select round-robin or failover. Configure fallback URL if needed.
Routing Strategies
HookSniff supports four routing strategies per endpoint:
π Round-Robin
Distributes webhooks evenly across all endpoints in rotation. Each endpoint gets one request before cycling back.
Example: 3 endpoints β request 1βA, 2βB, 3βC, 4βA, 5βB, ...π‘οΈ Failover
Primary endpoint handles all requests. If it fails (5xx or timeout), the fallback URL receives the request.
Example: Primary (your-server.com) β Fallback (backup-server.com)βοΈ Weighted
Distributes traffic based on endpoint health. Healthier endpoints get more traffic. When failures increase, traffic shifts to the fallback URL.
π² Random
Randomly selects between primary and fallback URL. 50/50 distribution when both are available.
Configuration
Configure routing via the Dashboard or API:
curl -X PUT https://hooksniff-api-1046140057667.europe-west1.run.app/v1/endpoints/ENDPOINT_ID \n -H "Authorization: Bearer hr_live_YOUR_KEY" \n -H "Content-Type: application/json" \n -d {"routing_strategy": "failover", "fallback_url": "https://backup.your-app.com/webhooks"}Health Monitoring
HookSniff monitors endpoint health automatically. Unhealthy endpoints are deprioritized or removed from rotation.
Metrics tracked:
- β’ Success rate β percentage of successful deliveries
- β’ Average latency β response time in milliseconds
- β’ Consecutive failures β number of failed requests in a row
- β’ Last successful delivery β time since last success
Best Practices
- β’ Use failover for critical webhooks β ensure delivery even if primary is down
- β’ Use weighted for gradual failover β traffic shifts automatically as health degrades
- β’ Monitor health metrics β set up alerts for unhealthy endpoints
- β’ Test failover regularly β verify your fallback endpoint works
FAQ
Can I change routing strategy after creating an endpoint?
Yes. Routing strategy can be changed at any time. Existing deliveries are not affected.
What happens if all endpoints fail?
The delivery enters the retry queue and is retried according to the retry policy.
Can I use routing with retry policy?
Yes. Routing and retry are independent. If routing fails, retry kicks in.
Further Reading
- β’ Retry Policy β Configure retry behavior
- β’ Health Monitoring β Monitor endpoint health
- β’ Rate Limiting β Protect endpoints from overload