Webhook Integration
Send alerts to any HTTP endpoint for custom integrations.
Setup
- Go to Settings > Integrations
- Click Add Webhook
- Enter your endpoint URL
- Save to generate a signing secret
Payload Format
Webhooks send JSON payloads:
{
"event": "monitor.down",
"timestamp": "2024-01-15T12:00:00Z",
"monitor": {
"id": "mon_xxx",
"name": "Production API",
"url": "https://api.example.com/health"
},
"status": {
"current": "down",
"previous": "up",
"responseTime": null,
"errorMessage": "Connection timeout"
}
}
Signature Verification
All webhooks include an X-Statly-Signature header for security. Verify it using HMAC-SHA256:
Node.js:
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return signature === `sha256=${expected}`;
}
Python:
import hmac
import hashlib
def verify_webhook(payload, signature, secret):
expected = hmac.new(
secret.encode(),
payload,
hashlib.sha256
).hexdigest()
return signature == f"sha256={expected}"
Retry Policy
Failed webhooks are retried 3 times with exponential backoff.