Alerts in Slack
On this page
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
- Open https://api.slack.com/apps and choose Create New App, From scratch. Name it
BxLensand pick your workspace. - In the app, open Incoming Webhooks and switch Activate Incoming Webhooks on.
- Choose Add New Webhook to Workspace, pick the channel (for example
#ops-alerts) and Allow. - 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
- Open Settings, Notifications, Channels and press + Add channel.
- 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 and never shows it again. The list shows only the host,
hooks.slack.com. - Choose the alerts that go here (all of them, or some), the lowest severity, and the reports.
- 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 tonotifications.channelHostsinboxlang.json, see Configuration. - 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_serviceor404, the webhook was removed. Create a new one and paste it in the channel.
See Notifications for how alerts are routed.