Webhook alerts: payload, headers and retries
Besides email and the notification bell in the app, Pingsured can send an alert as an HTTP request to a URL you choose — your incident tool, a chat integration, an automation platform or your own endpoint. Webhooks are available on every paid plan. An account owner or manager sets them up, either for one ping or as the default for every ping in the account.
The request
Every alert is a POST with a JSON body:
- the URL must use
https; Content-Type: application/json;User-Agent: Pingsured-Alarm/1;- up to 3 redirects are followed;
- your endpoint has 10 seconds to answer with a
2xxstatus.
Addresses in private, loopback or link-local networks are refused, including when a public hostname resolves to one or a redirect points to one.
The payload
| Field | Meaning |
|---|---|
event | alarm.fired, or alarm.fired.test for the test button |
version | the payload version, currently 1 |
account_id | the account the ping belongs to |
task_id | the ping's ID |
task_name | the ping's name as shown in the app |
channel | always webhook |
trigger | the rule that fired, such as first_error or first_ok |
result.status | the ping's status now: ok, warning, error or unknown |
result.prev_status | the status before this change, if there was one |
result.started_at | when the check that produced this result ran, in ISO 8601 UTC |
result.location | the location whose checks fired the alert, such as de or us-west |
result.detail | the reason in one line: the HTTP status, the error, or why a content check failed, such as JSONPath: no value at $.ok. Left out when there is none |
locations.total | how many locations the ping is checked from |
locations.failing | every location not ok when the alert was sent, each with its location and status |
A typical alert when a site stops answering:
event:alarm.firedtrigger:first_errorresult.status:error,result.prev_status:okresult.detail:JSONPath: no value at $.ok, when a content check failed
When it recovers, the alert is the same except that trigger is first_ok and the two statuses are the other way round.
Headers for routing and deduplication
X-Pingsured-Eventrepeats the event name, so you can route without parsing the body.X-Pingsured-Event-Versionrepeats the payload version.X-Pingsured-Deliveryidentifies the delivery. It stays the same when a delivery is retried, so store it and ignore a second request with an ID you have already processed.
Retries
When your endpoint does not answer in time, cannot be reached or answers 408, 425, 429 or any 5xx status, the delivery is retried — 5 attempts in all, 30 seconds, 5 minutes, 30 minutes and 2 hours apart. Any other 4xx answer is final and is not retried. Nor is a delivery that is refused outright: a plain http URL, a private address or too many redirects.
When webhooks are sent
A webhook follows the same rules as every other alert channel:
- Which changes. The recommended setup alerts on the first failure and on the recovery. You can also be alerted on every failing result.
- How many failures first. A threshold such as "3 of the last 5 checks" keeps a single slow response from paging anyone. Alarm and recovery thresholds are set separately.
- How often. Repeat alerts for the same ping and channel are held back for 15 minutes; a change of status is always sent at once.
- Where. Each location a ping is checked from is judged on its own, and the ping counts as failing when it is failing from any one of them.
Not available yet
- Requests are not signed. Until they are, use a URL with a hard-to-guess path or token, and treat
X-Pingsured-Deliveryas an identifier, not as proof of origin. - One webhook URL per ping, plus one account-wide default.
When a check fails, you see why
A page can answer 200 and still be broken. Pingsured reads the response, shows where it fails and tells you the moment it starts.
The check fails
- HTTP status
- 200
- Rule
$.status = "ok"- Reason
$.status: eq comparison failed
A rule on the response body, here a value in the JSON, catches what a status code never would.
Every location reports
- Germany85 msError
- United States (West)490 msError
- Singapore550 msError
All three locations report the same failure, so it is the service, not one network path.
Your webhook is called
{ "event": "alarm.fired", "task_name": "Orders API", "trigger": "first_error", "result": { "status": "error", "detail": "JSONPath: $.status: eq comparison failed" }, "locations": {"total": 3, "failing": 3} }The alert reaches your endpoint with the check, the trigger, the reason and how many locations are failing.