Skip to main content
Alert webhooks send an HTTPS request when an Agnost alert fires, a daily summary is ready, or Agnost suggests a new pattern. Use them to open incidents in PagerDuty or Opsgenie, create ServiceNow events, notify an internal bot, or start an automation job.

Add a webhook

Add a webhook in Alerts → Destinations → Webhooks. Then, when you create or edit an alert, pick it under Notify via → Webhook. The alert form only picks existing webhooks; it doesn’t create them. The form asks for:
  1. Endpoint URL: a public HTTPS URL.
  2. Name: how the webhook appears in the alert form.
  3. Format: JSON for your own services, or ServiceNow Event Management. What your endpoint receives shows an example body and what each field means.
  4. Headers (optional): usually for authentication, such as Authorization or x-sn-apikey.
  5. Advanced: extra body fields (optional): fixed JSON fields added to every body.
Choose Test webhook to send an alert.test event to the URL. Agnost shows the HTTP status, the response time, and the response body from your endpoint. Add webhook turns on only after a test of the current values passes. If you change the URL, format, headers, or extra fields, test again before saving. Each webhook in Destinations → Webhooks has a Deliveries log and Settings. Settings uses the same form, so a name-only change saves without a test. The Destinations button shows a dot when any webhook is failing. Send test in the alert editor runs that alert once and sends it to its selected destinations as an alert.test event, with its real name, threshold, current value, and records.

Payload formats

Every format is signed the same way. Only the body changes.

JSON

Webhook bodies are versioned JSON and are limited to 256 KB. Agnost includes up to 20 rows returned by the alert’s context query and removes rows from the end if the payload would exceed the limit. context.rows is always an array.
Extra body fields are added under custom, so the rest of the event stays stable. alert.value and threshold.value are the value and threshold the alert’s query returned (for a % above usual alert, usual adjusted by the percentage). threshold.operator is the comparison in its condition_met. context.rows holds the records the message lists; if the query returns extra columns, they come first as one row.

ServiceNow Event Management

Agnost sends one event record per delivery: Extra body fields are merged into the record and win over the defaults, so you can set node, severity, assignment_group, or any field your event rules expect. Authenticate with a header such as Authorization: Basic … or x-sn-apikey, added under Headers.

Events

Headers and signature verification

Every request includes:
  • Agnost-Signature: t=<unix>,v1=<hex HMAC-SHA256>
  • Agnost-Delivery-Id: unique per delivery
  • Agnost-Event: the event type
  • webhook-id, webhook-timestamp, and webhook-signature, following Standard Webhooks
  • User-Agent: Agnost-Webhooks/1.0
  • Your custom headers
Verifying the signature is optional: skip it if your endpoint authenticates requests with a header instead. To verify, open the webhook’s Settings, find Verify requests, and choose Reveal to copy its secret. Secrets look like whsec_<base64>; the HMAC key is the base64-decoded part after whsec_.

Verify with a Standard Webhooks library

Standard Webhooks libraries exist for Python, JavaScript, Go, Java, Rust, Ruby, PHP, C#, and Elixir. Pass them the whsec_ secret as-is:

Verify Agnost-Signature yourself

Compute the HMAC over <unix timestamp>.<raw request body> and compare it with each v1 value. Do not parse and re-serialize the body before verification. Reject timestamps more than five minutes from your server time to prevent replay attacks.

If a secret leaks

Delete the webhook and add it again. The new webhook gets a new secret, and the old one stops working immediately. Update the alerts that used it. With a signed-in session (API keys can’t), POST /dashboard/api/connections/{id}/rotate-secret with {"previous_secret": "expire"} issues a new secret for the same webhook and stops the old one immediately, so alerts keep sending to it. With keep (the default), the old secret also signs for 24 hours while your receiver switches over.

Headers for receiver credentials

Add headers such as Authorization or x-sn-apikey under Headers. Header values are encrypted at rest and write-only: the dashboard and API show only a masked preview, and the delivery log masks them too. To change a value, type a new one; leave it as is to keep the saved value. Agnost-managed headers (Content-Type, User-Agent, Agnost-*, and webhook-*) cannot be set.

Delivery and history

Agnost sends each event once, as soon as the alert fires, and waits up to 15 seconds for a response. Any 2xx response counts as delivered. A timeout, connection error, or any other status is recorded as failed and isn’t retried; the alert sends again the next time it fires. The webhook’s Deliveries tab lists the latest 50 messages sent to it in the past 30 days: which alert sent it, when, and whether it was delivered. A failed delivery shows why, for example HTTP 503 with the start of your receiver’s reply, a timeout, or a TLS error. Filter to Failed to find what needs attention. The same results appear in each alert’s history. Test sends (Test webhook and Send test) show their result right away and aren’t kept.

Network restrictions

Production webhook URLs must use HTTPS on port 443 or 8443. Agnost refuses URL credentials, redirects, and hosts that resolve to private, loopback, link-local, carrier-grade NAT, or cloud metadata addresses. Agnost connects to the validated resolved IP so a DNS change cannot redirect the request to an internal address. These restrictions apply again on every delivery, not only when the connection is created.