Skip to main content

Overview

Coming Soon: Custom webhook configuration is under development. This page documents the planned functionality.
Custom webhooks allow you to receive HTTP callbacks when events occur in Fanfare. This enables you to:
  • Sync data with external systems in real-time
  • Trigger automations in your own applications
  • Build custom integrations without polling the API

Planned Features

Event Types

The following events will be available for webhook subscriptions:

Consumer Events

EventDescription
consumer.createdNew consumer registered
consumer.updatedConsumer profile updated
consumer.deletedConsumer removed

Experience Events

EventDescription
experience.createdNew experience created
experience.activatedExperience went live
experience.completedExperience finished
experience.cancelledExperience cancelled

Distribution Events

EventDescription
distribution.joinedConsumer joined queue/draw
distribution.admittedConsumer admitted from queue
distribution.winner_selectedDraw winner selected
distribution.bid_placedAuction bid received
distribution.completedConsumer completed checkout

Order Events

EventDescription
order.createdNew order placed
order.paidOrder payment confirmed
order.fulfilledOrder marked as fulfilled
order.cancelledOrder cancelled

Webhook Configuration

When available, you will be able to configure webhooks via: Admin Dashboard:
  1. Navigate to Settings > Integrations > Webhooks
  2. Click Add Webhook
  3. Configure:
    • Endpoint URL
    • Events to subscribe
    • Secret for signature verification
API:
POST /api/webhooks
Content-Type: application/json

{
  "url": "https://example.com/webhooks/fanfare",
  "events": [
    "consumer.created",
    "distribution.winner_selected"
  ],
  "secret": "whsec_your_secret_key"
}

Webhook Payload Format

Webhooks will use the following payload structure:
{
  "id": "wh_evt_abc123",
  "type": "distribution.winner_selected",
  "timestamp": "2024-06-20T15:30:00Z",
  "organization_id": "org_xyz789",
  "data": {
    "consumer_id": "con_123",
    "distribution_id": "dist_456",
    "experience_id": "exp_789",
    "product_id": "prod_012"
  }
}

Signature Verification

Webhooks will include a signature header for verification:
X-Fanfare-Signature: sha256=abc123...
X-Fanfare-Timestamp: 1687273800
Verification (Node.js example):
import crypto from "crypto";

function verifyWebhook(payload: string, signature: string, secret: string): boolean {
  const expected = crypto.createHmac("sha256", secret).update(payload).digest("hex");

  return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(`sha256=${expected}`));
}

Retry Policy

Failed webhook deliveries will be retried:
AttemptDelay
1Immediate
21 minute
35 minutes
430 minutes
52 hours
612 hours
After 6 failed attempts, the webhook will be marked as failed and you will be notified.

Delivery Status

Each webhook delivery will track:
  • Delivery timestamp
  • HTTP response code
  • Response body (truncated)
  • Retry count
  • Success/failure status

Current Integrations

While custom webhooks are under development, Fanfare currently supports receiving webhooks from:

Stripe Webhooks

Receive payment and subscription events from Stripe:

Twilio Webhooks

Receive SMS delivery status callbacks from Twilio:

Resend Webhooks

Receive email delivery events from Resend:

Workarounds

Until custom webhooks are available, you can:

Poll the API

Use the Fanfare API to periodically check for changes:
# Get recent consumers
GET /api/consumers?sort=-createdAt&limit=100

# Get distribution participants
GET /api/distributions/:id/consumers?status=SELECTED

Use Third-Party Integration Platforms

Connect Fanfare to automation platforms that support API polling:
  • Zapier (planned)
  • Make (planned)
  • n8n
  • Pipedream

Requesting Access

If you have an urgent need for webhook functionality:
  1. Contact support at [email protected]
  2. Describe your use case
  3. We may be able to provide early access or a custom solution