Slack for Workflows

Your Dynatrace environment can integrate with a Slack workspace using Slack for Workflows 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

  1. Install the latest version of the Slack app.
  2. Allow outbound connections to files.slack.com (in addition to the already existing slack.com). For more information, see Allow Slack for outbound connections.
  3. Add the files:read permission to your Slack app.
    1. Go to your Slack app in the Slack API.
    2. Select OAuth & Permissions.
    3. Navigate to Scopes and select Add an OAuth Scope.
    4. Enter files:read.
    5. Reinstall your Slack app.
Bot token

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 Slack for Workflows from Dynatrace Hub.

  1. In Dynatrace Hub, select Slack for Workflows.
  2. Select Install.

After that, you need to perform some initial steps to set up the connection between Slack and your Dynatrace environment.

Step 1 Allow Slack for outbound connections

  1. Go to Settings and select Connections > Outbound and inbound > Limit outbound connections. This opens the Settings Classic page.
  2. Select Add item then add slack.com andfiles.slack.com
  3. Select Save changes.

This way you can granularly control the web services your Dynatrace environment can connect to.

Step 2 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

  1. Go to Workflows and select Settings > Authorization settings.
  2. 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.

Step 3 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.

  1. Go to Slack API and select Create an App.

  2. In the Create an app window, select From an app manifest.

  3. In the Pick a workspace to develop your app window, select the Slack workspace you want to connect to and select Next.

  4. 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: false
    oauth_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:write
    settings:
    org_deploy_enabled: false
    socket_mode_enabled: false
    token_rotation_enabled: false

Step 4 Authorize connection to Slack

Your Dynatrace Slack app requires an OAuth token to authorize sending messages to Slack.

  1. Go to Slack API, select Your Apps in the upper-right corner, and select the app you just created.
  2. 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.
  3. Copy the OAuth token.
  4. Return to Dynatrace, go to Settings and select Connections > Connectors > Slack.
  5. Select Add Connection, give your Slack connection a name and paste the OAuth token in Bot token.
  6. Select Create.

Use Workflows with Slack

  1. Go to Workflows Workflows and select Add to create a new workflow.
  2. In the Choose trigger panel, select the trigger best suited to your needs.
  3. On the trigger node, select Add to browse available actions.
  4. In the Choose action panel, search for slack and select Send message.
  5. Select a pre-configured Slack connection.
  6. Select a channel to send your message to.
  7. Provide a message body. Format your message using Slack Markdown. It is also possible to use workflow expressions as input.
  8. To test your workflow, select Run.

Troubleshooting

The following are solutions to problems some people had with Slack integration.