Notifications: alerts by email and channels

On this page

Notifications: alerts by email and channels

With BoxLang+, BxLens can send you an email, or a message in Slack, Microsoft Teams or Telegram, or a signed webhook call, when something is wrong, before your users call. Seventeen alerts watch the JVM, disks, errors, traffic, databases, tasks, dependencies, mail, AI, security and the logs. Every alert is off until you switch it on, one by one.

Set it up in Settings, Notifications (admin only). When an alert fires, the alert runbook says what each one means and what to check first. For more than one server, read Several servers.

Set up in 5 steps

StepWhat you doWhere
1. Say how mail is sentGive the SMTP server, login and senderSettings, Notifications
2. Say who gets mailAdd people, severity, categories and reportsSettings, Notifications
3. Switch alerts onTurn on the alerts you want and set their limitsSettings, Notifications
4. Add channelsAdd Slack, Teams, Telegram or a webhookSettings, Notifications, Channels
5. See the mails before they go outCheck each mail with sample dataSettings, Notifications, Mail previews

Also on this page: How the mails are sent, Set it up with Lensy, Safety and Without BoxLang+.

1. Say how mail is sent

Lens sends the mails itself over SMTP. It does not use bx-mail, so an alert can still reach you when the application, or its mail module, is the thing that is broken.

SettingMeaning
Server, port, securityYour SMTP server. TLS 1.2 and 1.3, and the server name is checked.
UserEmpty when the relay needs no login.
PasswordWrite only. Press Set or Replace and paste it. Clear removes it. See below.
From, name, reply toWho the mail is from.

Security has three options:

Port 587 usually.

Port 465.

A trusted relay only.

The password

Press Set or Replace and paste it: it goes to the server, is kept sealed in the Secret Store and is never shown again. The page says where it comes from (set in console, from boxlang.json, from the environment).

The order is:

  1. The one set in the console.
  2. notifications.smtp.password as a bxsecret: value in boxlang.json.
  3. The environment variable whose name you type in the field.
Password rules and limits
  • The name must start with BXLENS_SMTP_ (for example BXLENS_SMTP_PASSWORD), so no other variable of the server (a license, a console password, a cloud key) can be sent out.
  • Admin only, audited as secret.change (the name, never the value), and refused when console.readOnly is on.
  • Setting it needs BoxLang+, like the rest of the Notifications tab.
  • With several servers, share secrets.dir (and the key) so each can open it.
  • The same field is on Settings, Security.

If you change the server while a password is set, the page asks you to confirm that the password goes to the new host. Nothing sends a password to another host by itself.

Press Send test mail to see the answer of your SMTP server in plain words. The test mail and the report buttons wait a few seconds between two calls and stop at 20 an hour.

2. Say who gets mail

Add people with an address and a name. For each person you choose:

  • whether they get alerts at all,
  • the lowest severity (warnings and critical, or critical only),
  • the categories (none means all): availability, jvm, capacity, errors, traffic, database, runtime, tasks, dependencies, mail, ai, security, logs,
  • which reports they get (daily, weekly, monthly), see Email reports.

At most 50 people. An address cannot carry a line break or a list of addresses.

3. Switch alerts on

AlertFires whenDefault limits
Server down (critical)A server stops saving its health snapshot and heartbeat3 minutes
Deadlock (critical)The JVM reports threads that wait for each other
Heap pressure (critical)The heap stays above a limit, or GC uses too much time90% for 5 minutes, or GC above 30%
Disk space (critical)A volume is nearly full, or a folder Lens must write to is read only90% used
Error spike (critical)Many errors a minute, an error never seen before, or a resolved error that came back20 a minute over 5 minutes, new error on, regressed on. Ignored errors never fire
Failed requests (critical)The share of failed requests (a 5xx or an uncaught error) is high5% of at least 50 requests over 5 minutes
Slow site (warning)The average response time stays high2000 ms for 10 minutes, at least 50 requests
Datasource pool (critical)Requests wait for a database connection2 minutes
Executor saturated (warning)An executor is critical or has a long queue100 queued tasks
Scheduled task failing (warning)A task is failing2 failures
Outgoing HTTP (warning)A host the app calls fails more than the HTTP page limit
Mail (warning)Bounces, a high failure rate, a spool that does not drain (Mail integration)
AI (warning)Failed runs, rate limits, or a cost over your daily budget (AI integration)budget off
MCP rate limited (warning)A hosted MCP server blocks many calls with its rate limit, usually one client flooding it30 blocked in 10 minutes (collectors.aiobs.mcpRateLimited)
MCP rate limiter failing (critical)The store of a rate limit failed, so with failOpen the server is not limitedany failure in 10 minutes
Security (critical)Repeated failed console logins, or a change of settings5 failures over 5 minutes
Errors in the logs (warning)Many ERROR lines in the BoxLang logs10 a minute over 5 minutes

You can change the severity, every limit, and how often a mail repeats while the alert stays true (default 60 minutes).

4. Add channels

A channel is a place that is not a mailbox: a Slack channel, a Microsoft Teams channel, a Telegram chat or your own webhook. Open Settings, Notifications, Channels and press + Add channel.

The Channels tab: a list with a Send test and an Edit button for each channel, and the form of one channel

Pick the type. Each tab has the same three parts: what you need, how to set it up, what a message contains. Text from your servers is cleaned of secrets and escaped for each format, so a message cannot mention a Slack channel, make a link or carry a script.

What you need

An incoming webhook address on hooks.slack.com.

How to set it up

  1. Follow Alerts in Slack.
  2. Add the channel and paste the webhook address as its secret (see the settings below).
  3. Press Send test.

What a message contains

  • The message kinds in What a channel gets.
  • At most 40 KB. A longer text is cut with three dots.
  • Text is escaped for Slack: &, <, >.

What you need

A Workflows webhook address that posts an Adaptive Card. The host must be *.logic.azure.com, *.webhook.office.com or *.powerplatform.com.

How to set it up

  1. Follow Alerts in Microsoft Teams.
  2. Add the channel and paste the webhook address as its secret (see the settings below).
  3. Press Send test.

What a message contains

  • The message kinds in What a channel gets.
  • At most 28 KB. A longer text is cut with three dots.
  • Text is escaped for Teams: Markdown characters and <, >.

What you need

A bot token from BotFather and a chat id. The host is api.telegram.org.

How to set it up

  1. Follow Alerts in Telegram.
  2. Add the channel with the chat id and paste the bot token as its secret (see the settings below).
  3. Press Send test.

What a message contains

  • The message kinds in What a channel gets.
  • At most 4096 characters. A longer text is cut with three dots.
  • Text is escaped for Telegram HTML: &, <, >.

What you need

An https address of yours; JSON signed with a key. Any public host is allowed.

How to set it up

  1. Follow Alerts to a webhook.
  2. Add the channel and paste the signing key as its secret (see the settings below).
  3. Press Send test.

What a message contains

  • The message kinds in What a channel gets.
  • At most 64 KB. A longer text is cut with three dots.
  • The message is JSON.

For each channel you choose:

  • a name (1 to 60 characters) and whether it is on. A channel that is off sends nothing, but Send test still works,
  • the alerts that go there: every alert, or the ones you tick (none is allowed, for a channel that only gets reports),
  • the lowest severity: warnings and critical, or critical only,
  • the reports that go there: daily, weekly, monthly. None by default,
  • the secret: the webhook address, the bot token, or the signing key of a webhook. It is write only: you paste it, BxLens keeps it encrypted in the Secret Store, and nothing ever shows it again. The list shows set, signed and the host of the address, never the address. To change it, paste a new one; to keep it, leave the field empty.

At most 20 channels. The settings of a channel (name, type, rules, severity, chat id, switch) are saved with the other notification settings and reach every server. The secret is on the volume of the Secret Store: servers that should send must share secrets.dir (and the key), as the guide of the store explains, because the elected sender is the one that posts.

What a channel gets

The same elected sender that sends the mail also serves the channels, from the same alerts and the same rules (the switch, the pause, the repeat time of each alert, maxPerHour). A channel gets one message for each alert:

MessageWhen
FiringAn alert that this channel has not been told yet is true.
ReminderThe alert is still true after the repeat time of its rule.
ResolvedThe alert stopped, or you took it off the channel. It says how long it lasted.
ReportThe daily, weekly or monthly report, for the channels that list it. The title, the key numbers and a link.

A message goes to a channel when the channel is on, the alert is one of its alerts (or it has all alerts), and the severity reaches its lowest severity. A message has a link, Open in BxLens, only when the setting console.publicUrl is set.

The last result of each channel (when, and the answer in plain words) is on the list. A failure that cannot be fixed by waiting (a 404, a removed webhook, a token that was revoked) says so, and the channel keeps trying every five minutes until you fix it or switch it off.

When a channel is down: retries and limits
  • What a channel was told is kept per channel and per alert and saved with the state of the alerts.
  • A channel that is down is tried again after five minutes, on its own: the mail and the other channels, which got the alert, are not sent it again.
  • At most ten messages go to one channel in a round and at most maxPerHour in an hour, the rest goes in the next rounds; critical alerts go first.
  • A round stops sending after 90 seconds, and no network call waits under a lock that the page takes.
  • A channel that is switched off forgets what it was told, and tells you again what is firing when it is switched back on.

Safe by design

Secrets

Addresses, tokens and keys live only in the Secret Store. They are not in the notification settings, the audit log, a log line, an error message, Lensy, the diagnostic bundle or any answer of the console. An error from the other side is cleaned of the address and the token before you see it.

Where messages may go
  • The address must be https:// (there is no exception for localhost) and must not hold a user name or password.
  • It must be on the host of its type: Slack hooks.slack.com; Teams *.logic.azure.com, *.webhook.office.com or *.powerplatform.com; Telegram api.telegram.org; a webhook any public host.
  • Every address the host resolves to must be public: private, loopback, link local (the cloud metadata address), unique local, carrier grade NAT, NAT64 and the other forms that carry an IPv4 address are refused.
  • This is checked when you save and again before every send. Redirects are never followed.
  • If you go through a proxy of your own, add its host to notifications.channelHosts in boxlang.json (Slack and Teams only).
  • The small window between a check and the connection (a DNS answer that changes within milliseconds) is documented in Security.
Limits

5 seconds to connect, 10 seconds for the answer, at most 64 KB of the answer read. Message size limits are on the tab of each channel type.

Admin only and test
  • Admin only. The Channels tab and its routes are for admins, need the CSRF token and BoxLang+, and are refused when console.readOnly is on. Every change is audited as channel.change and every test as channel.test, with the id and the type of the channel and nothing else.
  • Test. Send test posts a message that says TEST. It is limited like the test mail: five seconds between two, 20 an hour.

5. See the mails before they go out: Mail previews

Settings, Notifications, Mail previews shows the exact mail of each of the 21 alerts and of the daily, weekly and monthly report.

Mail previews

  • The list on the left has the alerts (with their severity) and the reports. An alert is always shown with sample numbers (the page says "Sample data"). A report is built from your saved data when there is some, and from sample data otherwise.
  • Firing, Reminder, Resolved switch the state of an alert. HTML and Plain text switch the two parts of the mail. Dark mode turns the dark palette on or off in the preview, whatever your system prefers.
  • The HTML is shown in a frame with no scripts and no network (sandbox), and the page only puts it into the frame. The subject is shown under it.
Send me this

Send me this sends the mail to one address that you type, and only to that one, never to the recipients. The subject and the body say TEST. It is limited like the test mail (5 seconds between two, 20 an hour, shared with it), needs the CSRF token and BoxLang+, is refused when console.readOnly is on, and is audited as mail.preview.send with the alert or report, its state and the address. There is no "send to all recipients" here.

How the mails are sent

  • Every server evaluates its own alerts and lists them in its health snapshot.
  • An alert sends a firing mail once, a reminder every repeat time while it stays true, and a resolved mail when it stops.
  • One mail per person carries every event of that minute that the person asked for, so a bad minute is one mail and not forty.
  • Pause 1 hour, Pause 1 day and the main switch stop everything at once.
  • At most maxPerHour mails an hour (30). A round stops sending after 90 seconds and the rest goes in the next one, and the page never waits for the mail server.
Which server sends

One server sends for the whole cluster: the one with the lowest id among the servers that wrote in the last two and a half minutes and that have the notifications (a server without BoxLang+ lists no alerts and never sends). All servers work out the same answer from the store, so nobody has to ask. The page says which one sends.

Retries and ordering

What was announced is kept per person. A person whose mail cannot be sent is tried again after five minutes, alone: the others, who got it, are not sent it again. The same holds when the limit ends a round early. People with news go before people who only get a reminder.

How an alert is identified

An alert is known by its rule, its server and its subject (a volume, an executor, a task, a host). The subject never carries a number that moves, so an alert does not end and start again when its figures change. Notes (the info items of the HTTP, Mail and AI pages) never raise an alert.

Where settings and state are kept
  • The settings are saved in the settings file (console.overridesFile) and, with the disk store on, also in the store. Servers that share the file or the store get a change made on one of them. Without a file and without the store they live in memory on this server only, and the page says so. Everything on this page can also be set in boxlang.json, see Seed the notification settings.
  • What was announced is saved in the store (alert-state). If the sender changes (a restart, or another server takes over) it starts from that state and announces nothing again. Without the store, the alerts that are still true are announced once more.
What a mail looks like

A mail has a text part first and an HTML part second, with the logo attached to it, a button that opens the console when console.publicUrl is set (see Email reports for what the mails look like, the dark mode and the plain text), and the headers Auto-Submitted and X-Auto-Response-Suppress, so autoresponders leave it alone. The text of an alert comes from Lens (numbers, names of volumes, executors and tasks, the message of a new error) and goes through the same redaction as the pages. Nothing is ever put into the HTML without escaping.

Set it up with Lensy

Ask Lensy in plain words, for example:

  • "Email ops@acme.com when any disk is above 85 percent."
  • "Tell me every morning at 8 how the servers did." (a recipient, the daily report, a time)
  • "Alert the team when mail bounces more than ten times an hour."
  • "Pause notifications for two hours."

Lensy first reads what is set (alertRules, notifications), then proposes one change per step: alertRuleSet (an alert and its limits), recipientSet, recipientRemove, reportSchedule, notificationsSet. Each one shows an approval card that says in words what it will do. For a recipient the card names the address and reminds you that anyone who can read that mailbox will see what is sent there. Nothing is saved until the admin clicks Approve, and a denied card changes nothing.

For channels Lensy has two tools: channels (names, types, switches, alerts, last result; never an address, a token or a key) and channelTest (send the test message to a channel you name, after your approval). It cannot create a channel, change where one posts, or read or change a secret.

What Lensy cannot do

Lensy can pick only an alert from the catalog above and only limits inside the allowed range. It cannot change the SMTP server, user or password, so it can never send your alerts somewhere else, and it has no tool to write free text into a mail. It is told to use only an address that you gave it in the chat. These tools are for the admin role, BoxLang+, and are refused when the console is read only or ai.actions is off. See the tool list.

Safety

  • Admin only. A viewer gets 403 and never sees the tab.
  • Every change is audited (notifications.*), without the password. Channels are audited as channel.change and channel.test with the id and type only.
  • Refused when console.readOnly is on (the test mail is not a change).
  • The SMTP address is chosen by an admin. Lens connects to it and nowhere else. Channels connect only to the https addresses the admin saved, after the checks above.

Without BoxLang+

Locked on Free

The tab shows what it offers and a BoxLang+ note, and the Channels tab is locked the same way. The server answers 403 for every route, including notifications/channels.

Edit this page Download Markdown Last updated Nov 26, 2026, 8:34:30 AM Report an issue