Webhooks
Replay webhooks allow you to receive real-time notifications when important events occur in your account. Configure webhook endpoints in your company settings to automatically receive event data.Overview
Webhooks are HTTP POST requests sent to your configured endpoint URL when specific events occur. Each webhook includes:- Signed payloads - All webhooks are signed using HMAC-SHA256 for security
- Retry logic - Automatic retries with exponential backoff (up to 3 attempts)
- Event filtering - Enable or disable specific event types per webhook endpoint
- Multiple endpoints - Configure multiple webhook URLs per company
Setting Up Webhooks
1. Configure Webhook Endpoint
Navigate to your company settings and add a webhook URL. Each webhook endpoint includes:- Webhook URL - The HTTPS endpoint where events will be sent
- Signing Secret - A secret key used to verify webhook authenticity (format:
whsec_...) - Event Subscriptions - Toggle which events to receive
2. Verify Webhook Signatures
All webhooks include anX-Replay-Signature header that you should verify to ensure the request came from Replay.
Header Format:
- Extract the timestamp (
t) and signature (v1) from the header - Get the raw request body as a string
- Create the signed payload:
{timestamp}.{raw_body_json} - Compute HMAC-SHA256 using your signing secret
- Compare the computed signature with the provided signature using a timing-safe comparison
- Verify the timestamp is within 5 minutes (to prevent replay attacks)
Webhook Events
recording.processing.failed
Sent when processing of an external recording fails.
Payload:
roleplay.session.results
Sent when a roleplay session completes and results are available.
Payload:
memorization.results
Sent when a script memorization attempt completes.
Payload:
roleplay.created
Sent when a LiveKit room is successfully created for a roleplay session.
Payload:
roleplay.session.audio.completed
Sent when roleplay audio recording processing completes.
Payload:
- The
audioUrlis a pre-signed Google Cloud Storage URL with a 15-minute expiry - Download or process the audio file within 15 minutes of receiving the webhook
- This event is only for audio recordings (not video)
Retry Logic
Webhooks include automatic retry logic:- Max Retries: 3 attempts
- Retry Delays: Exponential backoff (1s, 2s, 4s)
- Timeout: 30 seconds per attempt
- Retry Conditions: Network errors, timeouts, or 5xx status codes
2xx status code to indicate successful processing. Any other status code will trigger a retry.
Security Best Practices
- Always verify signatures - Never process webhooks without verifying the
X-Replay-Signatureheader - Use HTTPS - Webhook URLs must use HTTPS
- Check timestamps - Reject webhooks older than 5 minutes to prevent replay attacks
- Store secrets securely - Keep your webhook signing secrets secure and never expose them in client-side code
- Idempotency - Design your webhook handlers to be idempotent (safe to process multiple times)
Testing Webhooks
You can test your webhook endpoint using tools like:- ngrok - Create secure tunnels to localhost
- webhook.site - Inspect webhook payloads
- RequestBin - Capture and inspect HTTP requests
Troubleshooting
Webhook Not Received
- Verify your webhook URL is accessible and returns a 2xx status code
- Check that the event type is enabled in your webhook settings
- Review server logs for delivery attempts
- Ensure your endpoint can handle POST requests with JSON payloads
Invalid Signature
- Verify you’re using the correct signing secret from your webhook settings
- Ensure you’re parsing the signature header correctly
- Check that you’re using the raw request body (not parsed JSON) for verification
- Verify timestamp is within the 5-minute tolerance window
Retry Failures
- Check your endpoint’s response time (must be under 30 seconds)
- Ensure your endpoint returns proper HTTP status codes
- Review error logs for specific failure reasons

