Webhooks Overview
Webhooks let you send real-time notifications to external services whenever requests pass through your KnoxCall routes. Use them to trigger workflows, update databases, send alerts, or integrate with third-party services.What Are Webhooks?
Webhooks are outbound HTTP requests that KnoxCall sends to your specified endpoint when certain events occur. How it works:Event Types
KnoxCall supports 8 event types that follow a Stripe-like naming convention:| Event Type | Triggers When | Example Use Case |
|---|---|---|
request.received | Request arrives at KnoxCall | Logging, real-time dashboards |
request.success | 2xx response received | Analytics, success tracking |
request.redirect | 3xx response received | Redirect monitoring |
request.client_error | 4xx response received | Invalid request tracking |
request.server_error | 5xx response received | Error alerting |
request.timeout | Request times out | Timeout monitoring |
request.error | Any non-2xx response | General error handling |
request.completed | Any response completed | Comprehensive logging |
Combine event types: You can subscribe a single webhook to multiple event types. For example, subscribe to both
request.success and request.server_error to track all outcomes.Webhook Payload
When an event occurs, KnoxCall sends a JSON payload to your endpoint:Payload Configuration
Control what’s included in your webhook payload:| Option | Default | Description |
|---|---|---|
| Include Request Body | Yes | Include the original request body |
| Include Response Body | Yes | Include the backend response body |
| Include Headers | No | Include request/response headers |
| Include Status Code | Yes | Include HTTP status code |
Authentication Methods
Secure your webhook endpoints with multiple authentication options:Bearer Token
Basic Auth
Custom Header
HMAC Signature
Every webhook includes an HMAC-SHA256 signature for verification:Headers Sent
KnoxCall includes these headers with every webhook request:| Header | Description |
|---|---|
Content-Type | Always application/json |
X-Webhook-Signature | HMAC-SHA256 signature for verification |
X-Webhook-ID | Unique identifier for the webhook configuration |
X-Webhook-Event | Event type (e.g., request.success) |
User-Agent | KnoxCall-Webhook/1.0 |
Route Filtering
Limit webhooks to specific routes: All routes (default):payment-webhook: Only payment-related routes → Slack #paymentsauth-webhook: Only authentication routes → Security monitoring tool
Retry Logic
When a webhook delivery fails, KnoxCall can automatically retry: Configuration:- Retry on Failure: Enable/disable retries
- Max Retries: 0-5 attempts (default: 3)
Webhooks are dispatched asynchronously (fire-and-forget). They don’t block or slow down the proxied request.
Webhook Logs
Track all webhook executions in the webhook logs: What’s logged:- Execution timestamp
- Event type
- HTTP method and URL
- Sent headers and body
- Response status and body
- Response time (ms)
- Success/failure status
- Error messages (if failed)
- Retry count
- Linked request ID
- Webhook ID
- Success/failure status
- Event type
- Date range
- Request ID (to correlate with API logs)
Common Use Cases
1. Error Alerting (Slack)
2. Analytics/Logging
3. Workflow Automation (Zapier)
4. Security Monitoring
5. Real-time Dashboards
Performance Considerations
- Non-blocking: Webhooks are dispatched asynchronously
- Parallel dispatch: Multiple webhooks for the same event run in parallel
- Timeout: Configurable timeout (1-60 seconds, default: 30)
- No impact on latency: Webhook failures don’t affect the proxied request
Next Steps
Creating Webhooks
Step-by-step webhook setup guide
Testing Webhooks
How to test your webhook configuration
Webhook Logs
Viewing and debugging webhook executions
API Logs
Correlate webhooks with API requests
Statistics
- Level: intermediate
- Time: 8 minutes
Tags
webhooks, notifications, events, integrations, slack, zapier