# Alerts

> An email or a Slack, Teams or Discord message when traffic jumps, a day passes without visitors, or a goal goes quiet.

You should not have to stare at a dashboard to notice that a post went viral, that your site is down, or that nobody has filled in the contact form for days. Alerts tell you by email, and in Slack, Microsoft Teams or Discord if you like.

> [!PLUS]
> Alerts are part of Plus. See [Plans and pricing](https://docs.okidoki.sh/plans).

## The alerts

| Alert | When it fires |
| --- | --- |
| **Traffic jumps** | The last full hour had at least 5 times the visitors of a usual hour over the past week, and at least 50 visitors |
| **No visitors for a day** | No visitors at all in the last 24 hours, when the week before had some. Often a sign that the site is down or the tag was removed |
| **A goal goes quiet** | A goal you choose was not reached for a number of days (1 to 30, 3 by default), when it was reached in the 30 days before |

Okidoki checks every hour. Every alert is off until you turn it on.

## Turn an alert on

1. Go to **Settings → Notifications** and find **Alerts**.
2. Press **Turn on** next to the alert you want. For a goal alert, pick the goal and the number of days.
3. Alerts go to the account's email. To also get them in your team's chat, connect Slack, Teams or Discord (below).

Each alert is one plain sentence with a link to your dashboard, like *mysite.com had 212 visitors in the last hour, 7 times more than a usual hour.*

## Slack, Teams and Discord

Alerts, new sales and the Monday check-in can go to a channel in Slack, Microsoft Teams or Discord, as a readable message with a button to your numbers. Messages are written in your account's language.

**Slack, the easy way:** in Okidoki, go to **Settings → Notifications**, choose what to send and press **Add to Slack**. Sign in to Slack, pick the channel and press **Allow**. That's it: a first message shows up in the channel right away. Okidoki asks Slack only to post in that channel and to receive messages that mention @Okidoki. It reads nothing else.

**Discord, the easy way:** press **Add to Discord** in the same place, sign in to Discord, pick the server and channel and press **Authorize**. Okidoki gets a webhook for that channel and the `/okidoki` command, and reads nothing else.

**Teams, Discord, or Slack by hand:**

1. Get an incoming webhook address for the channel:
   - **Slack**: in the channel's settings, choose **Integrations → Add an app**, add **Incoming Webhooks** and copy the Webhook URL. It starts with `https://hooks.slack.com/services/`.
   - **Microsoft Teams**: in the channel, choose **… → Workflows** and pick **Post to a channel when a webhook request is received**. Copy the address the workflow gives you.
   - **Discord**: **Server Settings → Integrations → Webhooks → New Webhook**, pick the channel and copy the Webhook URL.
2. In Okidoki, go to **Settings → Notifications**, paste the address under **Slack, Teams and Discord**, choose what to send and press **Connect**.
3. A first message shows up in the channel right away. **Test** sends another one any time.

You choose what each channel gets: traffic jumps, a day without visitors, a goal that goes quiet, every sale, a goal that is reached, and the Monday check-in. A channel can be for one site or all of them.

The address works like a password for the channel, so Okidoki stores it encrypted and never shows it again, only its last characters. If the chat stops taking messages (the webhook was deleted or the channel archived), the channel turns off and says so; a test that works turns it on again.

## Ask Okidoki in the chat

With Slack or Discord added the easy way, the team can ask Okidoki AI right where they talk. In Slack, write *@Okidoki how did yesterday go?* in a channel or thread. In Discord, use `/okidoki` with your question. Okidoki answers in the thread, with a chart button where it helps. Slack only sends Okidoki the messages that mention it, and Discord only the command. Each answer uses one of the account's questions, like in the app, and answers are part of Plus. Teams cannot answer questions yet.

Your AI agent can set this up too, with the MCP tools `add_chat_channel`, `list_chat_channels`, `test_chat_channel` and `remove_chat_channel`. Ask it to "send my Okidoki alerts to Slack".

## Not too many

After an alert fires, it waits before it can fire again: a day for traffic jumps, and 3 days for a day without visitors or a quiet goal. You hear about something once, not every hour.

## From the API

```bash
# Send alerts, sales and the Monday check-in to a Slack, Teams or Discord channel
curl -X POST https://okidoki.sh/api/v1/chat-channels \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -d '{"url":"https://hooks.slack.com/services/..."}'

# Tell me when traffic jumps
curl -X POST https://okidoki.sh/api/v1/sites/mysite.com/alerts \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -d '{"kind":"spike"}'

# Tell me when "Signed up" is not reached for 5 days
curl -X POST https://okidoki.sh/api/v1/sites/mysite.com/alerts \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -d '{"kind":"goal","goal":"Signed up","days":5}'
```

`kind` is `spike`, `quiet` or `goal`. See the [API reference](https://docs.okidoki.sh/api/reference#alerts) and [chat channels](https://docs.okidoki.sh/api/reference#chat-channels).

## What alerts never do

- They never send anything about single visitors, only totals.
- They never go to anyone but the account's email and the chat channels you chose.

