# Alerts

> Email, Slack, Discord, Telegram and signed webhooks: events, payloads, and how to verify the X-Uptenna-Signature header.

Source: https://uptenna.com/docs/alerts  
Markdown: https://uptenna.com/docs/alerts.md

Every **active** alert channel gets every alert. Free includes email; Pro and Team include all channels.

| Event | When |
| --- | --- |
| `monitor.down` | An incident opens (two failed checks in a row). |
| `monitor.recovered` | The incident resolves (first successful check, or the next heartbeat ping). |
| `heartbeat.late` | A heartbeat's ping is late, or the job reported `/fail`. |
| `ssl.expiring` | A certificate expires within 14 days, and again within 3 days. |
| `test` | You pressed **Send test**. |

Each event has a stable id (for example `inc_…:opened`), and a channel never receives the same event twice, even when a delivery is retried. Failed deliveries are retried twice (after 1 and 4 seconds). A channel that fails 5 deliveries in a row is turned off; turn it back on (or change its address) in **Alerts**.

## Email

Up to 5 addresses per channel. Sent from `alerts@uptenna.com`.

## Slack

Create an **Incoming Webhook** in Slack (Apps → Incoming Webhooks → Add to a channel) and paste its `https://hooks.slack.com/services/…` URL.

## Discord

Channel settings → Integrations → Webhooks → New Webhook → Copy Webhook URL (`https://discord.com/api/webhooks/…`).

## Telegram

Add a Telegram channel and open the link we show (it's valid for an hour and works once): it starts a chat with [@UptennaBot](https://t.me/UptennaBot), or adds the bot to a group. Press **Start** and the channel becomes active. Removing the bot from the chat turns the channel off.

## Webhooks

We `POST` JSON to your HTTPS endpoint, with a 5-second timeout. Only public HTTPS hosts are accepted. The body:

```json payload.json
{
  "id": "inc_Ab12Cd34Ef56Gh78:opened",
  "type": "monitor.down",
  "version": 1,
  "occurredAt": "2026-12-01T10:04:00.000Z",
  "monitor": { "id": "mon_…", "name": "API", "kind": "http", "url": "https://api.example.com/health" },
  "data": {
    "incidentId": "inc_Ab12Cd34Ef56Gh78",
    "severity": "down",
    "reason": "Got HTTP 503 (expected 2xx or 3xx)",
    "statusCode": 503,
    "responseTimeMs": 120,
    "startedAt": "2026-12-01T10:03:00.000Z"
  },
  "links": { "dashboard": "https://uptenna.com/dashboard/monitor?id=mon_…", "statusPage": "https://uptenna.com/status/acme" }
}
```

`data` for the other events: `monitor.recovered` has `incidentId, startedAt, resolvedAt, downtimeMs, downtime, responseTimeMs`; `heartbeat.late` has `incidentId, lastPingAt, periodS, graceS`; `ssl.expiring` has `host, expiresAt, daysLeft, issuer`; `test` has `message, channel`. We only add fields; `version` changes if we ever remove one.

Headers:

| Header | Value |
| --- | --- |
| `X-Uptenna-Event` | The event type, e.g. `monitor.down` |
| `X-Uptenna-Delivery` | The event id |
| `X-Uptenna-Timestamp` | Unix seconds when we signed it |
| `X-Uptenna-Signature` | `sha256=` + hex HMAC-SHA256 of `<timestamp>.<raw body>` with your signing secret |

### Verify the signature

Your signing secret (`whsec_…`) is shown once, when you add the webhook (choose **New secret** to replace it). Compute the HMAC over the **raw** body, compare in constant time, and refuse timestamps more than 5 minutes from your clock:

```js verify.js
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyUptenna(rawBody, headers, secret) {
  const ts = headers["x-uptenna-timestamp"];
  const sig = headers["x-uptenna-signature"] ?? "";
  if (!/^\d+$/.test(ts ?? "") || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const expected = "sha256=" + createHmac("sha256", secret).update(`${ts}.${rawBody}`).digest("hex");
  return sig.length === expected.length && timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}
```

```python verify.py
import hashlib, hmac, time

def verify_uptenna(raw_body: bytes, headers, secret: str) -> bool:
    ts = headers.get("X-Uptenna-Timestamp", "")
    sig = headers.get("X-Uptenna-Signature", "")
    if not ts.isdigit() or abs(time.time() - int(ts)) > 300:
        return False
    expected = "sha256=" + hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(sig, expected)
```

Answer with any 2xx quickly. Redirects are not followed; a 4xx is not retried; timeouts, 429 and 5xx are retried. Use `X-Uptenna-Delivery` to ignore duplicates on your side.
