Send cron job alerts to Slack and other channels
Get a Slack message, a PagerDuty incident or a text when a cron job misses its run or fails: what each channel needs and what it sends.
To send cron job alerts to Slack, create a 1Monitor notification channel of type Slack from an incoming webhook URL, and assign it to the monitors whose alerts belong there. A curl to Slack at the end of the cron line posts nothing when the job never starts, so the missed run is the one you never hear about. We open the alert when the ping does not arrive. The other channel types work the same way, each from an email address, a URL, an integration key, a bot token and chat ID, or a phone number.
Each monitor picks its own channels, so the job that sends customer invoices can page whoever is on call while the marketing export posts to a low-priority Slack channel. You create channels in the app under Account › Channels. Every plan includes every type except SMS, which needs a Standard or higher plan. The plan sets how many channels the account can have: 2 on Free, 5 on Standard, 20 on Pro and 50 on Max.
Send alerts to Slack
In your Slack app’s settings, add an incoming webhook for the Slack channel that should get alerts. Paste its URL into a new 1Monitor channel of type Slack. We accept only URLs that start with https://hooks.slack.com/services/.
One webhook posts to one Slack channel, so a second Slack channel needs a second 1Monitor channel. Then assign the 1Monitor channel to the monitors whose alerts should go there, and use Send test to see the first message arrive.
Send alerts to Microsoft Teams
A 1Monitor channel of type Microsoft Teams posts through a Power Automate workflow, not an Office 365 connector. In Teams, open the Teams channel’s … › Workflows and add Post to a channel when a webhook request is received. Finish the wizard and paste the HTTP POST URL it gives you. The URL must use https, and its host must end in logic.azure.com or powerplatform.com, or the .us or .cn version of either.
Power Automate accepts the request before it runs the flow. A successful test therefore means the request was accepted. Check that the test card appeared in Teams.
Send alerts to Discord
In Discord, open Server settings › Integrations › Webhooks and create a webhook for the Discord channel that should get alerts. Paste its URL into a new 1Monitor channel of type Discord. The URL starts with https://discord.com/api/webhooks/. The older discordapp.com host and the ptb and canary hosts work too.
Send alerts to Google Chat
In the Google Chat space, open Apps & integrations › Webhooks and add a webhook. Paste its URL into a new 1Monitor channel of type Google Chat. The URL starts with https://chat.googleapis.com/v1/spaces/. Google Chat lets you add webhooks only to named spaces.
Send alerts to Telegram
A 1Monitor channel of type Telegram posts through a bot you create, so it needs a bot token and a chat ID instead of a URL:
- Send
/newbotto @BotFather and copy the token. It looks like123456789:AA…. - Add the bot to the Telegram chat that should get alerts. In a group it needs to be a member, and in a Telegram channel an administrator.
- Get the chat ID by messaging @userinfobot from that chat. Group and channel IDs start with a minus sign, such as
-1001234567890.
Send alerts to PagerDuty
A 1Monitor channel of type PagerDuty sends events to the PagerDuty Events API v2. In PagerDuty, add an Events API v2 integration to the service that should be paged, and paste its integration key, which is 32 letters and digits. Pick the region your PagerDuty account is in, US or EU.
Each alert is one PagerDuty incident. Every event about it carries the same dedup key, 1monitor:alert: followed by the alert’s UUID:
- The alert opening triggers the incident. A missed-ping or failed-run alert has severity
critical, and a run-duration or unexpected-run alert haswarning. - Reminders, an expired acknowledgment or snooze, and flapping send another trigger with the same key, so PagerDuty adds them to the open incident instead of creating a new one.
- When the alert resolves, including when its monitor is paused, we send a resolve and the incident resolves in PagerDuty.
The event’s custom_details carry the monitor and alert IDs and a link to the alert. For a missed-ping or failed-run alert they add details such as the time of the last ping, up to 1,000 characters of the job’s output with its exit code, a failed output check, the number of failed runs in a row and the version the job was running, with the one it replaced. For a run-duration or unexpected-run alert they carry the run timings or the unexpected runs instead of the output.
The event’s links are View alert, View run history on a run-duration or unexpected-run alert, and Open runbook when the monitor has one. Send test triggers an info event and resolves it at once. PagerDuty answers before it checks the key, so a test can pass with a wrong key: check that the test incident appears in PagerDuty. PagerDuty arrived in PagerDuty support and smarter notifications.
Send alerts by SMS
A 1Monitor channel of type SMS texts a mobile number, on Standard and higher plans. The plan includes 5 SMS alerts a month on Standard, 15 on Pro and 50 on Max, and the allowance resets on the 1st of each month (UTC). A test SMS counts against it, but verification codes do not.
Enter the number with its country code. After you save, we text a 6-digit code to the number, and alerts reach it only once you enter that code. The number must be a mobile number in one of these countries: Australia, Austria, Belgium, Bulgaria, Croatia, Cyprus, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Iceland, Ireland, Italy, Latvia, Liechtenstein, Lithuania, Luxembourg, Malta, the Netherlands, New Zealand, Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden, Switzerland and the United Kingdom.
Each text is one SMS of at most 160 characters. It names the monitor, adds the project name when the account has more than one project, says what happened and ends with a short link to the alert:
1Monitor: Customer invoices failed. https://…
Texts go out when an alert opens, on each reminder, when an acknowledgment or snooze ends and when the alert starts flapping. Recoveries and pauses are not texted unless you switch on Also text when resolved on the channel, so they do not use up the allowance. At 80% of the month’s allowance, the account’s owners and admins get one email. Once it is used up, the alert text goes to them by email instead, for up to 10 alerts an hour.
The post SMS alerts for when nobody is watching Slack covers why a text wakes someone at 03:00 when a chat message does not.
Email and webhook
An email channel sends to any address, such as a personal inbox, a team alias or a ticketing system. Its headers are listed in filter alert emails. A webhook channel POSTs a JSON body to your own URL. Every field and the retry rules are in the webhook payload reference.
What a channel receives
A channel gets a message each time an alert on one of its monitors opens or resolves, including when its monitor is paused and the alert resolves for that reason. While a missed-ping or failed-run alert stays open, the channel also gets each escalation reminder, 2 hours apart by default. It gets one when an acknowledgment or a snooze ends with the alert still open, and when the alert starts or stops flapping. SMS sends fewer of these, as described under SMS.
What a chat message contains
Slack, Microsoft Teams, Discord, Telegram and Google Chat get the same message, each in its own format. Slack gets blocks, Teams an adaptive card, Google Chat a card, Discord an embed and Telegram a message with inline buttons. For a failed run of the job that sends customer invoices it opens like this:
🔴 Customer invoices failed
Under that line are the time of the last ping and the time the alert opened. For a missed ping, the second line is the time the ping was expected by instead.
When the account has more than one project, a line names the project. Then comes the last output the job sent with its ping, cut to 700 characters, or 1,000 in Teams. The output is escaped, so a stack trace cannot change how the message looks, and Slack, Discord and Telegram show it as a code block.
The links are View alert and, while a missed-ping or failed-run alert is open, Acknowledge alert and Snooze. A monitor with a runbook link adds Open runbook. A run-duration alert or an unexpected-run alert links View runs instead of the acknowledge and snooze links. Discord, Telegram, Google Chat and Teams arrived in the release alerts in Discord, Telegram, Google Chat and Teams.
Check a channel before you rely on it
Every channel has a Send test button. Use it after you create the channel, because a wrong URL or token otherwise shows up the first time a job fails. Each notification to a channel other than email records whether it was delivered, and a channel whose deliveries fail shows the last error on its status.
Slack, Discord, Google Chat, Telegram and webhooks answer with an error for a wrong target. Email, Microsoft Teams and PagerDuty confirm only that they accepted the message, so look for the test message on the other side. The SMS gateway reports a failed delivery a little later, and the channel’s status then shows it.
To create channels from a script instead of the app, use the channel endpoints of the REST API, on Standard and higher plans.
Something missing from this page?
Tell us