In this article we will discuss how to integrate Slack with Preset in order to receive alerts & reports to a Slack channel.
- Steps 1 - 6: How to configure Slack
- Steps 7 - 8: Completing the integration of Slack with Preset
Step 1: Create a Slack Channel
In your Slack, select Create a channel to create a channel to receive Alerts & Reports.
Let's call our channel slackalertsandreports.
Step 2: Create an App in Slack
In a separate browser tab, navigate to the Slack API page and then select Create an app.
The Create an app panel appears. Select From scratch.
The Name app & choose workspace panel appears.
In the App Name field, enter a name for your new app — we called ours Preset Alerts and Reports.
In the Pick a workspace to develop your app in field, we selected our workspace — in this case, Acme Co.
Select Create App.
Step 3: Create Token and Define Scopes
Create App-Level Token and Define Scope
Now that your app is created, we will create app-level tokens.
Navigate to the App-Level Tokens section and then select Generate Token and Scopes.
In the Token Name field, enter a memorable name for the token — we've named ours presetARtoken.
In the Scope selection field, select the connections:write and authorizations:read scopes.
Your token's details will appear for review. Select Done.
Define Bot Token Scopes
In the Main Menu, select OAuth and Permissions.
In the Bot Token Scopes section, select Add an OAuth Scope.
Add the chat:write and files:write scopes.
Optionally, you can also add the channels:manage scope if you want to send reports to any of your Slack channels instead of just the one you created in Step 1.
Step 4: Install App to Workspace
Now let's go ahead and install your app to the Slack workspace. In the Main Menu, navigate back to the Basic Information screen.
In the Install your app section, select Install to Workspace.
Slack will ask permission for the app to access the workspace. Select Allow.
Step 5: Copy Bot Token
Return to the Slack API environment and, in the Main Menu, select OAuth and Permissions.
In the OAuth Tokens for Your Workspace section, in the Bot User OAuth Token field, select Copy. This will copy the token to your system's clipboard.
This is the token that will be provided to Preset in order to create the integration.
Step 6: Add App to Slack Channel
Navigate back to the channel you created earlier in Step 1 and, in the message field, enter: /invite @appname.
In the graphic below, we just typed "/invite @" and then selected the app name, Preset Alerts and Reports, from the list of available options.
You will receive a confirmation of the app bot invitation.
Step 7: Connect Slack to Preset
In Preset, navigate to the Preset Manager environment.
In your Preset workspace of choice, hover your cursor over the vertical ellipsis (3 dots) icon and then select Connect to Slack.
The Connect to Slack panel appears.
In the text-entry field, paste the bot token that you copied in Step 5 into the field.
If successful, a notification message appears informing you of the workspace change.
Step 8: Selecting the Slack Notification Method
Great work! Preset and Slack are now integrated and you can deliver alerts and/or reports directly to a Slack channel.
To use this integration, in the Notifcation method section of the alert or report creation screen, select Slack as your delivery method, as shown below:
In the SLACK text-entry field, enter the name of the Slack channel you created in Step 1. In the example below, we entered slackalertsandreports.
Here is an example of a report with Slack selected as the delivery method.
When the alert or report is triggered, then the results will be delivered to the specified Slack channel.
Here is what the above report looks like when delivered to the Slack channel: