Slack
Slack is a collaboration platform for team communication, channels, messages, files, and apps. Protocol Launcher allows you to generate deep links to open Slack workspaces, channels, users, apps, and files.
Usage
There are two ways to use this library:
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
- Full Import from the root package is convenient but includes all app modules.
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
Select Installation Method
Notes
Slack's slack:// URI templates use Slack IDs for workspaces, channels, users, apps, and files. They do not support workspace subdomains, channel names, user names, or filenames. Use Slack's app_redirect URL when you need the official channel-name redirect form.
Open Slack
Open the native Slack client. Passing team switches to a specific workspace.
import { open } from 'protocol-launcher/slack'
const url = open({
team: 'T12345',
})App Redirect
Create a Slack app_redirect URL that opens a direct message with an app or bot.
import { appRedirect } from 'protocol-launcher/slack'
const url = appRedirect({
app: 'A123ABC456',
team: 'T12345',
})Channel Redirect
Create a Slack app_redirect URL that opens a channel by ID or by name.
import { channelRedirect } from 'protocol-launcher/slack'
const url = channelRedirect({
channel: 'release-notes',
team: 'T12345',
})Open App Home
Open a Slack App Home by workspace ID and app ID. The optional tab value can be home, about, or messages.
import { openApp } from 'protocol-launcher/slack'
const url = openApp({
team: 'T12345',
id: 'A123ABC456',
tab: 'home',
})Open Channel
Open a Slack channel by workspace ID and channel ID.
import { openChannel } from 'protocol-launcher/slack'
const url = openChannel({
team: 'T12345',
id: 'C123ABC456',
})Open Direct Message
Open a direct message with a Slack user by workspace ID and user ID.
import { openUser } from 'protocol-launcher/slack'
const url = openUser({
team: 'T12345',
id: 'U123ABC456',
})Open File
Open a Slack file by workspace ID and file ID.
import { openFile } from 'protocol-launcher/slack'
const url = openFile({
team: 'T12345',
id: 'F123ABC456',
})Share File
Open Slack's file sharing dialog by workspace ID and file ID.
import { shareFile } from 'protocol-launcher/slack'
const url = shareFile({
team: 'T12345',
id: 'F123ABC456',
})