Skip to main content

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:
The webhook secret (whsec_...) is shown only once when you create the webhook. Store it securely as an environment variable - you’ll need it to verify webhook signatures.

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

The X-Outcry-Signature header contains a timestamp and signature:
  • t - Unix timestamp when the webhook was sent
  • v1 - HMAC-SHA256 signature of {timestamp}.{raw_body}

Verification Steps

  1. Parse signature header to extract timestamp and signature
  2. Check timestamp - reject if >5 minutes old (prevents replay attacks)
  3. Compute expected signature using HMAC-SHA256(secret, {timestamp}.{raw_body})
  4. Compare signatures using constant-time comparison (prevents timing attacks)

Example Verification Code

Always verify signatures! Unverified webhooks are a security risk. Attackers could send fake events to your endpoint.

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:
This sends a 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
Solutions:
  1. Test webhook with test event API
  2. Check webhook status for failure_count
  3. Verify URL is publicly accessible
  4. Check SSL certificate validity
  5. Review server logs for errors
  6. 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
Solutions:
  1. Verify you’re using correct whsec_... secret
  2. Verify signature against raw body (before JSON.parse)
  3. Check system clock is correct
  4. Use constant-time comparison for security

Duplicate Events

Possible causes:
  • Network issues causing retries
  • Not implementing idempotency
  • Multiple webhooks registered for same events
Solutions:
  1. Check event ID and skip duplicates
  2. Store processed event IDs in database
  3. 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