Create a Slack connector bot

In order for your Slack source to retrieve your workspace and channel data, you must create a Slack bot and install it in your workspace, and then add the bot to the channels that you want to index.

A Slack bot is essentially an app that contains bot token scopes, which give your Slack source permission to access your workspace data. Your Slack source authorizes the Coveo organization to access your workspace items using your Slack bot’s OAuth 2.0 access token.

Note

Org-wide installation of a Slack bot is not supported by the Slack source. If you want to index the content of multiple Slack workspaces, you must create a dedicated Slack source and Slack bot per workspace.

Create and install a Slack bot

Create the Slack bot using a preconfigured manifest file, which includes the required bot token scopes. You can also create the bot manually by adding each scope separately.

Use the manifest file

  1. Access the app management page on the Slack API website.

    Note

    If you’re not logged in to a Slack account, a sign-in message appears on the Slack API website. In this case, log in, select your Slack workspace, and then access the app management page again.

  2. Click Create an App/Create New App.

  3. Click From an app manifest.

  4. Select the workspace in which to install the app.

  5. Click Next.

  6. Replace the default YAML manifest with the following:

    display_information:
      name: Coveo Slack Connector
    features:
      bot_user:
        display_name: Coveo Slack Connector
        always_online: false
    oauth_config:
      scopes:
        bot:
          - channels:history
          - channels:read
          - files:read
          - groups:history
          - groups:read
          - team:read
          - users.profile:read
          - users:read.email
          - users:read
          - usergroups:read
    settings:
      org_deploy_enabled: false
      socket_mode_enabled: false
      token_rotation_enabled: false
    Note

    The app name in the manifest is set to Coveo Slack Connector by default. You can modify the name as required.

  7. Click Next, and then click Create.

  8. Install the app on your workspace.

    Note

    Once you install the app, the Bot User OAuth Token appears. You’ll need the access token when you create your Slack source.

    Copy the access token to a secure location where you can access it when creating your source, or get the access token later.

  9. Add the app to each channel that you want to index.

Create the app manually

  1. Access the app management page on the Slack API website.

    Note

    If you’re not logged in to a Slack account, a sign-in message appears on the Slack API website. In this case, log in, select your Slack workspace, and then access the app management page again.

  2. Click Create an App/Create New App.

  3. Click From scratch.

  4. Enter a descriptive App Name.

  5. Select the workspace in which to install the app.

  6. Click Create App.

  7. Once you create the app, add the following Bot Token Scopes to your app:

    • channels:read

    • channels:history

    • files:read

    • groups:history

    • groups:read

    • team:read

    • usergroups:read

    • users:read

    • users.profile:read

    • users:read.email

  8. Install the app on your workspace.

    Note

    Once you install the app, the Bot User OAuth Token appears. You’ll need the access token when you create your Slack source.

    Copy the access token to a secure location where you can access it when creating your source, or get the access token later.

  9. Add the app to each channel that you want to index.

Add the Slack bot to your channels

You can add your Slack bot to any number of public or private channels in your workspace.

The message data that your Slack source has access to is limited to the Slack channels to which you add your Slack bot. This doesn’t mean that your Slack source automatically indexes the messages for all the channels that contain your Slack bot. You can choose the channels to index in your Slack source Channels subtab. Adding your Slack bot to channels simply makes the channels available for selection in your Slack source.

Note

To index the content of private channels, your Slack bot must include the groups:history and groups:read bot token scopes.

As new channels are created in your workspace, you can use the channel_created event in Slack to get notified of new channels.

Use one of the following two methods to add a Slack bot to a channel:

From a channel

Use this method to add the Slack bot to a newly created channel, or to add the bot to a small number of channels.

  1. In your Slack desktop application, click the channel that you want to index.

  2. In the message field, enter /add, and then click Add apps to this channel.

  3. Click Add corresponding to the app that’s associated with your Slack bot.

  4. Repeat the steps above to add the Slack bot to another channel.

From the Apps sidebar menu

Use this method to add the Slack bot to numerous channels.

  1. In your Slack desktop application, if the app that’s associated with your Slack bot doesn’t appear under Apps in the left sidebar:

    1. Under Apps, click Add Apps.

    2. Click your app. Your app now appears under Apps.

  2. Under Apps, right-click the app, and then click View app details.

  3. Click Add this app to a channel.

  4. Select the channel from the list.

  5. Click Add.

  6. Repeat steps 4 and 5 for each subsequent channel.

Tip

To see the channels to which your Slack bot is currently added, access your Slack source’s Channels subtab, or your Slack app management page as follows:

  1. Access your Slack app management page.

  2. Select your workspace.

  3. Select the app that’s associated with your bot from the list.

  4. Review the channels listed in the Bot User section.

Get the Slack bot OAuth access token

This section details how to get the OAuth access token for your Slack connector bot.

Your Slack source authorizes the Coveo organization to access your workspace items using your Slack connector bot’s OAuth access token. The Slack data that your source has access to is limited to the Slack workspace and channels to which the Slack connector bot is added.

You need the access token when creating a Slack source, or when changing the access token for an existing Slack source that you want to link to a different Slack bot.

To get a Slack bot’s access token

  1. Access the Your Apps page of the Slack API website.

  2. Click the app that’s associated with your Slack bot.

  3. Click OAuth & Permissions in the left menu.

  4. Under OAuth Tokens for Your Workspace, copy the Bot User OAuth Token.