Webhooks
Configure webhook endpoints to receive real-time event notifications.
Webhooks
Webhooks send HTTP notifications to your application when events occur in Claro. Instead of polling the API for changes, your application receives a POST request whenever a subscribed event happens. Common use cases include SIEM platforms, ticketing systems, dashboards, and automated workflows.
Setting Up Webhooks
Navigate to Webhook Settings
Go to Settings > Webhooks in the Claro admin panel.
Add an Endpoint
Click Add Endpoint and configure:
| Field | Description |
|---|---|
| URL | The HTTPS endpoint that will receive webhook payloads |
| Description | A label for this endpoint (for example, "SIEM Integration") |
| Secret | Auto-generated signing secret for payload verification |
| Events | Select which event types to subscribe to |
Webhook endpoints must use HTTPS with a valid TLS certificate. Claro will not send payloads to HTTP (non-TLS) endpoints.
Select Events
Subscribe to one or more event types:
| Event | Description |
|---|---|
campaign.started | A campaign has started sending emails |
campaign.completed | A campaign has finished (all emails sent, tracking window closed) |
tracking.click | A campaign recipient clicked the tracked link |
tracking.submit | A recipient submitted data on the landing page |
tracking.report | A recipient reported the email as phishing |
user.created | A new user was created in the tenant |
user.imported | A batch of users was imported via CSV |
assignment.completed | A user completed a training assignment |
assignment.overdue | A training assignment passed its due date without completion |
Save and Test
Click Save to activate the endpoint. Use the Send Test button to send a test payload to your endpoint and verify it is receiving data correctly.
Payload Format
All webhook payloads use the same JSON envelope:
{
"id": "evt_a1b2c3d4e5f6",
"type": "tracking.click",
"timestamp": "2026-03-15T10:30:00.000Z",
"tenant_id": "tnt_xyz789",
"data": {
// Event-specific data
}
}| Field | Type | Description |
|---|---|---|
id | string | Unique event identifier |
type | string | The event type (matches your subscription) |
timestamp | string | ISO 8601 timestamp of when the event occurred |
tenant_id | string | Your tenant identifier |
data | object | Event-specific payload (varies by event type) |
Example Payloads
tracking.click
{
"id": "evt_click_001",
"type": "tracking.click",
"timestamp": "2026-03-15T10:30:00.000Z",
"tenant_id": "tnt_xyz789",
"data": {
"campaign_id": "cmp_abc123",
"campaign_name": "Q1 IT Helpdesk Simulation",
"user_id": "usr_def456",
"user_email": "john.doe@company.com",
"link_index": 0,
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
"ip_address": "192.168.1.100"
}
}campaign.completed
{
"id": "evt_cmp_001",
"type": "campaign.completed",
"timestamp": "2026-03-15T18:00:00.000Z",
"tenant_id": "tnt_xyz789",
"data": {
"campaign_id": "cmp_abc123",
"campaign_name": "Q1 IT Helpdesk Simulation",
"stats": {
"total_recipients": 500,
"sent": 498,
"opened": 312,
"clicked": 87,
"submitted": 23,
"reported": 145,
"failed": 2
}
}
}assignment.completed
{
"id": "evt_assign_001",
"type": "assignment.completed",
"timestamp": "2026-03-15T14:22:00.000Z",
"tenant_id": "tnt_xyz789",
"data": {
"assignment_id": "asgn_ghi789",
"user_id": "usr_def456",
"user_email": "john.doe@company.com",
"module_id": "mod_jkl012",
"module_name": "Recognizing Phishing Emails",
"score": 90,
"completed_at": "2026-03-15T14:22:00.000Z"
}
}Signature Verification
Every webhook payload is signed using HMAC-SHA256. Verify the signature to ensure payloads are genuinely from Claro and have not been tampered with.
The signature is included in the X-Claro-Signature request header.
Verification Process
- Extract the raw request body (before any JSON parsing)
- Compute the HMAC-SHA256 of the body using your webhook secret
- Compare the computed signature with the value in the
X-Claro-Signatureheader - If they match, the payload is authentic
Example Verification (Node.js)
const crypto = require('crypto');
function verifyWebhookSignature(body, signature, secret) {
const computed = crypto
.createHmac('sha256', secret)
.update(body, 'utf8')
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(computed, 'hex'),
Buffer.from(signature, 'hex')
);
}
// In your webhook handler:
app.post('/webhooks/claro', (req, res) => {
const signature = req.headers['x-claro-signature'];
const isValid = verifyWebhookSignature(
req.rawBody,
signature,
process.env.CLARO_WEBHOOK_SECRET
);
if (!isValid) {
return res.status(401).send('Invalid signature');
}
// Process the event
const event = JSON.parse(req.rawBody);
console.log('Received event:', event.type);
res.status(200).send('OK');
});Always verify the webhook signature before processing the payload. Without verification, an attacker could send fake events to your endpoint.
Retry Policy
If your endpoint does not respond with a 2xx status code within 10 seconds, Claro retries the delivery:
| Attempt | Delay After Previous Attempt |
|---|---|
| 1st retry | 1 minute |
| 2nd retry | 5 minutes |
| 3rd retry | 30 minutes |
After 3 failed retries, the delivery is marked as failed. Failed deliveries are logged in the webhook endpoint's delivery history (accessible from Settings > Webhooks).
Handling Requirements
Your endpoint must:
- Return a 2xx status code (200, 201, 202, or 204) to acknowledge receipt
- Respond within 10 seconds
- Accept POST requests with
Content-Type: application/json
If your processing takes longer than 10 seconds, return a 200 immediately and process the payload asynchronously.
Delivery History
Each webhook endpoint has a delivery history showing:
- Timestamp of each delivery attempt
- HTTP status code returned by your endpoint
- Response time
- Retry count
- Payload preview
Use the delivery history to debug integration issues and monitor endpoint health.
Managing Endpoints
Disable an Endpoint
To temporarily stop receiving webhooks without deleting the configuration, toggle the endpoint to Disabled. Re-enable it at any time to resume deliveries.
Rotate the Secret
If a webhook secret is compromised:
- Navigate to the endpoint settings
- Click Rotate Secret
- Update the secret in your application
- The old secret is immediately invalidated
Delete an Endpoint
Removing an endpoint permanently stops all deliveries and deletes the delivery history. This action cannot be undone.
Best Practices
- Respond quickly. Return a 200 response immediately and process the payload asynchronously to avoid timeouts.
- Verify signatures. Always validate the
X-Claro-Signatureheader to confirm authenticity. - Handle duplicates. In rare cases, the same event may be delivered more than once. Use the
idfield to deduplicate. - Monitor delivery health. Check the delivery history periodically for failed deliveries that might indicate endpoint issues.
- Use a queuing system. For high-volume tenants, receive webhooks into a message queue (Redis, RabbitMQ, SQS) and process them from there.
- Keep secrets secure. Store webhook secrets in environment variables or a secrets manager. Never commit them to source control.