---
title: Alerts in Slack
order: 6
description: Send BxLens alerts and reports to a Slack channel with an incoming webhook, step by step.
icon: lucide:message-square
---

# Alerts in Slack

A Slack channel in BxLens posts every alert (firing, reminder, resolved) and the reports you choose to a Slack channel of yours. It needs **BoxLang+** and an **incoming webhook**, which is an address Slack gives you.

## 1. Create the webhook in Slack

1. Open <https://api.slack.com/apps> and choose **Create New App**, **From scratch**. Name it `BxLens` and pick your workspace.
2. In the app, open **Incoming Webhooks** and switch **Activate Incoming Webhooks** on.
3. Choose **Add New Webhook to Workspace**, pick the channel (for example `#ops-alerts`) and **Allow**.
4. Copy the **Webhook URL**. It looks like `https://hooks.slack.com/services/T000/B000/XXXX`. Anyone who has it can post to that channel, so treat it like a password.

## 2. Add the channel in BxLens

1. Open **Settings, Notifications, Channels** and press **+ Add channel**.
2. Choose the type **Slack**, give it a name, and paste the webhook URL. The field is write only: BxLens stores the address encrypted in the [Secret Store](../security.md#the-secret-store) and never shows it again. The list shows only the host, `hooks.slack.com`.
3. Choose the alerts that go here (all of them, or some), the lowest severity, and the reports.
4. Press **Save**, then **Send test**. A message marked TEST arrives in the Slack channel.

## What the message looks like

A colored attachment: a red bar for critical, amber for a warning, green for resolved, blue for a report. It has the heading (`Firing: Datasource pool exhausted`), the server, the severity and the time, the sentence that says what is wrong, the facts, and an **Open in BxLens** button when `console.publicUrl` is set. Text from your servers is escaped for Slack (`&`, `<` and `>`), so a message that holds `<!channel>` or a link does not mention anyone or link anywhere.

## Good to know

- The host must be `hooks.slack.com`. If you reach Slack through a proxy of your own, add its host to `notifications.channelHosts` in `boxlang.json`, see [Configuration](../configuration.md#notifications).
- The address must be https and must resolve to a public address. BxLens checks it when you save and again before every send, and does not follow redirects.
- A channel that cannot be reached is tried again after 5 minutes, on its own. The mail and the other channels are not sent the same alert again.
- A Slack message is at most 40 KB. A long text is cut with three dots.
- If Slack answers `no_service` or `404`, the webhook was removed. Create a new one and paste it in the channel.

See [Notifications](../console/notifications.md#channels) for how alerts are routed.
