Add or Edit a Slack Source

Slack workspace administrators can index the content of a Slack workspace and make it searchable to workspace members through a Coveo-powered search interface. To do so, as a member of the Administrators or Content Managers built-in groups, you must create a Slack source in your Coveo organization.

You can index messages, including files and attachments, from specific public channels, and choose to index all channel information (separate from message data) and user-profile data. When a member of your Slack workspace clicks a query result in a Coveo search interface, the user is redirected to the corresponding item in Slack.

Your Slack source provides the Coveo organization with authorization to access your Slack workspace items using an OAuth 2.0 access token. The access token is linked to the Slack app that you create for your source. The Slack app is installed on your workspace and added to the public channels that you want to index.

Org-wide installation of a Slack app 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 app per workspace.

Source Key Characteristics

Features Supported Additional information
Slack version Latest version  
Searchable content types Messages, channels, user profiles, files, and attachments.
Content update operations Refresh

To set an automatic refresh schedule, see Edit a Source Schedule.

A rescan or rebuild is required to take account of deleted messages, channels, and user profiles, and to retrieve replies to messages.

Rescan

To set an automatic rescan schedule, see Edit a Source Schedule.

Extracts all of the data and indexes new items and existing items with a modified date greater than the date in the index.

The data that your source scans depends on the Earliest message to index (in days) option.

Rebuild

The data that your source scans depends on the Earliest message to index (in days) option.

Content security options Determined by source permissions  
Source creator  
Everyone  

Requirements

Prior to creating a new Slack source:

  • Create a Slack app and install it on your workspace and channels.

  • (Optional) Create a Slack export file that your Slack source uses for the initial build, as well as subsequent rescans and rebuilds, to index your Slack items.

    We recommend that you create a Slack export file as it accelerates the source indexing operation.

Add or Edit a Slack Source

  1. Before you create a new Slack source, ensure that you’ve performed the tasks detailed in the Requirements section.

  2. On the Sources page, do one of the following:

    • To create a new source, click Add source, and then click Slack.

    • To edit an existing source, click your Slack source, and then in the Action bar click Edit.

  3. Specify your source settings in the Add/Edit a Slack Source subpage. Refer to the following sections for detailed information on the source settings:

    You can save your source settings at any time by clicking Add and build source/Add source, or Save and rebuild source/Save.

  4. Build or rebuild your source.

"Configuration" Tab

In the Add/Edit a Slack Source subpage, the Configuration tab is selected by default. It contains your source’s general and content information, as well as other parameters.

Source Name

Enter a descriptive name for your source.

A source name can’t be modified once it’s saved. Be sure to use a short and descriptive name, using letters, numbers, hyphens (-), and underscores (_). Avoid spaces and other special characters.

Export Data URL

If you’re using a Slack export file, enter the direct URL of your hosted .zip file. You must modify the URL so that it’s a direct download link. This forces your Slack source to download the export file when indexing.

EXAMPLES
  • Dropbox

    If the original URL is https://www.dropbox.com/…​zip?dl=0, modify the URL by adding or replacing the dl parameter at the end of the URL so that it’s dl=1, such as https://www.dropbox.com/…​zip?dl=1.

  • Google Drive

    Use this URL format: https://drive.google.com/uc?export=download&id=<DRIVE_FILE_ID>, where DRIVE_FILE_ID is the unique id of your file. If the original URL is https://drive.google.com/file/d/123456789/view?usp=sharing, modify the URL so that it’s https://drive.google.com/file/uc?export=download&id=123456789.

Your Slack source downloads the export file during each rescan/rebuild. If you delete the export file from your Cloud storage system, or remove the Export Data URL, your source won’t use the export file for subsequent rescans/rebuilds.

"Authentication" Section

Your Slack source authorizes the Coveo organization to access your workspace items using your Slack app’s OAuth 2.0 access token.

  1. Get the Bot OAuth Token for your Slack app as follows:

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

    2. Click the Slack app that you created for use with Coveo.

    3. Click OAuth & Permissions in the left menu.

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

  2. In the Authentication section of your Slack source, paste the token in the Access token field.

"Content to Include" Section

Your Slack source always indexes the messages from the active public channels to which your Slack app is added. However, you can modify your source to index only a subset of your message data, as well as other types of items in addition to channel messages using the options in this section.

To display replies in a hierarchical fashion below the associated thread message in your search interface result list, you must enable result folding in your search page.

If you’re using the JavaScript Search Framework for your search interface, you can use the FoldingForThread component to enable result folding as Slack messages and replies are never more than one-level deep. Your Slack source includes preconfigured fields (foldingcollection, foldingchild, and foldingparent) in your index for use with the FoldingForThread component. Folded results are automatically rendered by way of the Slack result list template.

If you’re using Headless or REST API for your search interface, refer to the corresponding documentation for information on how to implement result folding in search results.

Option Description
Earliest message to index (in days)

This option defines the maximum number of days for which your source indexes message data during a build/rebuild or rescan. The amount of message data present in your Slack channels can be quite large. Therefore, you can use this option to limit the amount of data that is scanned and indexed/re-indexed in order to accelerate the indexing operation. If you choose to index Channels and Users, this option does not limit the channel information (separate from messages) and user data that your source indexes.

Set the number of days for which to index message data based on when the message is created or modified. By default, this option is set to 0 to index all message data. For example, if you set a value of 5, your source indexes new and modified message data only for the last five days. This means that if a message was created six days ago, the message does not appear in query results in a Coveo search interface. Your source considers replies to messages to be new messages. If a Slack member replies to a message today, and the message was origially created six days ago, your source indexes the reply to the message as the reply's creation date falls within the specified indexing timeline. If the value is 0, your source indexes all message data regardless of when the message was created or modified.

If you're using a Slack export file in your source, be aware that this setting impacts the message data that your source indexes from your export file. For more information and examples, see Interaction With "Earliest Message To Index" Source Option.

Channels Select this option to index every channel in your workspace as a separate document. When a query matches the channel name, the channel appears as a separate result in a Coveo search interface. Regardless of this option, your source indexes the messages only from channels in which your Slack app is added.
Files and attachments

Select this option to index the files and attachments that appear in messages. The filename and content of a file/attachment is searchable in a Coveo search interface. When a query matches the filename or content in a file, the file appears as a separate result in a Coveo search interface.

By default, your source is configured to index the most common file types, such as .doc, .xls, pdf, .txt, .html, and .json. However, some file types are not indexed by default, such as .jpeg and .png image files. Access your source JSON Configuration panel to view and modify the items that your source indexes.

Bot messages Select this option to index Slack bot and integration messages.
Users Select this option to index the user profiles in your workspace. When a query matches a name or display name in Slack, the user appears as a separate result in a Coveo search interface. When combined with the Files and attachments option, users can filter search results based on the document author.
Deleted and archived users If you chose to index Users, you can also choose to index the user profiles of deleted and archived users in your workspace.

If you archive a previously indexed Slack channel, your source removes all corresponding data from the index following a rescan or rebuild.

"Content Security" Tab

Select who will be able to access the source items through a Coveo-powered search interface. For details on these options, see Content Security.

The Determined by source permissions option is not available for Slack sources.

"Access" Tab

In the Access tab, determine whether each group and API key can view or edit the source configuration (see Resource Access):

  1. In the Access Level column, select View or Edit for each available group.

  2. On the left-hand side of the tab, if available, click Groups or API Keys to switch lists.

Verify and Edit Your Source Fields and Mappings

Mappings define what Coveo index fields contain for each source item. Your Slack source automatically includes mapping rules for the fields that are indexed.

The default mapping rules are suitable in most instances, however you can modify the mappings as required.

Do one or both of the following to verify and edit your field mappings:

Create Additional Source Fields and Mappings (Optional)

In certain situations, you may want to create a field in addition to the fields that are created automatically by your source. For example, you may want to create a field that’s used across multiple sources and mapped to different metadata for each source, or you may want to create a field that aggregates multiple metadata for a single source.

To create additional fields and mappings:

  1. Add a field to the Coveo index manually.

  2. Create a mapping rule in each source that you want to use the new field.

  3. Build the sources that you modified.

Build or Rebuild Your Source

You must build the source in order for Coveo to retrieve the source content and apply changes to your source settings. You can build or rebuild your source as follows:

  • You can choose to build when saving the source by clicking Add and build source/Save and rebuild source.

  • If you chose not to build when saving your source settings, you can build your source directly from the Sources page by clicking Launch build in the Status column for your source. If Launch build doesn’t appear in the Sources page for your source, click the source, click More, and then click Rebuild.

Once the source is built, you can review its content in the Content Browser.

Recommended Articles