Send alerts to Respond with a webhook
Post alerts from your own code or any tool that can send JSON, and resolve them when the problem is over.
Applies to: Respond
Any system that can send an HTTP request can send alerts to a Respond service. Each request carries one alert, or a
list of them, as JSON. Requests with the same dedup_key belong to the same alert, so a later request can resolve it.
Create a webhook integration
- In Respond, select Configuration > Services, and then select the service.
- Under Integrations, select New integration.
- For Source, choose Webhook. Enter a Name, such as
checkout-api production, and select Save. - In the Copy the key now dialog, copy the Key and the Address to post to (it holds the key).
Store the key in your system's secret store. The examples below read it from the RESPOND_KEY environment variable.
For more about keys, see Integration keys.
Send an alert
Post the alert to your region's webhook address, with the key in the Authorization header:
curl https://respond-api-fra.havnsight.com/api/v1/ingress/webhook \
-H "Authorization: Bearer $RESPOND_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Checkout error rate above 5% for 10 minutes",
"dedup_key": "checkout-api/error-rate",
"status": "firing",
"severity": "critical",
"description": "5xx responses are at 7.2% of requests on checkout-api in production, against a limit of 5%.",
"links": [
{ "href": "https://grafana.example.com/d/checkout", "text": "Checkout dashboard" },
{ "href": "https://wiki.example.com/runbooks/checkout-errors", "text": "Runbook" }
],
"labels": { "service": "checkout-api", "env": "production", "region": "eu-west-1" }
}'Respond answers 202 Accepted with the number of alerts it kept, and the alert appears in Alerts, with the service
and the source it came from:
{ "status": true, "message": "Alerts received", "data": { "accepted": 1 } }If your tool can't set headers
Post to the Address to post to from the dialog instead. It ends with the key, so it needs no Authorization
header:
https://respond-api-fra.havnsight.com/api/v1/ingress/webhook/<key>Important
Anyone who has this address can send alerts to the service. Treat it as a secret, like the key itself.
Send several alerts at once
Post a JSON list instead of one object. One request can carry up to 1,000 alerts.
[
{ "title": "Disk 92% full on db-1", "dedup_key": "db-1/disk", "severity": "warning" },
{ "title": "Replication lag over 30 s on db-2", "dedup_key": "db-2/replication", "severity": "error" }
]Fields
Only title is required. Fields Respond doesn't know are ignored, and text beyond a field's limit is cut off.
| Field | Type | Default | What it is |
|---|---|---|---|
title | string | Required | What's wrong, in one line. Up to 500 characters. |
dedup_key | string | Made from the title | Your identifier for the problem, up to 255 characters. Requests with the same key update the same alert. |
status | string | firing | firing or resolved. trigger and triggered also mean firing; resolve and ok also mean resolved. |
severity | string | error | critical, error, warning or info. Common words for them, such as high, p1 or sev2, work too. |
description | string | Empty | More detail. Up to 10,000 characters. |
links | list | None | Up to 20 objects, each with an href (an http or https address) and an optional text. |
labels | object | None | Up to 64 name and value pairs, such as the host or the environment. Numbers and true or false are kept as text. |
Tip
Set a dedup_key that names the problem, not the moment, such as checkout-api/error-rate. Without one, Respond uses
the title, so an alert whose title changes, for example with a new percentage, becomes a new alert each time.
Resolve an alert
When the problem is over, send the same dedup_key again with "status": "resolved". The request still needs a
title:
curl https://respond-api-fra.havnsight.com/api/v1/ingress/webhook \
-H "Authorization: Bearer $RESPOND_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Checkout error rate back under 5%",
"dedup_key": "checkout-api/error-rate",
"status": "resolved"
}'The alert shows Resolved, with the time its source resolved it.
Responses
| Status | reason | What it means | What to do |
|---|---|---|---|
202 Accepted | The alerts were kept. data.accepted says how many. | Nothing. | |
401 Unauthorized | unauthorized | The key is missing, wrong or revoked, or belongs to another kind of source. | Check the key and the address. |
413 Payload Too Large | The request is larger than 256 KB. | Send fewer alerts in each request. | |
422 Unprocessable Content | unreadable_payload | The body isn't JSON, an alert has no title, a status isn't firing or resolved, or there are more than 1,000 alerts. | Fix the request. Sending it again won't help. |
429 Too Many Requests | rate_limited | The key sent more than its Requests a minute. | Wait the seconds in the Retry-After header, then send again. |
5xx | Something went wrong on our side. | Send the request again after a short wait. |
A response with a reason in the table is a JSON problem response. Compare its reason, never its detail, which is
written for people and follows the request's language:
{
"type": "https://docs.havnsight.com/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "A valid bearer token is required.",
"request_id": "0193f6a2-5c1e-7d40-9b8e-2f4a6c8d0e1b",
"reason": "unauthorized"
}Send from a monitoring tool
Respond also reads the alerts of these tools in their own format, so you don't need to reshape them:
- Amazon CloudWatch
- Azure Monitor
- Checkly
- Cloudflare
- Datadog
- Google Cloud Monitoring
- Grafana
- New Relic
- Prometheus Alertmanager
- Sentry
- Uptime Kuma
- Zabbix
Choose the tool as the Source when you create the integration. The Copy the key now dialog shows the address to give the tool and, for tools that need them, the payload to paste and any extra setup step.
Sentry needs a Signing secret and Amazon CloudWatch an SNS topic ARN when you create the integration; without them, Save is refused.
Related content
Was this page helpful?
Send feedback
