# Prometheus alertmanager alert notifications on your phone > Get a push notification when Prometheus Alertmanager fires or resolves an alert, with its summary and the affected instance. - Company: Prometheus (https://www.justpush.io/recipes/prometheus) - Event: `alert` (Alert) - Tags: Developer tools, Monitoring - Install: https://studio.justpush.io/recipes/prometheus/alertmanager-alert - Web page: https://www.justpush.io/recipes/prometheus/alertmanager-alert ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. Add a webhook receiver to your Alertmanager configuration with your webhook URL (shown in Studio after install) as its url (see the setup notes below). 3. Route the alerts you want to that receiver and reload Alertmanager. 4. Add a webhook receiver to `alertmanager.yml` and route alerts to it: 5. ```yaml 6. receivers: 7. name: justpush 8. webhook_configs: 9. url: "your webhook URL (shown in Studio after install)" 10. send_resolved: true 11. route: 12. receiver: justpush # or add it as a child route next to your existing receivers 13. ``` 14. Reload Alertmanager (`curl -X POST http://localhost:9093/-/reload`, or restart it). 15. Give your alerting rules a **`summary`** annotation (the message) and a **`severity`** label (`critical`/`page`, `warning`, …) to set the priority. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // Prometheus Alertmanager → alert notification // Fires when Alertmanager sends a notification to a webhook receiver (firing or resolved). // Docs: https://prometheus.io/docs/alerting/latest/configuration/#webhook_config // The "severity" label, if your rules set one → push priority while firing. const SEVERITIES = { critical: 2, page: 2, high: 1, error: 1, warning: 0, warn: 0, info: -1 } // Look a key up in one of the tables above, ignoring inherited names like "toString". function pick(table, key, fallback) { return Object.prototype.hasOwnProperty.call(table, key) ? table[key] : fallback } // Only link to real http(s) URLs. function link(url, cta) { return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : [] } function handleRequest(request) { const body = request.body || {} const alerts = Array.isArray(body.alerts) ? body.alerts : [] // Guard: only alert notifications, so anything else on this integration stays quiet. if (!alerts.length || !["firing", "resolved"].includes(body.status)) { console.log("Not an alert notification — skipping") return null } // One notification can group several alerts; describe the group by its first one. const firing = alerts.filter((alert) => alert.status === "firing") const shown = firing[0] ?? alerts[0] const labels = { ...(body.commonLabels ?? {}), ...(shown.labels ?? {}) } const annotations = { ...(body.commonAnnotations ?? {}), ...(shown.annotations ?? {}) } const name = labels.alertname ?? "Alert" const resolved = body.status === "resolved" const title = resolved ? `✅ Resolved: ${name}` : firing.length > 1 ? `🔥 ${firing.length} alerts firing: ${name}` : `🔥 ${name}` // Prefer the human-written summary, then the description, then the triggering value. const detail = annotations.summary ?? annotations.description ?? shown.valueString ?? "" const where = labels.instance ?? labels.host ?? labels.job const message = [detail, where && !String(detail).includes(where) ? where : null].filter(Boolean).join(" — ") const severity = String(labels.severity ?? "").toLowerCase() return { title, message: message || (resolved ? "Back to normal" : "Alert is firing"), topic: "Prometheus", priority: resolved ? -1 : pick(SEVERITIES, severity, 1), buttons: [ ...link(shown.panelURL ?? shown.dashboardURL ?? shown.generatorURL, "View in Prometheus"), ...(resolved ? [] : link(shown.silenceURL, "Silence")), ], } } ``` ## Prometheus alert webhook payload (sample) ```json { "alerts": [ { "endsAt": "0001-01-01T00:00:00Z", "labels": { "job": "node", "instance": "db-1:9100", "severity": "page", "alertname": "InstanceDown" }, "status": "firing", "startsAt": "2026-09-29T08:01:00Z", "annotations": { "summary": "db-1:9100 has been down for more than 5 minutes" }, "fingerprint": "a3f1c2b4d5e6f708", "generatorURL": "http://prometheus.example.com:9090/graph?g0.expr=up+%3D%3D+0&g0.tab=1" } ], "status": "firing", "version": "4", "groupKey": "{}:{alertname=\"InstanceDown\"}", "receiver": "justpush", "externalURL": "http://alertmanager.example.com:9093", "groupLabels": { "alertname": "InstanceDown" }, "commonLabels": { "job": "node", "instance": "db-1:9100", "severity": "page", "alertname": "InstanceDown" }, "truncatedAlerts": 0, "commonAnnotations": { "summary": "db-1:9100 has been down for more than 5 minutes" } } ``` ## FAQ ### Does this work on iPhone and Android? Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification. ### Do I need to write code? No. Install the recipe in Studio, paste your webhook URL into Prometheus and you are done. The code is there if you want to change the text, the sound or the buttons. ### Can I change what the notification says? Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save. ### What does it cost? JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.