Webhook & Postback Manager

Manage real-time status updates, postbacks, and webhook integrations. Track conversions, monitor performance, and automate your workflow.

📡 Webhook Overview

Real-time Updates

Instant notifications when application status changes

Performance Tracking

Monitor conversion rates and payout performance

Automation

Automate your workflow with custom integrations

⚙️ Webhook Configuration

Setup Process

1

Create Webhook Endpoint

Set up a secure endpoint to receive webhook notifications

POST https://your-site.com/webhooks/zynx
2

Configure in Portal

Add your webhook URL in the Zynx partner portal

Webhook URL: https://your-site.com/webhooks/zynx
3

Test Integration

Send test webhooks to verify your endpoint works correctly

Webhook Events

application.accepted

Application approved by lender

application.rejected

Application declined by lender

application.processing

Application processing

application.completed

Application process completed

📦 Webhook Payload

Example Webhook Payload

{
  "event": "application.accepted",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "leadId": "L-UK-123456",
    "affiliateId": "aff_123456",
    "campaign": "summer_2024",
    "clickId": "click_789",
    "status": "ACCEPTED",
    "payout": 34.99,
    "currency": "GBP",
    "lenderId": "LENDER_001",
    "lenderName": "Quick Loans Ltd",
    "redirectUrl": "https://lender.co.uk/apply/xyz789",
    "applicationData": {
      "firstName": "John",
      "lastName": "Smith",
      "email": "john.smith@example.com",
      "loanAmount": 5000,
      "loanTerm": 3
    },
    "metadata": {
      "score": 742,
      "reputation": "Good",
      "processingTime": "2.3s"
    }
  },
  "signature": "sha256=abc123def456..."
}

Payload Fields

Field Type Description
event string Event type (application.accepted, etc.)
timestamp ISO 8601 When the event occurred
data.leadId string Unique lead identifier
data.payout number Commission amount
data.redirectUrl string URL to redirect user to
signature string HMAC signature for verification

💻 Implementation Examples

PHP Implementation

<?php
// webhook.php
header('Content-Type: application/json');

// Get the raw POST data
$payload = file_get_contents('php://input');
$headers = getallheaders();

// Verify webhook signature
$signature = $headers['X-Zynx-Signature'] ?? '';
$expectedSignature = 'sha256=' . hash_hmac('sha256', $payload, 'your_webhook_secret');

if (!hash_equals($expectedSignature, $signature)) {
    http_response_code(401);
    echo json_encode(['error' => 'Invalid signature']);
    exit;
}

// Parse the payload
$data = json_decode($payload, true);

// Process the webhook
switch ($data['event']) {
    case 'application.accepted':
        handleApplicationAccepted($data['data']);
        break;
    case 'application.rejected':
        handleApplicationRejected($data['data']);
        break;
    case 'application.processing':
      handleApplicationProcessing($data['data']);
      break;
    default:
        error_log('Unknown webhook event: ' . $data['event']);
}

function handleApplicationAccepted($data) {
    // Update your database
    $leadId = $data['leadId'];
    $payout = $data['payout'];
    $redirectUrl = $data['redirectUrl'];
    
    // Log the conversion
    error_log("Lead {$leadId} accepted with payout {$payout}");
    
    // Send notification to user
    // sendEmailNotification($data['applicationData']['email'], $redirectUrl);
    
    // Update conversion tracking
    // updateConversionTracking($data['affiliateId'], $payout);
}

function handleApplicationRejected($data) {
    // Log rejection
    error_log("Lead {$data['leadId']} rejected");
    
    // Update analytics
    // updateRejectionStats($data['affiliateId']);
}

function handleApplicationProcessing($data) {
    // Log processing status
    error_log("Lead {$data['leadId']} is processing");
}

// Respond with success
http_response_code(200);
echo json_encode(['status' => 'success']);
?>

Node.js Implementation

const express = require('express');
const crypto = require('crypto');
const app = express();

app.use(express.json());

// Webhook endpoint
app.post('/webhooks/zynx', (req, res) => {
  const payload = JSON.stringify(req.body);
  const signature = req.headers['x-zynx-signature'];
  
  // Verify signature
  const expectedSignature = 'sha256=' + 
    crypto.createHmac('sha256', process.env.WEBHOOK_SECRET)
          .update(payload)
          .digest('hex');
  
  if (signature !== expectedSignature) {
    return res.status(401).json({ error: 'Invalid signature' });
  }
  
  const { event, data } = req.body;
  
  // Process webhook based on event type
  switch (event) {
    case 'application.accepted':
      handleApplicationAccepted(data);
      break;
    case 'application.rejected':
      handleApplicationRejected(data);
      break;
    case 'application.processing':
      handleApplicationProcessing(data);
      break;
    default:
      console.log('Unknown event:', event);
  }
  
  res.status(200).json({ status: 'success' });
});

function handleApplicationAccepted(data) {
  console.log(`Lead ${data.leadId} accepted with payout ${data.payout}`);
  
  // Update database
  // await updateLeadStatus(data.leadId, 'accepted');
  
  // Send notification
  // await sendNotification(data.applicationData.email, data.redirectUrl);
  
  // Track conversion
  // await trackConversion(data.affiliateId, data.payout);
}

function handleApplicationRejected(data) {
  console.log(`Lead ${data.leadId} rejected`);
  // Handle rejection logic
}

function handleApplicationProcessing(data) {
  console.log(`Lead ${data.leadId} is processing`);
  // Handle processing logic
}

app.listen(3000, () => {
  console.log('Webhook server running on port 3000');
});

Python Implementation

from flask import Flask, request, jsonify
import hmac
import hashlib
import json
import os

app = Flask(__name__)

@app.route('/webhooks/zynx', methods=['POST'])
def webhook():
    # Get the raw payload
    payload = request.get_data()
    signature = request.headers.get('X-Zynx-Signature')
    
    # Verify signature
    expected_signature = 'sha256=' + hmac.new(
        os.environ['WEBHOOK_SECRET'].encode(),
        payload,
        hashlib.sha256
    ).hexdigest()
    
    if not hmac.compare_digest(signature, expected_signature):
        return jsonify({'error': 'Invalid signature'}), 401
    
    # Parse payload
    data = request.get_json()
    event = data.get('event')
    event_data = data.get('data')
    
    # Process webhook
    if event == 'application.accepted':
        handle_application_accepted(event_data)
    elif event == 'application.rejected':
        handle_application_rejected(event_data)
    elif event == 'application.processing':
        handle_application_processing(event_data)
    else:
        print(f'Unknown event: {event}')
    
    return jsonify({'status': 'success'})

def handle_application_accepted(data):
    lead_id = data['leadId']
    payout = data['payout']
    redirect_url = data['redirectUrl']
    
    print(f'Lead {lead_id} accepted with payout {payout}')
    
    # Update database
    # update_lead_status(lead_id, 'accepted')
    
    # Send notification
    # send_notification(data['applicationData']['email'], redirect_url)
    
    # Track conversion
    # track_conversion(data['affiliateId'], payout)

def handle_application_rejected(data):
    print(f'Lead {data["leadId"]} rejected')
    # Handle rejection

def handle_application_processing(data):
    print(f'Lead {data["leadId"]} is processing')
    # Handle processing

if __name__ == '__main__':
    app.run(debug=True)

🔒 Security Best Practices

Signature Verification

  • • Always verify webhook signatures
  • • Use HMAC-SHA256 for verification
  • • Store webhook secret securely
  • • Use constant-time comparison
  • • Reject unsigned webhooks

Additional Security

  • • Use HTTPS for webhook endpoints
  • • Implement rate limiting
  • • Validate payload structure
  • • Log all webhook events
  • • Monitor for suspicious activity

🧪 Testing Webhooks

Test Webhook Payload

curl -X POST https://your-site.com/webhooks/zynx \
  -H "Content-Type: application/json" \
  -H "X-Zynx-Signature: sha256=test_signature" \
  -d '{
    "event": "application.accepted",
    "timestamp": "2024-01-15T10:30:00Z",
    "data": {
      "leadId": "L-TEST-123456",
      "affiliateId": "test_affiliate",
      "status": "ACCEPTED",
      "payout": 25.00,
      "redirectUrl": "https://test-lender.com/apply"
    }
  }'

Need Help?

Our integration team is here to help you set up webhooks