Skip to main content

Webhook API

The Webhook API provides comprehensive webhook management with reliable delivery, detailed logging, dead-letter queue handling, and intelligent retry mechanisms. Webhooks enable real-time notifications and event-driven integrations with external systems.

Authentication

All webhook endpoints require authentication with API key:

Rate Limits

Webhook Management

Create Webhook

Create a new webhook subscription. Endpoint: POST /webhooks Request Body:
Parameters:
  • name (string, required): Webhook name
  • description (string, optional): Webhook description
  • url (string, required): Webhook callback URL
  • events (array, required): List of events to subscribe to
  • filters (object, optional): Event filtering criteria
  • delivery_config (object, optional): Delivery configuration
    • timeout_ms (integer): Request timeout
    • retry_count (integer): Number of retry attempts
    • retry_delay_ms (integer): Delay between retries
    • signature_header (string): Signature header name
    • include_metadata (boolean): Include metadata in payload
    • include_payload (boolean): Include full payload
  • secret (string, optional): Secret for signature verification
  • metadata (object, optional): Additional metadata
Response:
Example:

List Webhooks

Retrieve all webhooks with optional filtering. Endpoint: GET /webhooks Query Parameters:
  • status (string): Filter by status (active, inactive, paused)
  • event (string): Filter by specific event
  • limit (integer, default: 20, max: 100): Results per page
  • offset (integer, default: 0): Pagination offset
Response:

Get Webhook

Retrieve a specific webhook by ID. Endpoint: GET /webhooks/{id} Response:

Update Webhook

Update an existing webhook configuration. Endpoint: PUT /webhooks/{id} Request Body:

Delete Webhook

Permanently delete a webhook. Endpoint: DELETE /webhooks/{id} Response:

Webhook Testing

Test Webhook

Test webhook delivery with sample payload. Endpoint: POST /webhooks/{id}/test Request Body:
Parameters:
  • event (string, required): Event to test
  • test_payload (object, optional): Custom test payload
  • include_signature (boolean, default: true): Include signature in test
Response:

Webhook Delivery Logging

Get Delivery Logs

Retrieve webhook delivery logs. Endpoint: GET /webhooks/delivery-logs Query Parameters:
  • webhook_id (string): Filter by webhook ID
  • status (string): Filter by delivery status (success, failed, pending)
  • event (string): Filter by event type
  • start_time (string): Start time filter
  • end_time (string): End time filter
  • limit (integer, default: 50, max: 200): Results per page
  • offset (integer, default: 0): Pagination offset
Response:

Get Delivery Statistics

Retrieve webhook delivery statistics. Endpoint: GET /webhooks/delivery-stats Response:

Dead Letter Queue

Get Dead Letter Queue

Retrieve failed webhook deliveries. Endpoint: GET /webhooks/dead-letter Query Parameters:
  • limit (integer, default: 50, max: 200): Results per page
  • offset (integer, default: 0): Pagination offset
  • older_than (string): Filter entries older than timestamp
Response:

Retry Dead Letter Entry

Retry a specific failed delivery. Endpoint: POST /webhooks/dead-letter/{id}/retry Response:

Delete Dead Letter Entry

Remove an entry from the dead letter queue. Endpoint: DELETE /webhooks/dead-letter/{id}

Purge Dead Letter Queue

Remove all entries from the dead letter queue. Endpoint: DELETE /webhooks/dead-letter Request Body:
Parameters:
  • confirm (boolean, required): Confirmation flag
  • older_than (string, optional): Only remove entries older than timestamp

Webhook Events

Available Events

Event Payload Structure

Memory Event Payload

Signature Verification

Webhook signatures are included for security verification:

Verification Process

  1. Extract Signature: Get signature from header
  2. Compute Signature: HMAC with using webhook secret
  3. Compare: Verify computed signature matches header

Example Verification (Python)

Error Handling

Common Error Responses

Error Codes

Best Practices

Webhook Configuration

  1. HTTPS Only: Use HTTPS URLs for webhook endpoints
  2. Unique URLs: Use unique URLs for different webhook subscriptions
  3. Event Filtering: Use filters to reduce unnecessary notifications
  4. Secret Management: Store webhook secrets securely
  5. Timeout Configuration: Set appropriate timeouts for your endpoint

Delivery Reliability

  1. Retry Configuration: Configure appropriate retry attempts and delays
  2. Monitoring: Monitor webhook delivery statistics
  3. Dead Letter Queue: Monitor and manage the dead letter queue
  4. Performance Testing: Test webhook endpoint under load
  5. Failover: Implement failover endpoints for critical webhooks

Security

  1. Signature Verification: Always verify webhook signatures
  2. IP Whitelisting: Consider IP whitelisting for Hystersis IPs
  3. Rate Limiting: Implement rate limiting on your webhook endpoint
  4. Data Validation: Validate webhook payload structure
  5. Secure Storage: Store webhook secrets securely

Performance

  1. Fast Responses: Return webhook responses quickly
  2. Async Processing: Use asynchronous processing for webhook handling
  3. Payload Optimization: Minimize webhook payload size
  4. Connection Reuse: Use HTTP connection pooling
  5. Batch Processing: Process multiple related events together

Monitoring

  1. Delivery Metrics: Track success rates and delivery times
  2. Error Tracking: Monitor and track delivery failures
  3. Performance Monitoring: Monitor webhook endpoint performance
  4. Alerts: Set up alerts for delivery failures
  5. Regular Audits: Regularly audit webhook configuration and delivery