Slack Connector

  • Latest Dynatrace
  • Reference
  • 5min

Your Dynatrace environment can integrate with a Slack workspace using Slack Connector Slack Connector. 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 Connector 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 Connector before June 10, 2024, you must adapt to the change

  1. Install the latest version of Slack Connector.

  2. Add a New host pattern in External requests.

    External requests enable outbound network connections from your Dynatrace environment to external services. They allow you to control access to public endpoints from the AppEngine with app functions and functions in Dashboards, Notebooks, and Automations.

    1. Go to Settings and select General > Environment management, External Requests.

    2. Select New host pattern.

    3. Add the domain names.

    4. Select Add.

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

    You need to add these domain names slack.com and files.slack.com.

  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

Step 1 Allow External Requests

External requests enable outbound network connections from your Dynatrace environment to external services. They allow you to control access to public endpoints from the AppEngine with app functions and functions in Dashboards, Notebooks, and Automations.

  1. Go to Settings and select General > Environment management, External Requests.

  2. Select New host pattern.

  3. Add the domain names.

  4. Select Add.

This way you can granularly control the web services your functions 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 Slack Connector 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 Connector 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 Connector 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.