Configuring Slack applications for integration

IBM Cloud Pak® for Watson AIOps supports a direct connection to your enterprise Slack installation.

The following requirements are necessary to setting up a Slack connection:

Prerequisites

Creating your Slack app

Complete the following steps to configure your Slack connection.

Note: Be careful which workspace you use. You must either be a workspace administrator, or wait for approval from the workspace administrator, when you interact with some of Slack's administrative settings.

Important: IBM Cloud Pak for Watson AIOps requires two Slack channels, one for proactive notifications and one for reactive notifications. You must configure two channels, one for each purpose.

  1. Identify the Slack channel that you want to connect:

    1. Create or use an existing Slack channel.
    2. Retrieve the channel ID. Right-click the channel name, then click Copy Link to get the web URL link. The last part of the link is the channel ID, starting with C for public channels or G for private channels.
  2. Create a Slack app on https://api.slack.com/apps

    1. Click Create New App.
    2. Enter an App Name, and specify the workspace that you want to connect the app to, then click Create App.

Configuring your Slack app

  1. After you create your Slack app, from the Slack API page, click the name of the app that you created, then click OAuth & Permissions.

  2. On the OAuth & Permissions page, select OAuth Tokens & Redirect URLs.

    1. Click Install App to Workspace.

      Note: This action requires administrator approval. If you are an administrator of the workspace, you can approve it yourself. If you are not an administrator, click Request to Install App to Workspace and wait for the approval.

    2. Review the information and click Allow. You must reinstall your app every time you change the scope.

    3. Record the Bot User OAuth Access Token for use in step 5.
  3. On the OAuth & Permissions page, in the Scopes section, add the following Bot Token Scopes:

  4. On the Basic Information page, select App Credentials and record the Signing Secret value.

  5. Before you proceed further, you must create the Slack ops integration in IBM Cloud Pak for Watson AIOps:

    1. Create your Slack integration. For more information, see Creating Slack integrations. You must have the following information to complete your Slack integration:

      • Proactive and reactive channel IDs from step 1.b.
      • Bot User OAuth Access Token from step 2.c.
      • Signing Secret value from step 4.
  6. Obtain the URL of the IBM Cloud Pak for Watson AIOps instance:

    1. From the IBM Cloud Pak for Watson AIOps console, click the navigation menu (four horizontal bars), then click Define > Data and tool integrations.
    2. On the Slack tile, click <#> integrations.

      Note: This step assumes that you created the integration. Since you already created a Slack integration, the label that you click reads 1 integration.

    3. On the Slack instances page, copy the request URL from the Details column. This URL is required to enable two-way communication between Slack and IBM Cloud Pak for Watson AIOps.

    Note: If you use a tunnel to expose the server for the Slack connection, you must replace the host:port with the forwarding address of the tunnel.

  7. From the Slack app page, on the Event Subscriptions page, click Enable Events:

    1. Enter the Request URL obtained in the previous step. Slack automatically verifies the URL when you add it.
    2. Add app_mention and member_joined_channel bot events to the Subscribe to bot events section.
  8. On the Interactivity & Shortcuts page, enable Interactivity and enter the Request URL that you obtained in Step 6. Every message interaction (button press or drop-down menu select) now sends a request to this URL.

  9. Configure the Welcome slash command. With this command, you can trigger the welcome message again if you closed it.

    1. Under Features, click Slash Commands, then click Create New Command to create a new slash command.
    2. Enter the following values:

      • The command must be /welcome.
      • The request URL is the same URL that you obtained in Step 6.
      • The short description is Welcome to IBM Cloud Pak for Watson AIOps.

      Note: For the changes to take effect, you might need to run the following commands:

         oc project <NAMESPACE>
         oc set env deployment/$(oc get deploy -l app.kubernetes.io/component=chatops-slack-integrator -o jsonpath='{.items[*].metadata.name }') SLACK_WELCOME_COMMAND_NAME=/welcome
      

      Where is the namespace where your IBM Cloud Pak for Watson AIOps pods are installed, for example, cp4waiops.

  10. After the application is configured, it must be reinstalled, as several permissions changed. Go to Install App and click Reinstall App.

    Note: Reinstalling the app requires another approval of the application.

  11. Add the Slack application to each channel that it is associated with. In Slack, open the details of the Slack channel, then click More > Add Apps.

After you add the application, it posts a welcome message. If you see the welcome message, the connection is made successfully.

You can now use Slack as your ChatOps interface. For more information about using the ChatOps interface, see ChatOps insight management.