Documentation

Webhooks

Learn how to receive real-time notifications from Insurlink Hub via webhooks.

Overview

Webhooks allow you to receive real-time updates about events in your Insurlink Hub account. Instead of polling our API, we'll send HTTP POST requests to your specified URL when events occur.

Setting Up Webhooks

1. Configure your webhook endpoint in the dashboard or via API

curl -X POST https://api.insurlink.com/v1/business/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourdomain.com/webhooks",
    "events": ["policy.purchased", "policy.renewed", "claim.submitted"],
    "secret": "your-webhook-secret"
  }'
bash

Webhook Events

policy.purchased

Triggered when a policy is purchased

policy.renewed

Triggered when a policy is renewed

claim.submitted

Triggered when a claim is submitted

payment.completed

Triggered when a payment is completed

Webhook Security

Always verify webhook signatures to ensure requests are from Insurlink Hub:

const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const hash = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(hash)
  );
}
javascript

Webhook Endpoints

POST/business/webhooks

Configure webhook endpoints

curl -X POST https://api.insurlink.com/v1/business/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourdomain.com/webhooks",
    "events": ["policy.purchased"],
    "secret": "your-secret"
  }'
bash
GET/business/webhooks/logs

Get webhook delivery logs

curl https://api.insurlink.com/v1/business/webhooks/logs \
  -H "Authorization: Bearer YOUR_API_KEY"
bash