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

# Notifications

> Alert Slack or a webhook about failures, slow jobs, and queues.

> [!NOTE]
>
> Ask Peak to turn on notifications for your workspace.

## Before you start

Sign in as an Admin.
For Slack, create an incoming webhook in your Slack workspace.
For a webhook, use a public HTTPS URL.

## Add a destination

1. Open Settings → Notifications.
2. Choose Add destination.
3. Choose Slack or Webhook as the Type.
4. Enter a Name and the URL.
5. Save it.
6. Choose Send test and check the result.

For a webhook, copy the Signing secret now.
Peak shows it once.
Choose New secret to replace it.

## Add a monitor

1. Choose New monitor.
2. Choose a kind and set its threshold.
3. Choose a Repository, or keep All repositories.
4. Set Cooldown in minutes.
5. Choose destinations under Send to.
6. Save it.

| Kind | Alerts when | Default |
| - | - | - |
| Default-branch job failed | A job fails on the default branch | — |
| Job duration | A job runs longer than the threshold | 30 minutes |
| Slower than its 7-day p90 | A job runs slower than its usual time | 20% |
| Queue time | A job waits longer than the threshold to start | 120 seconds |
| Flaky job | A job passes on rerun within the window | 24 hours |
| Jobs stuck waiting | Jobs stay queued longer than the threshold | 15 minutes |

Mute a monitor for 1 hour, 8 hours, 1 day, or 1 week.
Turn it off to stop alerts.

## Verify webhook requests

Read these headers on each request.

| Header | Value |
| - | - |
| X-Peak-Event | monitor.alert or test |
| X-Peak-Delivery | Delivery ID, the same on every retry |
| X-Peak-Timestamp | Unix time in seconds |
| X-Peak-Signature | sha256= and a hex HMAC-SHA256 |

Sign the timestamp, a period, and the raw body with your secret.
Compare the result with the header in constant time.

```js theme={null}
const expected = 'sha256=' + crypto.createHmac('sha256', secret)
  .update(`${timestamp}.${rawBody}`).digest('hex');
const valid = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
```

Reject timestamps older than 5 minutes.
Skip deliveries you already processed.

```json Example body theme={null}
{
  "type": "monitor.alert",
  "monitor": { "name": "Main is failing", "kind": "default_branch_failure" },
  "alert": {
    "title": "Job failed on main",
    "detail": "Failed step: Run tests",
    "url": "https://app.peak.inc/runs/insights/runs/123?job=456",
    "repository": "acme/web",
    "workflow": "CI",
    "job": "test",
    "branch": "main",
    "conclusion": "failure"
  }
}
```

Answer with a 2xx status within 5 seconds.
Expect retries after 30 seconds, 2 minutes, 10 minutes, and 30 minutes for timeouts, 429, and 5xx answers.
Check recent results in the destination's Deliveries table.


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