# Your servers, on the *pager you already carry.*

> WhatsApp alerts for servers and self-hosted apps from one HTTPS POST to /v1/notify: Grafana, Uptime Kuma and Alertmanager post directly, one-liners cover cron, disk and TLS.

Recipe · Servers & self-hosted apps

Backup failed at 3am, root filesystem crossed 90%, a cert expires Friday: the handful of alerts you'd be sorry to miss land in WhatsApp. The firehose stays where it belongs: Grafana, ntfy, the log pipeline. This page wires the *must-reach-me* few to a single HTTPS request, `POST /v1/notify`, from a cron line, a tiny relay, or a shell check. No app to install, no linked device; it's the official Meta Cloud API underneath. Get the key by sending **join** on WhatsApp (details at the bottom).

§ 1

## Cron: ping when a job fails

The most-pasted line here. Wrap the job so a *failure* taps you. Success stays silent. Watch the quoting: shell does not expand `$(...)` or `$VARS` inside **single** quotes, so the host name has to sit in double-quoted JSON with the inner quotes escaped, or just be hard-coded. And one cron-specific trap: cron does **not** source your `.bashrc`, so `$PINGWA_KEY` from your shell is empty inside a cron job. Define it at the top of the crontab itself (as below) or export it in the script you're wrapping.

crontab: failure-only ping (host hard-coded)

```
PINGWA_KEY=pw_your_key_here
0 3 * * * /opt/backup.sh || curl -sf -X POST https://pingwa.dev/v1/notify -H "Authorization: Bearer $PINGWA_KEY" -H "Content-Type: application/json" -d '{"text": "🔥 backup FAILED on myhost"}' || true
```

Want the host name filled in dynamically? Switch the body to double quotes and escape the inner ones. The single-quoted form above will print `$(hostname)` literally, which is the classic footgun:

crontab: failure ping with live hostname

```
0 3 * * * /opt/backup.sh || curl -sf -X POST https://pingwa.dev/v1/notify -H "Authorization: Bearer $PINGWA_KEY" -H "Content-Type: application/json" -d "{\"text\": \"🔥 backup FAILED on $(hostname)\"}" || true
```

Two rules matter. The trailing `|| true` stops a failed *ping* (our outage, a WiFi blip) from poisoning cron's own exit status. And prefer **failure-only** over a nightly "done" ping: you'll learn to ignore the success message, so its absence tells you nothing, while a job that dies *silently* also sends nothing, and you never notice. Alert on the exception, not the routine; if you do want proof-of-life, that's a dead man's switch, not a message you'll swipe away half-asleep: § 2.

§ 2

## Missed check-in: alert when a job did *not* run

§ 1 catches a job that fails. It can't catch one that never runs: a stopped cron daemon, a full disk, a box that's powered off all send nothing. A **check** turns that around. The job pings a URL each time it ran; when a ping is later than expected plus a grace time, pingwa sends **one** alert (*"Check backup-nas did not report. Expected at 2026-03-28 03:00 (Europe/Warsaw)."*) and one more message when it reports again. Not one per minute. The ping itself sends nothing and costs nothing: only the alert and the "back" message are messages. Create the check once (the key needs the `manage` scope):

create a check: daily at 03:00, one hour of grace

```
curl -s -X POST https://pingwa.dev/v1/checks -H "Authorization: Bearer $PINGWA_KEY" -H "Content-Type: application/json" -d '{"name": "backup-nas", "cron": "0 3 * * *", "timezone": "Europe/Warsaw", "grace_s": 3600}'
```

The answer holds `url`, shown once (only its hash is stored). Then wrap the job in the cron entry: the plain URL says "it ran", `/fail` alerts at once, chosen by the job's own exit status (a failed "it ran" curl never reports a failure).

crontab: report every run, and every failure

```
0 3 * * * if /opt/backup.sh; then curl -fsS -m 10 https://pingwa.dev/c/ck_your_check_key; else curl -fsS -m 10 https://pingwa.dev/c/ck_your_check_key/fail; fi
```

No header, no JSON body: the URL is the credential, so keep it like a password (`DELETE /v1/checks/<id>` retires it). Nothing is sent before the first ping, so a new check never alerts while you're still wiring it up. A job on a fixed interval instead of a cron line? Create it with `"every_s": 3600`. How many checks your plan includes is in `GET /v1/me` (`entitlements.checks`); an alert counts toward the monthly quota like any message.

§ 3

## Grafana → direct (or a tiny relay for < 12)

Running [Grafana](/grafana), [Uptime Kuma](/uptime-kuma) or [Alertmanager](/alertmanager)? Each now has a dedicated zero-code recipe page: self-hosted Grafana ≥ 12 sends our `{"text": …}` body with a Bearer header straight from a webhook contact point, no middleman. The relay below stays the answer for older Grafana and for any tool whose webhook can't carry a custom body or an auth header: it accepts the tool's payload and reshapes `title`/`message` into one line for `/v1/notify`. Point the webhook URL at the relay; keep your pingwa key in the relay's environment, never in the sending tool.

relay.py: FastAPI, one route

```
import os, httpx
from fastapi import FastAPI, Request

app = FastAPI()
KEY = os.environ["PINGWA_KEY"]

@app.post("/grafana")
async def grafana(req: Request):
    a = await req.json()
    # Grafana's webhook JSON carries the alert in title/message.
    text = f"🔔 {a.get('title', 'Grafana alert')} — {a.get('message', '')}"[:1024]
    async with httpx.AsyncClient() as c:
        await c.post(
            "https://pingwa.dev/v1/notify",
            json={"text": text},
            headers={"Authorization": f"Bearer {KEY}"},
        )
    return {"ok": True}
```

Honest note: if you already run n8n, you don't need this process at all. A two-node flow (Webhook → HTTP Request) does the same reshape with nothing to deploy. See the [n8n recipe](/n8n). The relay is for when a small always-on service is simpler than one more n8n workflow.

§ 4

## Uptime Kuma → direct (or the same relay)

Uptime Kuma doesn't need a relay at all: its **Webhook** notification type takes a custom body and headers, so it can POST `{"text": …}` straight to `/v1/notify`: the [dedicated Kuma recipe](/uptime-kuma) is the copy-paste version. But if you're already running the § 3 relay and prefer one place for every mapping, a second route works too. Kuma's default webhook body carries the human-readable line ("… is DOWN") in `msg`. Set Kuma's webhook URL to `…/kuma`:

relay.py: second route for Uptime Kuma

```
@app.post("/kuma")
async def kuma(req: Request):
    a = await req.json()
    # Kuma's default webhook body carries the line in msg.
    text = f"🟥 {a.get('msg', 'Uptime Kuma alert')}"[:1024]
    async with httpx.AsyncClient() as c:
        await c.post(
            "https://pingwa.dev/v1/notify",
            json={"text": text},
            headers={"Authorization": f"Bearer {KEY}"},
        )
    return {"ok": True}
```

Field names on external tools drift between versions. If a key isn't where you expect, log the raw body once and read it off the wire. The relay *pattern* is the durable part: accept their shape, map it to `{"text": …}`, forward with your key.

§ 5

## Disk over threshold: once a day, not every poll

`df` piped through `awk` gives you the used-percent as a bare integer. Run it from cron every 5 minutes and the trap is alert-per-poll: root crosses 90% and you get a buzz every five minutes until you fix it. The `Idempotency-Key` header ends that: same key with the same body is honored for 24 hours, replays absorbed, nothing re-sent. Key it on the mount plus the day and you get **one alert per mount per day**. The `$(date +%F)` lives inside the `.sh` file, so there's no crontab `%`-escaping to worry about.

disk-check.sh: cron every 5 min, alerts once/day per mount

```
#!/bin/sh
MOUNT=/
THRESHOLD=90
used=$(df -P "$MOUNT" | awk 'NR==2 {gsub(/%/,""); print $5}')
if [ "$used" -ge "$THRESHOLD" ]; then
  curl -sf -X POST https://pingwa.dev/v1/notify \
    -H "Authorization: Bearer $PINGWA_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: disk-$MOUNT-$(date +%F)" \
    -d '{"text": "💾 disk on / over 90% — free space now"}' || true
fi
```

One rule to respect: keep the body *constant* for a given key. A different body under the same key is rejected with a **409** and nothing is sent, so don't interpolate the live "91%" into the text, or today's second run silently drops. Report the threshold in words, not the reading.

§ 6

## TLS certificate about to expire

Ask the server for its leaf cert's end date, turn both dates into epoch seconds, and tap yourself when fewer than 14 days remain. Run it **weekly**: a cert that's 40 days out doesn't need a daily nag, and by the time it's inside two weeks a weekly check still gives you room to act.

cert-check.sh: cron weekly, warns under 14 days

```
#!/bin/sh
HOST=example.com
end=$(echo | openssl s_client -connect "$HOST:443" -servername "$HOST" 2>/dev/null \
  | openssl x509 -noout -enddate | cut -d= -f2)
end_epoch=$(date -d "$end" +%s)
days=$(( (end_epoch - $(date +%s)) / 86400 ))
if [ "$days" -lt 14 ]; then
  curl -sf -X POST https://pingwa.dev/v1/notify \
    -H "Authorization: Bearer $PINGWA_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: cert-$HOST-$(date +%F)" \
    -d "{\"text\": \"🔒 $HOST cert expires in $days days\"}" || true
fi
```

Here the day count *is* the news, so it goes in the text. And because the count shifts as the deadline nears, this one body legitimately changes. Fine: the `Idempotency-Key` still caps it at one per host per day, and a new body under a *new day's* key sends cleanly. (`date -d` is GNU coreutils; on BSD/macOS use `date -j -f`.)

§ 7

## Where this fits, and where it doesn't

### Respect where it's due

[ntfy](https://ntfy.sh) is excellent: open source, self-hostable, and very good at pushing a high-volume stream of events to a topic you subscribe to. If you want *every* alert, every deploy, every log line on tap in a dedicated feed, that's ntfy's home turf, and this page won't pretend otherwise.

### What's different here

No extra app to install or check: the alert lands in the app you already answer, next to your family and your team. Nothing new to open, nothing new to keep unmuted.

### The honest counter

That same property makes pingwa *wrong* for the firehose. A busy alert stream in your personal chat is noise you'll learn to swipe away. Keep that in ntfy or Grafana. pingwa is for the handful that must reach you, and the free tier's 30 paid messages a month quietly enforces that discipline: if a check is firing more than that, it isn't paging you, it's logging at you. Route the stream to ntfy; route the exceptions here.

§ 8

## FAQ

### How do I get a Grafana WhatsApp alert?

On self-hosted Grafana ≥ 12, no relay: a webhook contact point with a custom payload and a Bearer header POSTs `{"text": …}` to `/v1/notify` directly. The [Grafana recipe](/grafana) has the exact template. On older Grafana, put the small relay from § 3 in between: it accepts Grafana's JSON, pulls `title`/`message`, and forwards with your key. Already on n8n? A two-node flow does the same with nothing to deploy. See [the n8n recipe](/n8n).

### Uptime Kuma WhatsApp notification: supported?

Yes, and no relay needed: Kuma's **Webhook** notification type takes a custom body and headers, so it calls `/v1/notify` directly. The [Kuma recipe](/uptime-kuma) is the copy-paste version; the § 4 relay route still works if you'd rather keep every mapping in one place. Field names can shift between versions. If `msg` isn't there, log the raw body once and read it off the wire.

### Can I get a cron job failure alert on my phone?

That's § 1: append `|| curl … /v1/notify …` after the job so a non-zero exit taps you, then a final `|| true` so a failed ping never breaks cron's own status. Failure-only beats a nightly "done" ping: you'll ignore the routine message, so alert on the exception.

### Can it tell me when a cron job did not run at all?

Yes, that's § 2: a check expects a ping from the job every day (or on its cron line, in your timezone) and sends one alert when the ping is late by more than the grace time, then one "back" message when the job reports again. The ping costs nothing; only those two are messages.

### Won't a flapping check burn my free tier?

Not with the `Idempotency-Key` pattern from §§ 5–6: key on state-plus-day and a check that runs every 5 minutes still sends at most one message per day per thing. The free tier is 30 messages a month, counting every send. That's enough for real exceptions, and a useful ceiling that keeps the firehose out. High-volume streams belong in ntfy or Grafana; send only what must reach you.

[Send “join” on WhatsApp →](https://wa.me/48797882513?text=join%20monitoring) [More recipes](/use-cases) [Read the API](/docs)

![QR code to join pingwa on WhatsApp](/join.svg?tag=monitoring&n=48797882513)

Scan the code and get instant access. It opens WhatsApp with “join” ready to send, and your API key comes straight back.

The relay and shell snippets above are the honest shape of the integration, not lab-verified against every Grafana or Uptime Kuma release. External webhook field names drift between versions, so log a raw payload once and confirm the mapping before you trust a 3am page to it.
