Skip to main content

Global Webhooks

Global webhooks in HITL.sh provide real-time notifications about all system events across your entire account. Unlike loop-specific webhooks, global webhooks capture events from all loops, making them ideal for centralized monitoring, analytics, and integration systems.

What are Global Webhooks?

Global webhooks are HTTP endpoints that receive notifications about:

Global Webhook Events

  • Account-wide Events: User management, billing, and system updates
  • All Loop Events: Requests, responses, and loop status changes
  • System Events: Performance metrics, errors, and maintenance updates
  • Integration Events: API usage, rate limiting, and authentication events

When to Use Global Webhooks

Use Cases

Centralized Monitoring

Monitor all HITL.sh activity from a single endpoint for comprehensive oversight.

Analytics Systems

Collect data from all loops for unified analytics and reporting.

Audit Logging

Maintain comprehensive audit trails for compliance and security purposes.

Integration Hubs

Route events to multiple downstream systems and services.

Comparison with Loop-Specific Webhooks

  • Scope: Account-wide, all loops
  • Events: All system events
  • Use Case: Centralized monitoring and analytics
  • Complexity: Higher, more event types to handle
  • Scope: Single loop only
  • Events: Loop-specific events only
  • Use Case: Loop-specific integrations
  • Complexity: Lower, focused event handling

Setting Up Global Webhooks

1. Create Webhook Endpoint

First, create an endpoint in your system to receive webhook notifications:

2. Configure Webhook in HITL.sh

Set up the global webhook through the API:

3. Test Webhook Configuration

Verify your webhook is working correctly:

Event Types and Payloads

Request Events

Events related to request lifecycle:

Loop Events

Events related to loop management:

User Events

Events related to user management:

System Events

Events related to system operations:

Event Filtering

Selective Event Subscription

Subscribe to specific event types to reduce noise:

Event Pattern Matching

Use wildcards for flexible event filtering:

Webhook Processing

Event Routing

Route different event types to appropriate handlers:

Data Transformation

Transform webhook data for your systems:

Error Handling and Retries

Webhook Delivery Failures

Handle webhook delivery failures gracefully:

Retry Logic

  • Implement exponential backoff
  • Set maximum retry attempts
  • Log failed deliveries for investigation
  • Alert on persistent failures

Fallback Mechanisms

  • Store failed events for later processing
  • Implement alternative notification methods
  • Use polling as backup for critical events
  • Maintain event ordering when possible

Dead Letter Queues

Implement dead letter queues for failed webhooks:

Security and Authentication

Webhook Signature Verification

Always verify webhook signatures:

Rate Limiting

Implement rate limiting to prevent abuse:

Monitoring and Analytics

Webhook Performance Metrics

Track webhook delivery performance:

Delivery Metrics

  • Success rate percentage
  • Average delivery time
  • Failure rate by event type
  • Retry success rates

System Metrics

  • Webhook queue length
  • Processing latency
  • Error frequency
  • Resource utilization

Alerting and Notifications

Set up alerts for webhook issues:
1

Failure Alerts

Alert when webhook delivery fails repeatedly.
2

Performance Alerts

Alert when webhook processing times exceed thresholds.
3

Volume Alerts

Alert when webhook volume is unusually high or low.

Best Practices

Webhook Design

Idempotency

  • Handle duplicate events gracefully
  • Use event IDs for deduplication
  • Implement idempotent processing logic

Event Ordering

  • Maintain event order when possible
  • Use timestamps for sequencing
  • Handle out-of-order events gracefully

Performance Optimization

1

Async Processing

Process webhooks asynchronously to avoid blocking.
2

Batch Processing

Group related events for efficient processing.
3

Connection Pooling

Reuse HTTP connections for better performance.

Troubleshooting

Common Issues

  • Verify webhook URL is accessible
  • Check webhook configuration in dashboard
  • Ensure webhook is enabled and active
  • Verify event subscriptions
  • Check webhook secret configuration
  • Verify signature header format
  • Ensure payload hasn’t been modified
  • Test with webhook testing tool
  • Check endpoint availability and performance
  • Review error logs for specific failure reasons
  • Implement proper error handling
  • Consider implementing retry logic

Next Steps

Ready to set up global webhooks for your HITL.sh account?

Request Webhooks

Learn about per-request callback webhooks.

API Reference

Detailed API documentation for webhook management.

Integration Examples

See how to use webhooks with popular integration platforms.