How to set up Slack alerts

Creating the Slackbot in the Slack UI

First create your Slack app in the Slack API Control Panel. Log in to your workspace in Slack via a web browser and navigate to the API Control Panel. Now click on the Create an App button.

Next you’ll be prompted for the name of your app and to select a development Slack workspace. For example, name your app MonitorealBot and select a workspace you have admin access to. Once you have done this click on the Create App button.

Once your app is created you’ll be presented with the following default app dashboard. This dashboard is where you manage your app by setting permissions, subscribing to events, installing the app into workspaces, and more.

In order for your app to be able to post messages to a channel you need to grant the app permissions to send messages. To do this, click the Permissions button in the control panel.

When you arrive at the OAuth & Permissions page, scroll down until you find the Scopes section of the page. Then find the Bot Token Scopes subsection in the scope and click on Add an OAuth Scope button.

Click on that button and then type chat:write. Select that permission to add it to your bot. This will allow the app to post messages to channels that it can access. Also, add the following scopes: files:write im:history users:read

Now that you’ve added the appropriate permission it is time to install your app into your Slack workspace. Scroll back up on the OAuth & Permissions page and click the Install to Workspace button at the top.

Click this button and review the actions that the app can perform in the channel. Once you are satisfied, click the Allow button to finish the installation.

Once the bot is installed you’ll be presented with a Bot User OAuth Token for your app to use when attempting to perform actions in the workspace. Go ahead and copy this token; you’ll need it later.

Click on the Socket Mode link and enable Enable Socket Mode.

No we need to name the token for example My app token and then click Generate

We’ve got the token, now copy it to the buffer memory.

Now on the Event Subscriptions page we need to Enable Events

And then Subscribe to bot events

Click Add Bot User Event, to add event message.im and then click  Save Changes

Select the App Home page and scroll down to Show Tabs and check the Allow users to send Slash commands and messages from the messages tab box

Now we can proceed with setting up Monitoreal to send alerts to Slack. Open Alerts in the WUI of Monitoreal and select and enable Slack. Paste the Bot User OAuth token we copied previously to the Bot token field

Token. Then you need to copy MyApp token and paste it to App token field

Do not forget to click Save and you’re all set.