Receive Script Monitoring alerts on your own URL. Verify the x-scriptmonitoring-signature HMAC-SHA256 header and read the alert.created JSON payload.
A webhook destination posts each Script Monitoring alert to a URL you own, as JSON. You add it to an alert rule under Settings > Destinations, and every request is signed so you can check it really came from Script Monitoring. Webhook destinations are on Pro and Enterprise.
How do I add a webhook?#
In Settings > Destinations, open a rule (or New rule), click Webhook under Where to, and fill in URL and Signing secret. See Destinations for the rest of the rule.
How do I verify the signature?#
Script Monitoring sends a POST with a JSON body to your URL, and retries a failed request. Every request has an x-scriptmonitoring-signature header: the HMAC-SHA256 of the raw body, keyed with your Signing secret, as uppercase hex. Verify it before trusting the payload. In Node.js:
import { createHmac, timingSafeEqual } from "node:crypto";
function isFromScriptMonitoring(rawBody, signature, secret) {
const expected = createHmac("sha256", secret).update(rawBody).digest("hex").toUpperCase();
return signature?.length === expected.length && timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}
What does an alert look like?#
An alert (alert.created) looks like this:
{
"event": "alert.created",
"timestamp": "...",
"domain_id": "...",
"domain_name": "shop.example.com",
"trigger_type": "...",
"data": {
"target_type": "...",
"target": "...",
"action": "...",
"ruleset_id": "...",
"ruleset_name": "...",
"ruleset_description": "...",
"script_urls": ["..."]
},
"endpoint_id": "..."
}
Vulnerability alerts add vuln_cve_id, vuln_package, vuln_severity and vuln_reference_url to data.
What does a security header change look like?#
The Security headers changed rule sends security_headers.changed when a security header changes on a payment page:
{
"event": "security_headers.changed",
"sent_at": "...",
"team_id": "...",
"data": {
"domain_id": "...",
"domain_name": "shop.example.com",
"checkout_paths": ["..."],
"changes": [
{ "header_name": "content-security-policy", "from_value": "...", "to_value": "...", "from_date": "...", "to_date": "..." }
]
}
}
Frequently asked questions#
Can I send alerts to Slack or Discord?
Not directly. Webhooks always send signed JSON, so they don't post straight into a Slack or Discord channel. Point the webhook at your own endpoint, or at an automation tool that forwards the alert to the channel.
What if my endpoint is down?
Script Monitoring retries a failed request. A rule's Last delivery column shows when it last delivered, by any channel.
How do I tell a test from a real alert?
In a script alert (alert.created), data.ruleset_id is TEST_FAKE_ALERT. A security header test (security_headers.changed) has no test flag: it sends sample values for one of your domains, such as a Content Security Policy whose to_value adds https://newly-added.com.

