Webhooks & Integrations
Receive real-time notifications when events occur in CloakRadar. Integrate with Slack, Telegram, Discord, or any custom endpoint.
Overview
Webhooks allow CloakRadar to push real-time data to your systems when specific events occur. Instead of polling our API, you receive instant notifications.
Use Cases
- Get notified when conversions happen
- Alert your team when fraud is detected
- Sync data with your CRM or tracking system
- Trigger automated workflows
Setting Up Webhooks
Create a Webhook
Navigate to Webhooks
Go to Settings > Webhooks > + New Webhook
Configure the Webhook
- Name: Descriptive name (e.g., "Slack Notifications")
- URL: Your endpoint URL
- Type: Standard, Slack, Telegram, or Discord
- Events: Select which events trigger this webhook
Test the Webhook
Click Send Test to verify your endpoint receives data correctly.
Enable the Webhook
Toggle the webhook to Active and save.
Webhook Events
Subscribe to the events you want to receive:
| Event | Description | Data Included |
|---|---|---|
click.new |
New click received | Click details, visitor info |
conversion.new |
Conversion recorded | Conversion details, payout |
bot.detected |
Bot traffic detected | Detection details, evidence |
fraud.detected |
Fraudulent click detected | Fraud type, score, evidence |
vpn.detected |
VPN/proxy user detected | VPN provider, IP info |
cloaker.detected |
Competing cloaker detected | Cloaker name, indicators |
threat.high_risk |
High-risk visitor | Risk score, factors |
campaign.paused |
Campaign auto-paused | Reason (cap reached, etc.) |
alert.threshold |
Threshold alert triggered | Metric, threshold, value |
alert.budget |
Budget threshold reached | Spend amount, limit |
Payload Format
Standard Webhook Payload
All webhooks send a JSON POST request:
{
"event": "conversion.new",
"timestamp": "2024-01-15T14:30:00Z",
"webhook_id": "wh_abc123",
"data": {
"click_id": "clk_xyz789",
"campaign": {
"id": 1,
"name": "Facebook - Weight Loss"
},
"conversion": {
"id": "conv_def456",
"payout": 45.00,
"currency": "USD",
"transaction_id": "txn_12345"
},
"visitor": {
"country": "US",
"device": "mobile",
"os": "iOS"
}
}
}
Event-Specific Payloads
conversion.new
{
"event": "conversion.new",
"data": {
"click_id": "clk_xyz789",
"campaign_name": "Facebook - Weight Loss",
"offer_name": "Keto Diet",
"payout": 45.00,
"country": "US",
"device": "mobile"
}
}
fraud.detected
{
"event": "fraud.detected",
"data": {
"click_id": "clk_abc123",
"campaign_name": "Google - Finance",
"fraud_type": "click_farm",
"fraud_score": 85,
"indicators": ["consistent_timing", "same_ip_pattern"],
"ip": "192.168.x.x",
"estimated_loss": 0.75
}
}
bot.detected
{
"event": "bot.detected",
"data": {
"click_id": "clk_def456",
"campaign_name": "TikTok - Ecom",
"bot_type": "selenium",
"confidence": 98,
"user_agent": "Mozilla/5.0...",
"indicators": ["webdriver_present", "missing_plugins"]
}
}
Slack Integration
Setup
- Create a Slack Incoming Webhook
- Copy the webhook URL
- In CloakRadar, create a new webhook with type Slack
- Paste the Slack webhook URL
- Select your events and save
Message Format
Slack messages are formatted with rich attachments:
Example: Conversion Notification
🎉 New Conversion!
Campaign: Facebook - Weight Loss
Offer: Keto Diet
Payout: $45.00
Country: United States
Device: Mobile (iOS)
Telegram Integration
Setup
- Create a bot using @BotFather
- Get your bot token
- Get your chat ID (message @userinfobot)
- In CloakRadar, create a webhook with type Telegram
- Enter:
https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={CHAT_ID}
Message Format
Messages are sent with HTML formatting:
🎉 New Conversion!
📊 Campaign: Facebook - Weight Loss
💰 Payout: $45.00
🌍 Country: United States
📱 Device: Mobile
Discord Integration
Setup
- In your Discord server, go to Server Settings > Integrations
- Click Webhooks > New Webhook
- Copy the webhook URL
- In CloakRadar, create a webhook with type Discord
- Paste the Discord webhook URL
Message Format
Discord webhooks use rich embeds with colors:
- Green - Conversions
- Red - Fraud alerts
- Orange - Warnings
- Blue - Info
Security & Verification
Signature Verification
All webhooks include a signature header for verification:
X-CloakRadar-Signature: sha256=abc123...
Verifying the Signature (PHP)
<?php
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_CLOAKRADAR_SIGNATURE'];
$secret = 'your_webhook_secret';
$expected = 'sha256=' . hash_hmac('sha256', $payload, $secret);
if (hash_equals($expected, $signature)) {
// Valid webhook
$data = json_decode($payload, true);
// Process the event...
} else {
// Invalid signature
http_response_code(401);
exit('Invalid signature');
}
Verifying the Signature (Node.js)
const crypto = require('crypto');
function verifySignature(payload, signature, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(expected),
Buffer.from(signature)
);
}
Best Practices
- Always verify the signature before processing
- Use HTTPS endpoints only
- Respond with 200 OK quickly (process async if needed)
- Handle duplicate events (use event IDs for deduplication)
Troubleshooting
Webhook Not Receiving Events
- Check that the webhook is Active
- Verify the URL is correct and accessible
- Check that you've subscribed to the right events
- View Webhook Logs for errors
Webhook Returning Errors
Common HTTP errors and solutions:
| Error | Cause | Solution |
|---|---|---|
404 |
URL not found | Check your endpoint URL |
401/403 |
Authentication failed | Check credentials/tokens |
500 |
Server error | Check your endpoint logs |
Timeout |
Endpoint too slow | Respond within 10 seconds |
Retry Policy
Failed webhooks are retried up to 3 times:
- 1st retry: After 1 minute
- 2nd retry: After 5 minutes
- 3rd retry: After 30 minutes
After 3 failures, the webhook is marked as failed and disabled. You'll receive an email notification.
Viewing Webhook Logs
- Go to Settings > Webhooks
- Click on a webhook
- Click View Logs
Logs show:
- Event type and timestamp
- Request payload sent
- Response status code
- Response body (if error)
- Retry attempts
Need more help? Check the FAQ & Troubleshooting section.