Skip to content

Alert webhooks

Send CertMarshal alerts to your PSA, RMM or any automation as signed JSON.

Set up

In the console, go to Settings, then Alerts, and add a channel of type "Webhook" with an HTTPS URL. We show a signing secret once, right after you save. Use Send test to check your endpoint.

  • HTTPS only. The URL must resolve to a public internet address.
  • We don't follow redirects. We wait up to 10 seconds for a response.
  • Any 2xx response counts as delivered. On other responses we keep the alert and try again at the next check (every 10 minutes), unless another channel for your organization accepted it.
  • Microsoft Teams and Slack channels use their own message formats, not this one.

Request

POST with Content-Type: application/json and these headers:

  • X-CertMarshal-Event: certificate.expiring, or test for the Send test button.
  • X-CertMarshal-Delivery: a unique id, the same as id in the body. Use it to ignore duplicates.
  • X-CertMarshal-Signature: t=<unix seconds>,v1=<hex>, where hex is HMAC-SHA256 of <t>.<raw body> with your signing secret as the key.

Body

Certificates are sorted by days left. days_left is negative once a certificate has expired.

{
  "id": "6f1c2b0e-4d1a-4c55-9a0e-2f7c1d2b9e10",
  "type": "certificate.expiring",
  "created_at": "2026-11-26T09:30:00.000Z",
  "organization": {
    "id": "org_9xQ2",
    "name": "Example MSP"
  },
  "data": {
    "title": "2 certificates expiring soon (Example MSP)",
    "summary": "These certificates need attention.",
    "dashboard_url": "https://certmarshal.com/app",
    "certificates": [
      {
        "host": "vpn.dental-client.com",
        "port": 10443,
        "client": "Dental Client",
        "not_after": "2026-12-02T08:00:00.000Z",
        "days_left": 6
      },
      {
        "host": "mail.law-firm.com",
        "port": 443,
        "client": "Law Firm",
        "not_after": "2026-12-20T23:59:59.000Z",
        "days_left": 24
      }
    ]
  }
}

We alert once per certificate at 30, 14, 7 and 3 days before it expires, and once when it expires. A renewed certificate starts a new series.

Verify the signature

Compute the HMAC over the raw body, before parsing it, and reject requests whose t is more than 5 minutes old.

Node.js:

import { createHmac, timingSafeEqual } from 'node:crypto';

// rawBody: the exact request body bytes, before any JSON parsing.
export function verify(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
  const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
  const given = Buffer.from(parts.v1 ?? '', 'hex');
  return given.length === 32 && timingSafeEqual(given, Buffer.from(expected, 'hex'));
}

PowerShell:

$secret = 'whsec_...'
$parts = @{}; $Header -split ',' | ForEach-Object { $k, $v = $_ -split '=', 2; $parts[$k] = $v }
$hmac = [System.Security.Cryptography.HMACSHA256]::new([Text.Encoding]::UTF8.GetBytes($secret))
$mac = $hmac.ComputeHash([Text.Encoding]::UTF8.GetBytes("$($parts.t).$RawBody"))
$expected = -join ($mac | ForEach-Object { $_.ToString('x2') })
$valid = $expected -eq $parts.v1