Webhook Integration
This guide walks you through setting up webhooks to receive real-time notifications for commentary approval events.Overview
Webhooks provide push-based delivery so you don’t need to poll the API. When a creator or partner approves commentary, we’ll send an HTTP POST to your endpoint with the full commentary content.Step 1: Register Your Webhook
First, register your webhook endpoint:Step 2: Implement Your Endpoint
Your endpoint should:- Accept POST requests
- Verify the signature
- Return 200 OK quickly (process async if needed)
- Handle duplicate events idempotently (use the
idfield)
Signature Verification
All webhook payloads are signed with HMAC-SHA256. Verify the signature to ensure the request is from Unleeshed.Example Express Handler
Step 3: Test Your Webhook
Use the test endpoint to verify your setup:Retry Behavior
If your endpoint returns a non-2xx status code or times out, we’ll retry:
After 10 consecutive failures, the webhook is auto-disabled. Re-enable via PATCH once the issue is resolved.
Best Practices
- Return quickly: Process events asynchronously and return 200 immediately
- Handle duplicates: Use the event
idfor idempotency - Verify signatures: Always verify the signature before processing
- Log everything: Log event IDs for debugging
- Monitor failures: Set up alerts for consecutive failures
Troubleshooting
Webhook Not Receiving Events
- Check webhook status is
active - Verify URL is accessible from the internet
- Check firewall/security rules allow Unleeshed IPs
Signature Verification Failing
- Ensure you’re using the correct secret (from registration)
- Verify the raw body is used (not parsed JSON)
- Check timestamp tolerance (default 5 minutes)
Duplicate Events
This is expected behavior. Use theid field for deduplication: