Webhooks
A webhook hands events to another host as an HTTP request: a ticket host that opens a ticket for every alert, a chat bot, your own automation. Selvara sends a signed JSON body to an address you choose, and tries again when the receiver does not answer.
Webhooks are set up under Settings → Notifications → Webhooks, administrators only. The list and the delivery log update live. For messages meant to be read by people, use the chat and push channels instead.
Setting one up
| Field | Notes |
|---|---|
| Name | What the list shows. |
| URL | https:// or http:// address that accepts POST. Use TLS wherever the receiver supports it; the body can contain host names and customer codes. The dashboard sends from inside your network, so an address that is, or resolves to, a loopback, private or link-local one (including the cloud metadata address) is not sent to unless WEBHOOK_ALLOW_PRIVATE_HOSTS=true is set; see Configuration. |
| Secret | At least 16 characters. It signs every request and is stored encrypted. A new webhook starts with a generated one: copy it into the receiving host before saving, it is not shown again. When editing, leave it empty to keep the stored one. |
| Events | The events to send. None selected means every event, including the ones added in later versions. |
| Customer | All customers, or one. A webhook for one customer receives only that customer's events. A webhook for all customers also receives the events that belong to no customer. |
| Enabled | The switch to pause a webhook. Events that happen meanwhile are not queued for it. |
Send test event queues an event of the type webhook.test for that webhook,
whatever it subscribes to, so the receiver and the signature check can be tried
before anything real happens.
Events
| Event | Sent when |
|---|---|
alert.opened | An alert is raised, and again when it escalates to a stricter rule. |
alert.resolved | An alert is resolved for good: after it stayed back inside its threshold for the settle time (the moment the resolved mail goes out), at once when nothing judges it any more, or when somebody resolves it by hand. An alert that reopens within the settle time is never reported resolved. |
job.finished | A job started from the dashboard on a host has ended. |
patch.run_finished | A patch run has ended, succeeded or not (see Patching). |
system.enrolled | A host has enrolled with the instance. |
device.discovered | A network scan found a device it has not seen before (see Network discovery). |
audit.entry | An entry was written to the audit log. |
ssh_key.unknown | An SSH key nobody owns appeared on a host that had reported before; see SSH Keys. |
Every event is produced by the instance itself: an alert changing, a job ending, a host enrolling, a new device turning up on a network, an audit entry being written.
What is sent
Every request is a POST with Content-Type: application/json and these
headers:
| Header | Value |
|---|---|
X-Selvara-Event | The event, for example alert.opened. |
X-Selvara-Delivery | The id of the delivery. It is the same on every retry of one event, so a receiver can drop a repeat. |
X-Selvara-Signature | sha256= and the hex HMAC-SHA256 of the raw body, keyed with the secret. |
The body is an envelope that names the event, with the details in data:
{
"id": "tz4a98xxat96iws9zmbrgj3a",
"event": "alert.opened",
"createdAt": "2026-10-03T14:05:12.000Z",
"customerId": "ck9x2l0p00001qzrmn831i7rn",
"data": {
"escalated": false,
"alert": {
"id": "cm8r0e5ob0002qzrm1c5w9k3d",
"systemId": "cm8q7f2ya0000qzrm7d1h4s6t",
"systemName": "db1",
"customerId": "ck9x2l0p00001qzrmn831i7rn",
"customerCode": "acme",
"metricType": "disk",
"condition": "ABOVE",
"threshold": 90,
"currentValue": 93.4,
"message": "Disk above 90%: disk:/",
"triggeredAt": "2026-10-03T14:05:00.000Z"
}
}
}
When a self-healing rule ran for the alert and the alert stayed, the
alert.opened data carries a remediation object beside escalated, the same
note the mail and the channel messages carry:
"remediation": { "ruleName": "Restart nginx", "attempts": 2 }. It is absent
when no rule tried.
alert.resolved has the same alert object with a resolvedAt added, and a
reason beside it: recovered (the value came back and stayed back),
unwatched (its rule or series went away) or manual. customerId is null
for an event of the instance itself.
ssh_key.unknown carries the host and the key:
{
"system": { "id": "cm8q7f2ya0000qzrm7d1h4s6t", "name": "db1", "customerId": "ck9x2l0p00001qzrmn831i7rn" },
"key": {
"user": "deploy",
"fingerprint": "SHA256:OakoKLKZhDmic5F7CgnLvcxnLKQjxpBhm0HDOt+JDSw",
"type": "ed25519",
"bits": 256,
"comment": "ci@build",
"file": "/home/deploy/.ssh/authorized_keys",
"options": []
}
}
device.discovered carries deviceId, ip, mac, vendor, hostname, type
(the guessed kind of device), the open ports and viaSystemId, the host whose
scan found it. The first scan of a customer is a baseline and sends nothing.
Verifying the signature
Compute the HMAC over the bytes you received, not over JSON you parsed and wrote out again — the two need not be identical — and compare in constant time. In Node.js:
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(secret, rawBody, header) {
const expected = Buffer.from(
"sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex")
);
const given = Buffer.from(header ?? "");
return expected.length === given.length && timingSafeEqual(expected, given);
}
In Python:
import hashlib, hmac
def verify(secret: bytes, raw_body: bytes, header: str) -> bool:
expected = "sha256=" + hmac.new(secret, raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header or "")
Reject a request whose signature does not match with a 401. Answer with any
2xx status as soon as the event is stored; do the work afterwards.
Delivery and retries
A delivery counts as made when the receiver answers with a 2xx status within
10 seconds. A redirect is not followed — the signature was made for the
address configured — and counts as a failure, like any other status, a refused
connection or a timeout.
A failed delivery is tried again after 30 seconds, then after 2, 8 and 32 minutes: five attempts in all, the last about three quarters of an hour after the first. Retries are scheduled, not polled, and survive a restart of the dashboard. After the fifth failure the delivery is marked Failed and nothing more is sent for it. A webhook that is disabled or deleted while a delivery is waiting ends that delivery.
The receiver must therefore expect an event more than once and, after an
outage, late and out of order; X-Selvara-Delivery and the createdAt of the
envelope are there for that.
The delivery log
The history button in a webhook's row opens its log: one line per event with the status (Pending, Sending, Delivered, Failed), the number of attempts, the HTTP status of the last answer, the error of the last failed attempt (the status only, never what the receiver answered) and when the next attempt is due. Opening an event shows the exact body that was sent. The row of the list also shows the state of the latest delivery, so a receiver that stopped answering is visible without opening anything.
Deliveries that ended — delivered or failed — are deleted after 30 days; those still waiting are kept.
Secrets and rotation
To rotate a secret, edit the webhook and enter the new one, then put the same value into the receiver. Between the two steps deliveries fail the signature check and are retried, so do it in this order only if the receiver can accept a short gap; otherwise change the receiver to accept both for a while.
The secret is encrypted with SETTINGS_ENCRYPTION_KEY (see
Configuration). If that key changed and the secret can no
longer be read, deliveries fail with a message saying so until a new secret is
entered.