Overview
Webhooks let you receive real-time HTTP notifications when events occur in Offergrid, enabling immediate response to new orders and status changes.Webhook functionality may be under development. Check with support for current availability and configuration options.
How Webhooks Work
- Configure endpoint: Tell Offergrid where to send notifications
- Event occurs: New order, status change, etc.
- Offergrid sends POST: HTTP POST to your endpoint
- You respond: Process the event and return 200 OK
- Retry on failure: Offergrid retries if your endpoint is down
Webhook Events
Provider Events
order.created
- New order received from reseller
- Includes order ID and item ID
- Action: Review and accept/reject
order.cancelled
- Reseller cancelled an order
- Includes order ID and reason
- Action: Stop fulfillment if in progress
offer.ordered (Future)
- One of your offers was ordered
- Includes offer ID and order details
Setting Up Webhooks
Configuration process may vary. Contact support for current webhook setup instructions.
Step 1: Create an Endpoint
Build an HTTPS endpoint to receive webhooks:Step 2: Configure in Dashboard
- Go to Settings → Webhooks
- Click Add Webhook Endpoint
- Enter your endpoint URL
- Select which events to receive
- Save the webhook secret for signature verification
Step 3: Test the Connection
Send a test event to verify your endpoint works:- Click Send Test Event in dashboard
- Check your endpoint received the event
- Verify signature validation works
- Confirm proper error handling
Webhook Payload Structure
Common Format
All webhooks follow this structure:order.created Payload
order.cancelled Payload
Verifying Webhook Signatures
Always verify webhooks are from Offergrid:Handling Webhooks
Respond Quickly
Return 200 OK within 5 seconds:Handle Duplicates
You might receive the same webhook multiple times:Implement Retry Logic
Handle temporary failures gracefully:Testing Webhooks Locally
Use ngrok for Local Development
Send Test Events
Monitoring Webhooks
Log All Events
Track Metrics
Monitor:- Delivery rate: % of webhooks successfully received
- Processing time: How long processing takes
- Error rate: % of webhooks that fail processing
- Retry rate: % of webhooks that need retries
Webhook Best Practices
Always verify signatures
Always verify signatures
Never process webhooks without verifying the signature. This prevents fake events.
Respond within 5 seconds
Respond within 5 seconds
Return 200 OK quickly. Process the event asynchronously in a background job.
Handle duplicates
Handle duplicates
Use idempotency keys to prevent processing the same event twice.
Implement retry logic
Implement retry logic
Handle temporary failures with exponential backoff. Alert on repeated failures.
Log everything
Log everything
Log all webhook events for debugging and auditing. Include timestamps and durations.
Monitor webhook health
Monitor webhook health
Track delivery rates, error rates, and processing times. Alert on anomalies.
Troubleshooting
Webhooks Not Arriving
- Check endpoint URL: Ensure URL is correct and publicly accessible
- Verify HTTPS: Endpoint must use HTTPS (not HTTP)
- Check firewall: Ensure your firewall allows incoming requests
- Review webhook settings: Confirm webhook is enabled for the event type
Signature Verification Fails
- Check webhook secret: Ensure using correct secret from dashboard
- Verify timestamp: Check
x-offergrid-timestampheader exists - Payload format: Ensure payload is parsed as raw JSON string
Webhooks Timing Out
- Respond faster: Return 200 OK before processing
- Use async processing: Queue events for background processing
- Optimize database: Ensure database queries are fast
- Scale horizontally: Add more webhook processing workers
Next Steps
API Integration
Learn about API integration patterns
Receiving Orders
Understanding order processing
Order Workflow
Order status lifecycle
API Reference
Complete API documentation