Webhooks API
Webhooks allow you to receive real-time notifications about events in your Kaie workflows. Use webhooks to integrate with external systems, trigger custom actions, or build real-time dashboards.Overview
Webhooks are HTTP callbacks that Kaie sends to your application when specific events occur. Common use cases include:- Notifying external systems of workflow completions
- Triggering custom actions based on customer interactions
- Building real-time monitoring dashboards
- Integrating with third-party services
Webhook Events
Available Events
Event Payload Structure
All webhook events follow a consistent payload structure:Webhook Management
Create Webhook
Create a new webhook endpoint.Request
Request Body
Response
List Webhooks
Retrieve all webhooks in your account.Request
Parameters
Response
Get Webhook
Retrieve details of a specific webhook.Request
Response
Update Webhook
Update an existing webhook.Request
Request Body
Response
Delete Webhook
Delete a webhook permanently.Request
Response
Webhook Security
Signature Verification
All webhook requests include an HMAC-SHA256 signature in theX-Kaie-Signature header for verification.
Verification Process
- Extract the signature from the
X-Kaie-Signatureheader - Create a hash of the request body using your webhook secret
- Compare the signatures using a constant-time comparison
Example Implementation
Python Example
IP Whitelisting
For additional security, you can whitelist Kaie’s IP addresses:203.0.113.0/24- Primary webhook IP range198.51.100.0/24- Secondary webhook IP range
Webhook Delivery
Delivery Process
- Event Occurs: An event triggers in your Kaie workflow
- Webhook Queued: The webhook is added to the delivery queue
- HTTP Request: Kaie sends a POST request to your endpoint
- Response Handling: Your endpoint responds with HTTP status code
- Retry Logic: If delivery fails, retry according to policy
Response Codes
Retry Policy
Webhooks are retried according to the configured retry policy:- Max Retries: Maximum number of retry attempts (default: 3)
- Retry Delay: Delay between retries in milliseconds (default: 1000)
- Exponential Backoff: Delay increases exponentially with each retry
- Max Delay: Maximum delay between retries (default: 30000ms)
Webhook Testing
Test Webhook
Test a webhook endpoint to verify it’s working correctly.Request
Request Body
Response
Webhook Logs
View delivery logs for a webhook.Request
Parameters
Response
Error Handling
Common Error Codes
Error Response Format
Best Practices
Webhook Implementation
Endpoint Design
Endpoint Design
- Use HTTPS endpoints only
- Implement idempotency for duplicate events
- Respond quickly (within 5 seconds)
- Use appropriate HTTP status codes
Security
Security
- Verify webhook signatures
- Use IP whitelisting when possible
- Implement rate limiting
- Log all webhook deliveries
Performance Optimization
Processing
Processing
- Process webhooks asynchronously
- Use message queues for high volume
- Implement proper error handling
- Monitor webhook performance
Monitoring
Monitoring
- Track delivery success rates
- Monitor response times
- Set up alerts for failures
- Regular testing and validation
Next Steps
Explore more API endpoints:Workflows API
Manage workflows programmatically
Triggers API
Manage workflow triggers
Analytics API
Access analytics data
Authentication
Learn about API authentication