Skip to content

Send alerts to Slack

View as Markdown

Create a monitoring integration that posts alert notifications to a Slack channel. You can connect with an Incoming Webhook URL or with a bot token, and you choose one when you create the integration.

Method Use when You need
Webhook You want a fast setup for a single channel. An Incoming Webhook URL.
Token You need several channels or tighter control of the app. A bot token and a Channel ID.

The webhook method is the simpler start. Choose the token method for several channels, for control from your own code, or for tighter control over the app’s permissions and the bot’s identity. The steps in Slack follow Slack’s own screens, so they can change. If a screen looks different, check Slack’s documentation.

You need a TIR project and a role with Create permission on monitoring integrations. You need a Slack workspace where you can create apps.

  1. If you need a workspace, go to slack.com/get-started, select Create a new workspace, enter and verify your email, and name the workspace. Create a channel for alerts, for example alerts-test.
  2. Go to api.slack.com/apps and select Create New App, then From scratch. Name the app, for example Alert System, pick your workspace, and select Create App.
  3. In the app, open Incoming Webhooks and turn on Activate Incoming Webhooks.
  4. Select Add New Webhook to Workspace, choose the channel for alerts, and select Allow.
  5. Copy the URL. It looks like https://hooks.slack.com/services/T.../B.../.... It is the credential you give TIR.

The URL belongs to the channel you chose. If you create a new URL in Slack, the old one stops working, so paste the new URL into the integration.

  1. In Alert Management, select Manage Monitoring Integrations, then Create Monitoring Integration.
  2. Enter an Integration name and, if you like, a Description.
  3. Set Contact point type to Slack.
  4. Under Select Slack Channel, choose Webhook.
  5. Paste the URL into Webhook URL. It must start with https://hooks.slack.com/services/.
  6. Select Test URL before you save. A sample message arrives in your channel and TIR reports success. If no message arrives, check that the URL is complete and the channel exists.
  7. Select Create integration.
  1. Go to api.slack.com/apps and open your app. If you need one, do steps 1 and 2 of the webhook method.
  2. Open OAuth & Permissions. Under Bot Token Scopes, select Add an OAuth Scope and add chat:write. Use chat:write, not chat:write.public. The first lets the bot post only in channels it has joined. The second lets it post in every public channel without joining, which is more access than alerts need.
  3. Open Install App and select Allow to install the app in your workspace.
  4. Copy the Bot User OAuth Token. It starts with xoxb-. Store it securely: it gives access to your Slack workspace as the bot.
  5. In the Slack channel for alerts, run /invite @<your app name>, for example /invite @Alert System. The bot posts only in channels it has joined, public or private, so alert messages arrive only after this step.
  6. Open the channel’s name at the top, scroll to the bottom of the details, and copy the Channel ID. It looks like C12345678. TIR needs the ID, not the channel name.
  1. In Alert Management, select Manage Monitoring Integrations, then Create Monitoring Integration.
  2. Enter an Integration name and, if you like, a Description.
  3. Set Contact point type to Slack, and under Select Slack Channel choose Token.
  4. Enter the Bot token. It must start with xoxb-.
  5. Enter the Channel ID. It starts with C, G, or D, followed by at least eight capital letters or digits.
  6. Select Test Token before you save. A sample message arrives in your channel and TIR reports success.
  7. Select Create integration.

The integration is in Manage Monitoring Integrations. After you create an alert with it and attach the alert to a running resource, every notification for that alert goes to your Slack channel. Each message is titled [FIRING:1] or [RESOLVED:1], followed by the alert and project names. See What a notification contains.

TIR reports a Slack error only when you run a test, so a live alert can fail silently. If an alert goes missing, run the test again and see Troubleshooting Slack alerts.