Skip to main content

Slack

The slack module lets editors search and import files from a linked Slack workspace through Brightspot's federated search.

Dependencies

Depends on db-http and the Slack Web API (files.info, files.list, search.files). Account linking and workspace management are provided by the platform's shared com.psddev:slack module; this module adds the search-specific OAuth scope and search integration.

Installation

<!-- Requires Brightspot 5.0 or later. -->
<dependency>
<groupId>com.brightspot.dbhttp</groupId>
<artifactId>slack</artifactId>
<version>1.0.0</version>
</dependency>

API reference

com.psddev.slack.search.SlackDatabase

Extends HttpDatabase. With a keyword, calls Slack's search.files; without one, falls back to files.list for the linked workspace, optionally filtered to files created after a chosen date range.

com.psddev.slack.search.SlackFile

Extends ExternalItem.

FieldTypeDescription
filenameStringThe file name.
fileIdStringThe Slack file Id.
mimeTypeStringThe file's MIME type.
createdDateDateWhen the file was posted in Slack.
downloadUrlStringThe file's download URL.
imagePreviewUrlStringA preview image URL, for image files.

Sort order is set through the SlackQueryStringSort enum (relevance and timestamp variants), and results can be filtered to the last day, week, month, or year.

Configuration

Workspace credentials and account linking are configured through the shared com.psddev:slack module. Each editor links their own Slack account (adding a search scope the first time they search Slack) before they can search Slack files; downloaded previews are served through an HMAC-signed proxy so image URLs can't be tampered with.

Extending the plugin

The module doesn't ship a content type for imported files. To let editors create one from search results, define a content type and extend ExternalItemConverter<SlackFile, T> to convert the external item into it on import, downloading the file's content from Slack using the linked editor's token.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.