Webhooks overview
Webhooks provide real-time notifications about referral status events directly to your system, eliminating the need for polling our API.
Our webhook service enables you to receive instant notifications for critical events in your referral workflow. This integration helps ensure immediate awareness of referral creation and processing status, allowing for real-time response to referral outcomes.
Webhook Events
Referral Created Event
The REFERRAL_CREATED
webhook event is sent when a referral is created successfully. This event helps you track the status of your referrals in real-time.
Event Details
Event Name: REFERRAL_CREATED
Trigger Conditions:
- Successful referral creation from a referral
- Failed referral creation due to validation or system errors
Response Status:
CREATED
: Referral was successfully createdFAILED
: Referral creation failed (includes failure message)
Success Payload Example
Failure Payload Example
Implementation Guide
Authentication
Each webhook request includes a signature header to verify its authenticity. Here’s how to verify the signature in different languages:
Java (using Svix Java SDK)
Node.js
Python
Best Practices
Always validate webhook signatures to ensure the authenticity of incoming webhook requests.
Integration Tips
- Set up proper error handling for webhook processing
- Implement signature verification
- Store webhook events for audit purposes
- Return 2xx status codes to acknowledge receipt
Implementation Steps
-
Configure Webhook Endpoint
- Set up a publicly accessible HTTPS endpoint to receive webhook events
-
Implement Signature Verification
- Verify the signature of each incoming webhook request using your signing secret
-
Process the Webhook
- Parse and process the webhook payload based on the event type
-
Acknowledge Receipt
- Return a 2xx status code to acknowledge successful receipt of the webhook
Error Handling
Common Failure Scenarios
-
Signature Verification Failures:
- Ensure you’re using the raw request body for signature verification
- Verify that all required headers are present and correctly formatted
- Use the official Svix SDKs for reliable verification
-
Payload Processing Errors:
- Validate the webhook payload against the expected schema
- Check for required fields like
customer_type
- Implement comprehensive error handling for malformed data
-
Server Errors (5xx):
- Monitor your logs for processing errors
- Implement proper error reporting
- Set up alerts for repeated failures
-
Client Errors (4xx):
- Verify your endpoint is properly configured
- Check authentication credentials
- Validate request formatting
Retry Policy
Webhook delivery attempts follow an exponential backoff strategy:
- Maximum retries: 5 times
- Retry window: 7 days from original event
- One delivery attempt at a time
- Endpoint disabled after 5 days of continuous failures
If all attempts fail for 5 days, your endpoint will be disabled and you’ll receive an EndpointDisabledEvent notification.