Skip to main content

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:
Save the secret from the response - it’s only shown once and is required for signature verification.

Step 2: Implement Your Endpoint

Your endpoint should:
  1. Accept POST requests
  2. Verify the signature
  3. Return 200 OK quickly (process async if needed)
  4. Handle duplicate events idempotently (use the id field)

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:
Check the response to confirm your endpoint is receiving and verifying webhooks correctly.

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

  1. Return quickly: Process events asynchronously and return 200 immediately
  2. Handle duplicates: Use the event id for idempotency
  3. Verify signatures: Always verify the signature before processing
  4. Log everything: Log event IDs for debugging
  5. 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 the id field for deduplication: