Webhooks

Forward conversion events to your CRM, analytics platform, or any external system in real-time.

What are Webhooks?

Webhooks automatically send conversion data to your specified URL when events occur. Use them to:

  • Update your CRM when a lead converts
  • Send data to Google Analytics, Facebook CAPI, or other platforms
  • Trigger automations in Zapier, Make, or n8n
  • Sync conversions to your own database

Webhook Flow

Conversion Event
NextLinks Records Event
Webhook Triggered
Your Server

Creating a Webhook

  1. 1

    Go to Attribution → Webhooks

    Navigate to the webhooks configuration page

  2. 2

    Click "Create Webhook"

    Open the webhook creation form

  3. 3

    Configure Webhook Settings

    • Name: A descriptive name (e.g., "CRM Sync")
    • Target URL: Your endpoint that receives events
    • Method: GET or POST
    • Payload Template: Customize the data sent
  4. 4

    Test Your Webhook

    Use the simulator to verify delivery

Payload Templates

Customize the data sent to your webhook using JSON templates with macros:

POST Request Payload

{
  "event": {
    "click_id": "{click_id}",
    "timestamp": "{conversion_timestamp}",
    "value": "{value}"
  },
  "nextlink": {
    "slug": "{slug}",
    "destination": "{actual_destination}"
  },
  "client": {
    "ip": "{ip_address}",
    "user_agent": "{user_agent}"
  },
  "metadata": {metadata}
}

NextLinks sends this as a POST request with Content-Type: application/json

Available Macros

Use these macros in your payload template. They're replaced with actual values when the webhook fires:

MacroDescriptionExample Value
{click_id}Unique click identifierabc123-def456-ghi789
{slug}NextLink slugmy-campaign
{conversion_timestamp}When the event occurred (ISO 8601)2024-01-15T10:30:00Z
{actual_destination}Final destination URLhttps://example.com/offer
{value}Conversion value (if provided)49.99
{postback_key}Event postback keymy_event_key
{ip_address}User's IP address192.168.1.100
{user_agent}User's browser agentMozilla/5.0...
{metadata}Custom metadata object (JSON){ "order_id": "123" }

Common Integrations

Zapier / Make / n8n

Connect to 5,000+ apps using no-code automation platforms.

  1. Create a new Zap with "Webhooks by Zapier" trigger
  2. Select "Catch Hook"
  3. Copy the webhook URL from Zapier
  4. Paste it as your Target URL in NextLinks
  5. Test the connection using the simulator

Custom Server Endpoint

Create your own endpoint to receive webhook events:

// Express.js example
app.post('/webhook', express.json(), (req, res) => {
  const { click_id, value, slug, metadata } = req.body.event || req.body;
  
  console.log('Conversion received:', {
    click_id,
    value,
    slug,
    metadata
  });
  
  // Process the conversion...
  // e.g., update CRM, send notification, etc.
  
  res.status(200).json({ received: true });
});

Facebook Conversions API

Send conversions to Facebook for better ad optimization:

Create a server-side endpoint that receives NextLinks webhooks and forwards to Facebook's Conversions API. Include the fbclid in your URL parameters to enable proper attribution.

Monitoring & Debugging

Delivery Logs

View all webhook deliveries in Attribution → Webhooks → Logs. See:

  • • Delivery status (success/failed)
  • • Response code and body
  • • Request payload sent
  • • Delivery duration

Retry Failed Webhooks

Failed webhooks can be retried from the logs. NextLinks shows:

  • • Error message if delivery failed
  • • HTTP status code returned
  • • One-click retry button

Best Practices

Return 200 Quickly

Your endpoint should return a 200 status immediately. Process webhooks asynchronously to avoid timeouts.

Handle Duplicates

Design your endpoint to handle duplicate deliveries gracefully. Use click_id as an idempotency key.

Use HTTPS

Always use HTTPS endpoints to ensure data is encrypted in transit.

Test Before Production

Use the simulator in Attribution → Simulate to test webhook delivery before going live.

Troubleshooting

Webhook Not Firing

  • • Check that the webhook is active
  • • Verify the event config is linked to an offer
  • • Ensure conversions are being recorded first

Getting 4xx/5xx Errors

  • • Check the delivery logs for the exact error
  • • Verify your endpoint URL is correct
  • • Ensure your server accepts the Content-Type
  • • Check firewall/security rules aren't blocking

Missing Data in Payload

  • • Check macro spelling (e.g., {click_id} not {clickid})
  • • Some fields like {value} may be empty if not provided
  • {metadata} requires data to be sent in the postback