Send Schedule Start, Stop and Failure Alerts to Slack
One Slack app with a bot token, one ZopNight channel per Slack channel, and a deliberate choice of which events are worth a message.
Schedule notifications are useful in inverse proportion to how many there are. A channel that gets a message for every one of 200 nightly stops will be muted within a week, and then the one failure that matters goes unseen. This guide connects a Slack app to ZopNight and then picks events so the channel stays readable.
1. Create the Slack app and collect three values
ZopNight posts to Slack as a bot, so it needs a Slack app with a bot token.
- Go to the Slack apps page (api.slack.com/apps), choose Create New App, then From scratch. Give it a name such as “Cloud schedules” and pick the workspace.
- Open OAuth & Permissions and, under Bot Token Scopes, add
chat:writeandchat:write.public. - Click Install to Workspace, select Authorize, and copy the Bot User OAuth Token. It starts with
xoxb-. - In Slack, open the target channel’s details and copy the Channel ID from the bottom of the panel. For a private channel, invite the app to the channel first.
- Back in the app settings, open Basic Information and copy the Signing Secret under App Credentials.
Treat the token and the signing secret as secrets. Each ZopNight Slack channel posts to one Slack channel, so add one per destination.
2. Test it before connecting anything
export SLACK_BOT_TOKEN="<paste the Bot User OAuth Token>"curl -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" \ -H 'Content-type: application/json; charset=utf-8' \ --data '{"channel":"C0123456789","text":"Bot test from the platform team"}' \ https://slack.com/api/chat.postMessageA working token answers with "ok":true and the message appears in the channel. An error such as channel_not_found or not_in_channel means the channel ID is wrong or the app cannot post there; invalid_auth means the token is wrong.
3. Add the channel in ZopNight
In ZopNight, open Settings → Notifications, click + Add Channel, pick Slack as the platform, and paste the Bot Token, Channel ID and Signing Secret. Channels can be Slack, Google Chat, Microsoft Teams or a generic webhook, so an ops channel in Teams and a dev channel in Slack can sit side by side. A default channel applies organisation-wide, and an individual resource or resource group can route to a different channel, which is how each team gets only its own environments.
4. Choose the events
Scheduling events are split by trigger, so you can subscribe to them separately:
| Event | Worth a real-time message? |
|---|---|
| Resource started or stopped by a schedule | Usually not; high volume on a large estate |
| Resource started or stopped manually | Yes for shared environments, it shows who went outside the schedule |
| Group started or stopped manually | Yes |
| Action failed, retries exhausted | Yes, always |
| Override set, cleared, expired | Yes, so an extension is a visible team decision |
A sensible first setup subscribes the team channel to failures, exhausted retries, overrides and manual actions, and leaves routine scheduled starts and stops unsubscribed. Messages carry a severity (critical, warning or info), which helps if you later split critical items into a separate channel.
The same channel can take other event families: budget warnings and overruns, cost anomalies by severity, remediation approvals and results, finished exports, and newly denied cloud permissions on an account.
5. Verify end to end
Trigger a manual stop on a test resource from ZopNight and confirm the manual-stop message lands in the channel. Then start it again. If nothing arrives, re-run the test from step 2 to separate a Slack problem from a subscription problem.
Maintaining it
If the bot token or signing secret is ever pasted somewhere public, treat it as compromised: rotate it in the Slack app and update the ZopNight channel with the new value. For deciding which failures need a human, see auditing whether schedules actually ran; for the scheduling model itself, cloud scheduling.