Skip to main content
← Back to Quickstart Guides

Webhook Integration

Real-time event notifications for your streaming infrastructure

20 minutes
Intermediate
Event-Driven
HMAC-SHA256
<100ms
Delivery Speed
P95 delivery latency
6x
Retry Attempts
With exponential backoff
25+
Event Types
Stream, recording, billing
99.99%
Uptime
Enterprise SLA

Webhooks Overview

Push-based event delivery for real-time integrations

Webhooks allow your application to receive real-time HTTP POST notifications when events occur in your WAVE account. Instead of polling our API for changes, your server receives events immediately—typically within 100ms—when streams start, recordings complete, or billing thresholds are reached.

Real-time

P95 delivery under 100ms

Secure

HMAC-SHA256 signatures

Reliable

6 retries with backoff

Available Events

25+ event types across 5 categories

stream.created

A new stream resource was created and is ready for ingest

stream_id
title
created_at
owner_id
protocol
recording_enabled

Use case: Initialize your database record, prepare analytics dashboard

stream.connected

Encoder connected and stream is receiving data

stream_id
connected_at
protocol
ingest_endpoint
client_ip

Use case: Log connection time, track encoder health

stream.started

Stream went live and is receiving video frames

stream_id
started_at
protocol
ingest_endpoint
resolution
bitrate_kbps

Use case: Notify followers, update live status, start viewer tracking

stream.ended

Stream stopped receiving video and went offline

stream_id
ended_at
duration_seconds
peak_viewers
total_views
end_reason

Use case: Send analytics summary, generate clips, notify team

stream.deleted

Stream resource was permanently deleted

stream_id
deleted_at
deleted_by

Use case: Clean up related data, remove from dashboards

Implementation Guide

Register, verify, and handle webhooks

// Register a webhook endpoint
const response = await fetch('https://api.wave.online/v1/webhooks', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://your-server.com/webhooks/wave',
    events: [
      'stream.started',
      'stream.ended',
      'recording.completed',
      'stream.error'
    ],
    // Auto-generated if not provided, but recommended to set your own
    secret: 'whsec_your_webhook_secret_here',
    description: 'Production webhook endpoint',
    // Optional: Filter by specific streams
    filters: {
      stream_ids: ['stream_abc123', 'stream_def456'],
      // Or filter by owner
      owner_ids: ['user_xyz789']
    },
    // Optional: Set custom headers for your endpoint
    custom_headers: {
      'X-Custom-Auth': 'your-internal-token'
    }
  })
});

const webhook = await response.json();
console.log('Webhook created:', webhook);
// {
//   id: 'wh_abc123',
//   url: 'https://your-server.com/webhooks/wave',
//   events: ['stream.started', 'stream.ended', ...],
//   status: 'active',
//   secret: 'whsec_...',
//   created_at: '2024-01-15T10:00:00Z'
// }

Security Headers

Headers included with every webhook request

X-Wave-Signature

HMAC-SHA256 signature: sha256={hex_digest}

sha256=abc123...
X-Wave-Timestamp

Unix timestamp (milliseconds) when event was sent

1705312345678
X-Wave-Event-Type

The event type for routing

stream.started
X-Wave-Webhook-Id

Your webhook configuration ID

wh_abc123
X-Wave-Event-Id

Unique event ID for idempotency

evt_xyz789
X-Wave-Delivery-Id

Unique ID for this delivery attempt

del_123456

Retry Policy

Automatic retries with exponential backoff

If your endpoint fails to respond with a 2xx status code within the timeout window, we automatically retry with exponential backoff:

AttemptDelayTimeoutCumulative
1
Immediate30s0s
2
1 minute30s1m
3
5 minutes30s6m
4
30 minutes30s36m
5
2 hours30s2h 36m
6
8 hours30s10h 36m

Best Practices

Critical patterns for reliable webhook handling

Always verify signatures

Never process webhooks without verifying the HMAC-SHA256 signature. This prevents spoofed events from attackers.

if (!verifySignature(payload, signature)) {
  return res.status(401).json({ error: 'Invalid' });
}

Respond within 5 seconds

Return a 200 response immediately, then process asynchronously. Slow responses trigger retries and may disable your webhook.

res.status(200).json({ received: true });
// Then process in background
processEvent(event).catch(console.error);

Handle idempotently

Events may be delivered multiple times due to retries. Use the event ID to deduplicate and avoid double-processing.

if (await isDuplicate(eventId)) {
  return { duplicate: true };
}
await processAndMark(eventId, event);

Log all events

Store raw event payloads before processing. They are invaluable for debugging, compliance, and replaying failed events.

await eventLog.insert({
  id: event.id,
  payload: rawBody,
  received_at: new Date()
});

Validate timestamps

Reject events with timestamps older than 5 minutes to prevent replay attacks from captured requests.

const age = Date.now() - parseInt(timestamp);
if (age > 300000) { // 5 minutes
  return res.status(400).json({ error: 'Too old' });
}

Use queue for processing

Push events to a message queue (Redis, SQS, etc.) for reliable processing with automatic retries and dead-letter handling.

await eventQueue.push({
  event,
  retries: 0,
  deadLetterAfter: 5
});

Troubleshooting Guide

Common issues and solutions

Success Stories

How teams build with WAVE webhooks

📊

StreamSync Analytics

Analytics Platform

1B+/mo
events
<50ms
latency
99.99%
uptime
Challenge

Needed real-time stream events to power live analytics dashboards for 10,000+ concurrent streamers.

Solution

Implemented WAVE webhooks with Redis queue for event processing, achieving sub-second dashboard updates.

Results
50ms average event delivery
99.99% delivery reliability
10K+ events/second processed
Zero duplicate processing
WAVE webhooks are the backbone of our real-time analytics. The signature verification and retry logic give us confidence in every event.
Jennifer Park, CTO
🔔

NotifyLive

Push Notifications

50M/mo
notifications
85%
openRate
25K
creators
Challenge

Building a notification service that alerts followers within seconds of a stream going live.

Solution

Direct webhook integration with stream.started events, triggering push notifications to mobile and web.

Results
2-second notification delivery
85% open rate on live alerts
3x viewer join rate
$500K ARR from feature
The webhook documentation was so clear we had notifications working in a single afternoon. Our creators love the instant alerts.
Marcus Rivera, Lead Engineer
✂️

CloudClip Pro

Video Processing

100K/day
clips
50TB/day
processing
94%
accuracy
Challenge

Automatically generate highlight clips when streams end, processing thousands of recordings daily.

Solution

recording.completed webhooks trigger ML-powered clip generation pipeline with auto-upload to social media.

Results
5-minute clip delivery
95% creator adoption
10x social engagement
Handles 50TB/day
Every recording completion triggers our AI pipeline automatically. We went from manual clip creation to fully automated in weeks.
Sarah Chen, VP Engineering

Next Steps

Continue building your integration

Need to test webhooks locally?

Use tools like ngrok or localtunnel to expose your local server, or use the “Test Locally” code examples above to simulate events.

WAVE - Enterprise Live Streaming Platform