DNSRadar sends webhook events to notify your application in real-time when DNS monitoring events occur. When a monitor detects a change in DNS records, we’ll send an HTTP POST request to your configured webhook endpoint with details about the event.
Webhooks enable you to build automated workflows and integrations that respond immediately to DNS changes without polling the API.
DNSRadar implements an automatic retry mechanism to ensure reliable delivery of webhook events. If your endpoint returns a non-2xx status code, we’ll retry the request using an incremental backoff strategy.
After the 9th retry fails, we’ll stop attempting to deliver the event and notify you. All events for this webhook will be paused until a successful request is made.
If a webhook consistently fails, all events attached to that webhook will be automatically paused to prevent further failed attempts. The webhook will resume automatically once a request succeeds.
Monitor your webhook health in the DNSRadar Dashboard to identify and resolve issues before events are paused.
Your webhook endpoint should respond with a 2xx status code within 30 seconds. Process events asynchronously if needed.
app.post('/webhook', async (req, res) => { // Verify signature first verifyWebhookSignature(req.body, ...); // Respond immediately res.status(200).send('OK'); // Process asynchronously processWebhookAsync(req.body).catch(console.error);});
Handle Duplicate Events
Due to retries, you may receive the same event multiple times. Use the id field to deduplicate events.
const processedEvents = new Set();function handleWebhook(event) { if (processedEvents.has(event.id)) { console.log('Duplicate event, skipping'); return; } processedEvents.add(event.id); // Process the event}
Use HTTPS Endpoints
Always use HTTPS URLs for your webhook endpoints to ensure data is encrypted in transit.
Monitor Webhook Health
Track failed webhook attempts in the DNSRadar Dashboard and set up alerts for repeated failures.
Implement Error Handling
Handle errors gracefully and log failures for debugging.
@app.route('/webhook', methods=['POST'])def webhook(): try: # Verify and process webhook verify_webhook_signature(...) process_event(request.json) return 'OK', 200 except Exception as e: # Log error but still return 200 if event was received logger.error(f"Error processing webhook: {e}") return 'OK', 200 # Prevent retries for processing errors
Test Your Integration
Use the webhook test endpoint to verify your integration before going live.
curl -X POST https://api.dnsradar.dev/webhooks/{id}/test \ -H "X-Api-Key: your_api_key"