# Alert webhooks

> Send Hollow Platform credit, spend, key and failure alerts to your own HTTPS address, signed, with a test send, retries and automatic switch off.

The notification bell shows credit, spend, key and failure alerts while Platform is open, and you can have them emailed. An alert webhook sends the same alerts to an HTTPS address of your own, so a pager, a chat tool or your own code can act on them.

## Set it up

1. Open Limits, find the Alert webhook panel and enter the address that should receive alerts.
2. Choose the kinds of alert to send, then create the webhook. Hollow shows the signing secret once.
3. Copy the secret into your secret manager, then choose Send test to check that your address answers.

- There is one webhook for your account, shared by all your projects.
- The address must be https, must not carry a user name or password, and must not point at Hollow itself. Hollow looks the host up and refuses an address that leads to a private or internal network, when you save it and again every time it sends.
- Creating the webhook, changing it, switching it on or off, rotating the secret and deleting it each need a sign-in within the last 5 minutes. A test send does not, and is limited to 5 a minute.
- The webhook is independent of the alert emails. You can have either, both or neither.

**The kinds of alert**

| Category | Sent when |
| --- | --- |
| credit | Your API credit is running low, or some credit expires within seven days. |
| spend | A project reaches one of its alert thresholds or its monthly spend cap. |
| keys | Hollow suspends one of your API keys for unusual activity. |
| reliability | The five latest requests of a project failed within thirty minutes. |

## What Hollow sends

Each alert is one `POST` with a JSON body. The `id` is the same on every retry of an alert, so keep the ones you have handled and ignore a repeat.

**An alert**

```json
{
  "id": "awh_6f1c0b7d2a",
  "type": "platform.alert",
  "createdAt": "2026-11-01T12:00:00.000Z",
  "data": {
    "category": "credit",
    "title": "API credit is running low",
    "body": "Your available API credit is running low. Open Billing to review the balance and add credit before requests stop.",
    "url": "https://platform.projecthollow.com/billing/"
  }
}
```

**The request headers**

```http
POST /hollow-alerts HTTP/1.1
Content-Type: application/json
User-Agent: Hollow-Platform-Alerts/1.0
Hollow-Signature: t=1793534400,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
```

- `type` is `platform.alert`, or `platform.alert.test` for a test send, whose `data.category` is `test`.
- The body is at most a few hundred characters of text. It never contains a key, a secret, a prompt or a model reply.
- Answer with any `2xx` status within 10 seconds. Hollow does not follow redirects, so a `3xx` answer counts as a failure, and it does not read your reply.

## Check the signature

Every request carries `Hollow-Signature: t=<unix seconds>,v1=<hex>`. `v1` is an HMAC-SHA256 of the text `t`, a full stop and the exact request body, as lower-case hex.

The HMAC key is the SHA-256 hash of your signing secret, as lower-case hex, not the secret itself. Hollow stores only that hash, so it can sign without keeping the secret you copied. Work out the key once, then check each request.

1. Read the raw body before parsing it, and split the header into `t` and `v1`.
2. Compute the HMAC-SHA256 of `t + "." + body` with the key, and compare it with `v1` in constant time.
3. Refuse the request when `t` is more than a few minutes from your clock, so an old request cannot be replayed.

**Verify a request**

**JavaScript**

```javascript
import { createHash, createHmac, timingSafeEqual } from "node:crypto";

// The key is the SHA-256 hash of the secret, as lower-case hex.
const key = createHash("sha256").update(process.env.HOLLOW_ALERT_SECRET).digest("hex");

export function verify(rawBody, header, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(",").map((part) => part.split("=")));
  const expected = createHmac("sha256", key).update(`${parts.t}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) <= toleranceSeconds;
  const a = Buffer.from(parts.v1 ?? "", "hex");
  const b = Buffer.from(expected, "hex");
  return fresh && a.length === b.length && timingSafeEqual(a, b);
}
```

**Python**

```python
import hashlib
import hmac
import os
import time

# The key is the SHA-256 hash of the secret, as lower-case hex.
KEY = hashlib.sha256(os.environ["HOLLOW_ALERT_SECRET"].encode()).hexdigest().encode()


def verify(raw_body: bytes, header: str, tolerance_seconds: int = 300) -> bool:
    parts = dict(part.split("=", 1) for part in header.split(","))
    signed = parts["t"].encode() + b"." + raw_body
    expected = hmac.new(KEY, signed, hashlib.sha256).hexdigest()
    fresh = abs(time.time() - int(parts["t"])) <= tolerance_seconds
    return fresh and hmac.compare_digest(parts.get("v1", ""), expected)
```

### Rotate the secret

- Rotating gives a new secret and shows it once. The old secret stops signing at once, so give the new one to your receiver first if you can, then rotate.
- The secret is never shown again and never written to a log. Hollow shows only its first few characters, so you can tell which secret is current.

## Retries and switching off

A delivery that does not get a `2xx` answer is tried again after 1 minute, then 5 minutes, then 30 minutes, so an alert is sent at most four times. After the fourth failure it is dropped. An alert that is more than a day old is never sent.

- Delivery runs from a job that runs every ten minutes, so a retry goes out at the first run after it is due. Expect alerts within about ten minutes, and retries a little later than the times above.
- Every failed attempt counts, and any `2xx` answer starts the count again. After 10 failed attempts in a row Hollow switches the webhook off and emails you, naming the host and not the full address.
- Alerts still appear in the bell, and by email if you turned that on, while the webhook is off.
- To switch it back on, fix your receiver, choose Send test, then switch the webhook on. Changing the address or switching it on starts the count again.
- Alerts are not re-sent for the time the webhook was off.

> **Note: Keep the address private**
>
> Treat the address like a credential if it carries a token in its path. Hollow never logs it or shows it in an email, and shows it only to you on the Limits page.
