Prerequisites
Before setting up webhooks, ensure you have:- An active Affonso account with an affiliate program
- A publicly accessible HTTPS endpoint to receive webhooks
- The ability to verify webhook signatures (recommended)
Creating a Webhook Endpoint
1
Navigate to Webhooks
Go to your Affonso dashboard and select Settings → Webhooks from the sidebar.
2
Add New Endpoint
Click Add Endpoint and enter your webhook URL:
3
Select Events
Choose which events you want to receive. You can select:
- All events - Receive every webhook event
- Specific events - Only receive selected event types
4
Copy Signing Secret
After creating the endpoint, copy your Signing Secret. You’ll need this to verify webhook signatures.
Verifying Webhook Signatures
Always verify webhook signatures to ensure requests are from Affonso.Signature Header
Each webhook request includes a signature header:t- Unix timestamp of when the signature was generatedv1- The HMAC-SHA256 signature
Verification Process
Responding to Webhooks
Your endpoint must respond correctly for webhooks to be considered delivered.Success Response
Return a2xx status code to acknowledge receipt:
Response Time
Your endpoint should respond within 30 seconds. If processing takes longer:- Acknowledge the webhook immediately
- Process the event asynchronously
- Use a job queue for heavy processing
Testing Webhooks
Test Events
Use the Send Test Event button in your dashboard to send a test webhook to your endpoint.Local Development
For local development, use a tunneling service:Troubleshooting
Webhook not receiving events
Webhook not receiving events
- Verify your endpoint URL is correct and publicly accessible
- Check that your endpoint returns a 2xx status code
- Ensure you’ve selected the correct events to receive
Signature verification failing
Signature verification failing
- Ensure you’re using the raw request body, not parsed JSON
- Check that your signing secret is correct
- Verify the timestamp is within 5 minutes
Receiving duplicate events
Receiving duplicate events
- Implement idempotency using the event
idfield - Store processed event IDs and skip duplicates
