> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Send alerts to email, Slack, Discord, Telegram or a webhook

> Add CrispStats notification channels for email, Slack, Discord, Telegram and signed webhooks: the destination each needs, URL rules and what each message shows.

A notification channel is a destination for CrispStats alerts: one email address, one Slack or Discord webhook, one Telegram chat or one webhook endpoint of yours. Channels belong to your workspace, so the rules of every site can send to them. Owners and admins add and change channels on the **Alerts** screen of any site.

## Add a channel

**1. Open the channel form**

Open a site, then **Alerts** in the sidebar. Under **Notification channels**, select **Add channel**.

**2. Choose where alerts go**

In **Where**, pick **Email**, **Slack**, **Discord**, **Telegram** or **Webhook**. The kind of a channel cannot be changed later.

**3. Name it and enter the destination**

Give the channel a **Name** of up to 80 characters, such as `#alerts on Slack`. It is how the channel appears in alert rules. Then enter the destination for that kind, described below.

**4. Save and test**

Select **Add channel**, then **Send test** next to it. The test arrives within about a minute. See [test a channel](https://docs.crispstats.com/alerts/overview.md#test-a-channel).

Slack, Discord and webhook URLs are secrets. After you save, the dashboard only shows their host, like `hooks.slack.com/…`. When you edit such a channel, the field starts empty: leave it empty to keep the saved URL, or paste a new one to replace it.

## Destinations

| Kind | Field | Accepted value |
| - | - | - |
| Email | **Send to** | One email address. Use a group address to reach several people. |
| Slack | **Incoming webhook URL** | `https://hooks.slack.com/services/…`, also `/workflows/…` and `/triggers/…` paths, and the same paths on `hooks.slack-gov.com`. |
| Discord | **Webhook URL** | `https://discord.com/api/webhooks/<id>/<token>`, also on `discordapp.com`, `ptb.discord.com` and `canary.discord.com`. |
| Telegram | **Chat ID or channel** | A numeric chat id of 4 to 20 digits, optionally starting with `-`, such as `-1001234567890`, or a public channel's `@name` of 4 to 64 letters, digits or underscores. |
| Webhook | **Endpoint URL** | Any public `https` URL on the default port. |

### Email

Each notice is an email whose subject is the alert's headline. The body shows the headline, the summary, the key numbers, the details, an **Open dashboard** button and a link to change the alert.

### Slack

In Slack, create an incoming webhook for the channel you want alerts in, and paste its URL. Each notice is a message with:

* the headline as a header and the summary,
* up to 10 facts as fields, and the list of new errors or goals when there is one,
* an **Open dashboard** button,
* a footer with the rule name and a **Change or mute this alert** link.

### Discord

In Discord, open the channel's settings, then **Integrations**, **Webhooks**, and copy the webhook URL. Each notice is posted as **CrispStats** with one embed:

* the headline linking to the dashboard, and the summary with **Open dashboard** and **Change or mute this alert** links,
* up to 20 facts as fields, and the list of new errors or goals when there is one,
* a color for the tone: red for problems, green for good news such as payments and recoveries, orange otherwise,
* the rule name in the footer and the time it fired.

Mentions are switched off, so an alert can never ping `@everyone`.

### Telegram

CrispStats posts to Telegram through one bot that the CrispStats deployment owns. You do not create a bot or paste a bot token: the channel stores only a chat id.

**Which bot.** The bot is the one registered with Telegram's `@BotFather` when CrispStats is deployed. Its token is a deployment secret, `TELEGRAM_BOT_TOKEN`, read by the ingest worker, never by your browser or your site. The bot's username is chosen at that point, so it is a deployment setting and not a fixed name: neither the channel form nor these docs show it yet. Ask your CrispStats contact or support for the bot's username before you set up the channel.

**Let the bot post.** Telegram bots can only write where they are allowed to:

* a private chat: open the bot in Telegram and select **Start** once,
* a group: add the bot to the group,
* a channel: add the bot to the channel as an administrator that can post messages.

**Enter the chat id.** In **Chat ID or channel**, enter either a numeric chat id (4 to 20 digits; group and channel ids start with `-`, such as `-1001234567890`) or a public channel's `@name` (4 to 64 letters, digits or underscores after the `@`). Anything else is refused when you save.

Each notice is a message with:

* the headline in bold and the summary,
* up to 12 facts and up to 10 list items,
* a **Change or mute this alert** link and an **Open dashboard** button.

If the bot cannot post to the chat, the delivery fails with Telegram's reason, such as `Bad Request: chat not found`. If the deployment has no `TELEGRAM_BOT_TOKEN` set, every Telegram delivery fails with `Telegram is not configured on this deployment (TELEGRAM_BOT_TOKEN)`; that is fixed on the deployment, not in the channel.

### Webhook

CrispStats sends a JSON `POST` to your endpoint for every notice, signed with the channel's own secret. Use it to feed alerts into your own tools.

The request carries these headers:

| Header | Value |
| - | - |
| `Content-Type` | `application/json; charset=utf-8` |
| `User-Agent` | `CrispStats-Webhooks/1.0 (+https://crispstats.com/docs/alerts)` |
| `X-CrispStats-Event` | `alert.triggered` or `alert.recovered`. A test sends `alert.test`. |
| `X-CrispStats-Delivery` | A unique id per notice and channel. A retried request carries the same id. |
| `X-CrispStats-Timestamp` | Unix seconds when the request was signed. |
| `X-CrispStats-Signature` | `v1=` followed by the hex HMAC-SHA256 of `<timestamp>.<raw body>`. |

This is the body of a **Monitor down** notice:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "6f1c2a9e-4b7d-4e0a-9c3f-2d8e5b1a7c40.0b9d3e21-5c6f-4a8b-9e7d-1f2a3b4c5d6e",
  "type": "alert.triggered",
  "createdAt": "2026-11-16T14:02:11.000Z",
  "site": { "id": "8a7b6c5d-4e3f-4a1b-9c8d-7e6f5a4b3c2d", "name": "Example", "domain": "example.com" },
  "alert": { "id": "3c2b1a09-8f7e-4d6c-9b5a-4f3e2d1c0b9a", "name": "Site is down", "type": "monitor_down" },
  "message": {
    "title": "Marketing site on example.com is down",
    "summary": "https://example.com/health is failing its checks: HTTP 503. We will tell you once when it is back.",
    "facts": [
      { "label": "Cause", "value": "HTTP 503" },
      { "label": "Status code", "value": "503" },
      { "label": "Down since", "value": "Mon 16 Nov, 14:02 (UTC)" }
    ],
    "url": "https://crispstats.com/app/8a7b6c5d-4e3f-4a1b-9c8d-7e6f5a4b3c2d/uptime",
    "manageUrl": "https://crispstats.com/app/8a7b6c5d-4e3f-4a1b-9c8d-7e6f5a4b3c2d/alerts"
  },
  "data": {
    "incidentId": "d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f70",
    "monitorId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
    "monitorName": "Marketing site",
    "url": "https://example.com/health",
    "cause": "HTTP 503",
    "statusCode": 503,
    "startedAt": "2026-11-16T14:02:00+00:00"
  }
}
```

| Field | Content |
| - | - |
| `id` | Same as `X-CrispStats-Delivery`. Use it to ignore a request you have already handled. |
| `type` | `alert.triggered` or `alert.recovered`, or `alert.test` for a test. |
| `site` | The site's id, name and domain. |
| `alert` | The rule's id, name and [type](https://docs.crispstats.com/alerts/rule-types.md). |
| `message` | The words every channel shows: `title`, `summary`, `facts`, an optional `list` with `title` and `items`, the dashboard `url` and the `manageUrl` for the alert. |
| `data` | The raw numbers that tripped the rule. Its fields depend on the rule type. |

Answer with any `2xx` status. To check that a request came from CrispStats, verify the signature over the raw body and reject timestamps more than 300 seconds from now. See [webhook signatures](https://docs.crispstats.com/api-reference/webhooks.md).

> [!WARNING]
>
> Every webhook channel gets a signing secret, starting with `whsec_`, when it is created, and every request is signed with it. The dashboard does not show the secret yet, so you cannot verify the signature until it does. Until then, keep your endpoint URL private and treat it as the credential.

## URL rules

Before each delivery, CrispStats checks the destination again:

* Slack URLs must be on `hooks.slack.com` or `hooks.slack-gov.com`, and Discord URLs on the Discord hosts listed above. A Slack or Discord channel cannot point anywhere else.
* Every URL must use `https` on the default port 443, without a user name or password.
* Webhook URLs must not be, or resolve to, a private, loopback, link-local or metadata address or an internal host name. The host is looked up and its addresses checked before the request (a successful lookup is reused for up to 5 minutes), and a failed lookup fails the delivery.
* Redirects are not followed. A `3xx` response counts as a failed delivery.

A refused destination shows up as a failed delivery with the reason, for example **Not a Slack incoming webhook URL (hooks.slack.com)** or **Blocked: the host resolves to a private address**.

## Delivery and retries

Each request waits up to 8 seconds for an answer. A `429` or `5xx` response is retried once, after the `Retry-After` the destination asks for (up to 5 seconds) or after a short pause. Timeouts and network errors are not retried, because the notice may have arrived and a duplicate is worse than a gap. Each delivery, with its status and error, is listed in **Recent deliveries** on the Alerts screen.

Errors stored in the log never contain your webhook URLs or tokens.

## Turn off or remove a channel

* Use the switch next to a channel to stop sending to it from every site. Rules keep it ticked, and sending resumes when you switch it back on. A channel that is off cannot be tested.
* Open the actions menu (**⋯**) and choose **Remove channel** to delete it. Alerts on every site in the workspace stop sending to it; the rules themselves stay.

## Next steps

> [card] [Get alerted](https://docs.crispstats.com/alerts/overview.md)
>
> Create a rule and attach your channels.

> [card] [Alert rule types](https://docs.crispstats.com/alerts/rule-types.md)
>
> What each rule watches and what its notice contains.

> [card] [Webhook signatures](https://docs.crispstats.com/api-reference/webhooks.md)
>
> Verify that a request came from CrispStats.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.