Back to docs
Webhooks

Webhooks

Receive real-time notifications when conversion events happen

How Webhooks Work

PerfectConvertly sends HTTP POST requests to your configured endpoint

  1. Configure your webhook endpoint URL in the dashboard
  2. Select which events you want to subscribe to
  3. When an event occurs, we send a POST request to your URL
  4. Verify the request signature using your webhook secret
  5. Respond with a 200 status code to acknowledge receipt

Available Events

conversion.completedFired when a conversion finishes successfully
conversion.failedFired when a conversion fails
credits.lowFired when your credit balance drops below 5
subscription.updatedFired when your subscription changes

Webhook Payload Example

Example payload for conversion.completed event

{
  "event": "conversion.completed",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "conversion_id": "conv_abc123",
    "status": "completed",
    "transactions_count": 47,
    "output_format": "csv",
    "output_url": "https://..."
  },
  "signature": "sha256=..."
}

Verifying Signatures

Verify that the webhook came from PerfectConvertly

import crypto from 'crypto';

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  return 'sha256=' + expected === signature;
}