Set Up Custom Webhook Alerts for Cron Jobs
Alert IntegrationsThe Problem
Your team uses a custom alerting tool, PagerDuty, or OpsGenie. You need cron job alerts routed there, not just Slack or Email.
The Solution
CronRabbit's webhook integration sends JSON payloads to any HTTP endpoint, signed with HMAC-SHA256 for authenticity verification.
Webhook Payload
The JSON payload includes monitor_id, monitor_name, status (up/down), workspace, and timestamp. Verify authenticity using the X-CronRabbit-Signature header.
PagerDuty Integration
Point the webhook URL at PagerDuty's Events API v2 endpoint. Use a serverless function to transform the CronRabbit payload to PagerDuty's format.
Code Examples
Verify webhook signature (Node.js)
JavaScriptconst crypto = require("crypto");
function verifySignature(payload, signature, secret) {
const expected = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}