Webhooks
Receive real-time notifications when events occur in your Outcry AI account. Webhooks eliminate the need for polling and provide instant updates when videos complete, fail, or change status.Overview
Webhooks are HTTP POST requests sent to your server when specific events occur. Instead of repeatedly checking video status with API calls, Outcry AI notifies you immediately when something happens.Benefits
- Real-time updates: Instant notifications without polling
- Reduced API calls: Save on rate limits and improve performance
- Event-driven architecture: Build reactive systems
- Reliable delivery: Automatic retries with exponential backoff
How Webhooks Work
Webhook Events
More event types (chat completions, text generation) will be added in future releases.
Creating a Webhook
1. Create Webhook Endpoint
Create an HTTP POST endpoint on your server to receive webhook events:2. Register Webhook
Register your webhook endpoint with the Outcry AI API:3. Store Webhook Secret
Add the webhook secret to your environment variables:Event Payload Format
All webhook events follow a consistent structure:video.completed
Sent when a video finishes generating successfully:video.failed
Sent when a video fails to generate:video.processing
Sent when a video starts processing (optional event):Signature Verification
All webhook requests are signed using HMAC-SHA256 to ensure they’re from Outcry AI. Always verify signatures before processing events.Signature Format
TheX-Outcry-Signature header contains a timestamp and signature:
t- Unix timestamp when the webhook was sentv1- HMAC-SHA256 signature of{timestamp}.{raw_body}
Verification Steps
- Parse signature header to extract timestamp and signature
- Check timestamp - reject if >5 minutes old (prevents replay attacks)
- Compute expected signature using HMAC-SHA256(secret,
{timestamp}.{raw_body}) - Compare signatures using constant-time comparison (prevents timing attacks)
Example Verification Code
Webhook Delivery & Retries
Delivery Requirements
For a webhook delivery to succeed:- Your endpoint must return HTTP 200-299 status code
- Response must be received within 30 seconds
- SSL/TLS certificate must be valid (no self-signed certs in production)
Retry Logic
If delivery fails, Outcry AI automatically retries with exponential backoff:
After 3 failed attempts, the delivery is marked as failed.
Automatic Disable
Webhooks that fail 10 consecutive times are automatically disabled to prevent wasting resources. You’ll need to manually re-enable them from your dashboard after fixing the issue.Monitoring Webhook Health
Check webhook status:Testing Webhooks
Test Event API
Send a test event to verify your webhook is working:video.completed test event with fake data.
Local Testing with ngrok
For local development, use ngrok to expose your local server:Managing Webhooks
List All Webhooks
Update Webhook
Delete Webhook
Best Practices
1. Respond Quickly
Return HTTP 200 immediately, then process the event:2. Implement Idempotency
Handle duplicate events gracefully (network issues may cause retries):3. Use Separate Webhooks per Environment
Don’t mix production and development webhooks:4. Monitor Webhook Health
Set up alerts for webhook failures:5. Validate Event Data
Don’t trust webhook data blindly:6. Log Everything
Keep detailed logs for debugging:Troubleshooting
Webhook Not Receiving Events
Possible causes:- Webhook URL is incorrect or unreachable
- SSL certificate is invalid
- Firewall blocking incoming requests
- Endpoint returning non-200 status code
- Webhook disabled due to failures
- Test webhook with test event API
- Check webhook status for
failure_count - Verify URL is publicly accessible
- Check SSL certificate validity
- Review server logs for errors
- Re-enable if auto-disabled
Signature Verification Failing
Possible causes:- Using wrong webhook secret
- Modifying request body before verification
- Timestamp too old (>5 minutes)
- Using parsed JSON instead of raw body
- Verify you’re using correct
whsec_...secret - Verify signature against raw body (before JSON.parse)
- Check system clock is correct
- Use constant-time comparison for security
Duplicate Events
Possible causes:- Network issues causing retries
- Not implementing idempotency
- Multiple webhooks registered for same events
- Check event ID and skip duplicates
- Store processed event IDs in database
- Review registered webhooks, delete duplicates
Next Steps
Video API
Learn how to create videos that trigger webhooks
Authentication
Understand webhook secret management
Error Handling
Handle webhook errors gracefully
Examples
See complete webhook integration examples