Slack for Workflows
Your Dynatrace environment can integrate with a Slack workspace using Slack for Workflows . You can automate sending messages to Slack based on the events and schedules defined for your workflow.
API endpoint change
Slack is sunsetting the file upload
endpoint. If you installed and configured Slack for Workflows after June 10, 2024, and followed all the steps described in Set up Slack integration, no additional action is needed.
If you have installed Slack for Workflows before June 10, 2024, you must adapt to the change
- Install the latest version of the Slack app.
- Allow outbound connections to
files.slack.com
(in addition to the already existingslack.com
). For more information, see Allow Slack for outbound connections. - Add the
files:read
permission to your Slack app.- Go to your Slack app in the Slack API.
- Select OAuth & Permissions.
- Navigate to Scopes and select Add an OAuth Scope.
- Enter
files:read
. - Reinstall your Slack app.
The bot token you're using for the connection should not be affected by this change.
Set up Slack integration
To use Slack workflow actions, you first need to install Slack for Workflows from Dynatrace Hub.
- In Dynatrace Hub, select Slack for Workflows.
- Select Install.
After that, you need to perform some initial steps to set up the connection between Slack and your Dynatrace environment.
Allow Slack for outbound connections
Grant permissions to Workflows
Create Slack app
Authorize connection to Slack
Allow Slack for outbound connections
- Go to Settings and select Connections > Outbound and inbound > Limit outbound connections. This opens the Settings Classic page.
- Select Add item then add
slack.com
andfiles.slack.com
- Select Save changes.
This way you can granularly control the web services your Dynatrace environment can connect to.
Grant permissions to Workflows
Some permissions are required by Workflows to run actions on your behalf. Other permissions are required by actions that come bundled with the Slack for Workflows itself.
To fine-tune permissions granted to Workflows
- Go to Workflows and select Settings > Authorization settings.
- Select the following permissions besides the general Workflows permission.
app-settings:objects:read
app-settings:objects:write
state:app-states:read
state:app-states:write
state:app-states:delete
state:user-app-states:read
state:user-app-states:write
state:user-app-states:delete
For more on general Workflows user permissions, see User permissions for workflows.
Create Slack app
For Slack workflow actions to interact with your Slack workspace, you first need to create a Slack App for Dynatrace and authorize its connection to Slack.
-
Go to Slack API and select Create an App.
-
In the Create an app window, select From an app manifest.
-
In the Pick a workspace to develop your app window, select the Slack workspace you want to connect to and select Next.
-
In the Enter app manifest below window, paste the manifest YAML provided below into the YAML tab. Replace
<app-name>
and<bot-name>
with values of your choice (for example,Dynatrace
). For more information on the manifest YAML, see Slack documentation.display_information:name: <app-name>features:bot_user:display_name: <bot-name>always_online: falseoauth_config:scopes:bot:- channels:history- channels:join- channels:read- chat:write- chat:write.public- files:read- files:write- groups:history- groups:read- im:history- im:read- mpim:history- mpim:read- reactions:read- reactions:writesettings:org_deploy_enabled: falsesocket_mode_enabled: falsetoken_rotation_enabled: false
Authorize connection to Slack
Your Dynatrace Slack app requires an OAuth token to authorize sending messages to Slack.
- Go to Slack API, select Your Apps in the upper-right corner, and select the app you just created.
- Go to Features > OAuth & Permissions. If you're a workspace admin, you'll be able to copy the OAuth token for your workspace. Otherwise, you'll need to Request to Install it. After your app is enabled by your admin, you'll get access to the OAuth token as well.
- Copy the OAuth token.
- Return to Dynatrace, go to Settings and select Connections > Connectors > Slack.
- Select Connection, give your Slack connection a name and paste the OAuth token in Bot token.
- Select Create.
Use Workflows with Slack
- Go to Workflows and select to create a new workflow.
- In the Choose trigger panel, select the trigger best suited to your needs.
- On the trigger node, select to browse available actions.
- In the Choose action panel, search for
slack
and select Send message. - Select a pre-configured Slack connection.
- Select a channel to send your message to.
- Provide a message body. Format your message using Slack Markdown. It is also possible to use workflow expressions as input.
- To test your workflow, select Run.
Troubleshooting
The following are solutions to problems some people had with Slack integration.