Overview
Webhooks allow you to receive real-time notifications when events occur in ReferralLoop. This is perfect for building custom integrations, processing events server-side, or triggering actions in your own applications.How Webhooks Work
- Subscribe to events you want to receive
- Receive HTTP POST requests when events occur
- Process the webhook payload in your application
- Respond with a 2xx status code to acknowledge receipt
Available Events
signup.created
Triggered when a new signup is added to a waitlist. Payload:signup.position_changed
Triggered when a signup’s position in the waitlist changes. Payload:signup.deleted
Triggered when a signup is removed from a waitlist. Payload:Setting Up Webhooks
Step 1: Create a Webhook Endpoint
Create an HTTP endpoint in your application that can receive POST requests:Step 2: Subscribe to Events
Use the API to subscribe to events: Request Body: Example Request:Step 3: Handle Webhook Requests
Your endpoint should:- Verify the request (optional, see Security below)
- Process the event based on
event_type - Respond quickly with a 2xx status code
- Handle errors gracefully - return 2xx even if processing fails (process asynchronously)
Unsubscribing
To stop receiving webhooks, delete the subscription: Example Request:Security
Webhook Signatures (Coming Soon)
Webhook signatures allow you to verify that requests are coming from ReferralLoop. When available, webhook payloads will include anX-Webhook-Signature header:
Best Practices
- Use HTTPS - Always use HTTPS endpoints for webhooks
- Validate payloads - Verify the structure and content of webhook payloads
- Idempotency - Make your webhook handlers idempotent to handle duplicate deliveries
- Timeout handling - Respond quickly (within 5 seconds) to avoid retries
- Error handling - Log errors but return 2xx to prevent retries for transient issues
Retry Logic
If your endpoint doesn’t respond with a 2xx status code, ReferralLoop will retry the webhook:- Initial attempt: Immediate
- Retry 1: After 1 minute
- Retry 2: After 5 minutes
- Retry 3: After 15 minutes
- Retry 4: After 1 hour
Testing Webhooks
Using ngrok
- Install ngrok
- Start your local server
- Expose it with ngrok:
ngrok http 3000 - Use the ngrok URL as your
target_url
Using RequestBin
- Go to RequestBin
- Create a new bin
- Use the bin URL as your
target_url - View incoming webhooks in the RequestBin dashboard
Troubleshooting
Webhooks Not Arriving
- Check subscription status - Verify the subscription is active
- Verify endpoint - Ensure your endpoint is publicly accessible
- Check HTTPS - Webhooks require HTTPS endpoints
- Review logs - Check your application logs for errors
- Test endpoint - Manually POST to your endpoint to verify it works
Duplicate Webhooks
If you receive duplicate webhooks:- Implement idempotency using the
timestampor event ID - Check if your endpoint is responding slowly (causing retries)
- Verify you don’t have multiple subscriptions for the same event
Webhook Delivery Failures
If webhooks are failing:- Check your endpoint is returning 2xx status codes
- Verify your endpoint is accessible from the internet
- Review error logs for details
- Test your endpoint manually
Code Examples
Node.js/Express
Python/Flask
Next Steps
API Reference
Explore the full API reference for more integration options