The Slack CLI is a set of tools critical to building next generation Slack apps. This is your one-stop shop for those tools.
✨ If you've not used the Slack CLI before, we recommend following our quickstart guide instead. We'll still get your wagon loaded up before you depart for the trail, but we'll also give you some additional guidance.
⤵️ If you need to authorize the Slack CLI for use with continuous integrations and continuous deployments, jump down.
Run the automated installer from your terminal window:
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash
This will install the Slack CLI and all required dependencies, including Deno — the runtime environment for our next generation platform. If you have VSCode installed, the VSCode Deno extension will be installed.
The installation script will detect existing binaries named slack
and bail if
it finds one; it will not overwrite your existing slack
binary.
If you want to install the CLI as anything other than slack
, you can do so by
passing the -s
argument to the installer script:
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s <your-preferred-alias>
Run the automated installer from Windows PowerShell:
irm https://downloads.slack-edge.com/slack-cli/install-windows.ps1 | iex
This will install the Slack CLI and all required dependencies, including Deno — the runtime environment for our modular platform. If you have VSCode installed, the VSCode Deno extension will be installed.
1. Download and install Deno.
2. Verify that Deno is installed and in your path:
$ deno --version
deno 1.25.* (release, x86_64-apple-darwin)
v8 10.*
typescript 4.*
3. Download and install
Git, a
dependency of the slack
CLI.
4. Download the slack
CLI installer for your environment.
The slack
CLI is currently at version v2.3.0. See the changelog for details.
5. Add the slack
CLI to your path.
Existing slack
binary in path?
If you have another CLI tool in your path called slack
, we recommend renaming our slack binary to a different name before adding it to your path.
Mac/Linux: Copy the CLI into any folder that is already in your
path—such as /usr/local/bin
—or add a new folder to your path by
listing whatever folder you installed the CLI to in /etc/paths
.
Windows: Copy the CLI into any folder that is already in your path, or add a
new folder to your path by listing whatever folder you installed the CLI to in
your Environment Variables. You may not have access to edit System variables,
so you might need to add it to your account's User variables. You can open the
Environment Variables dialog by pressing the Win
+R
keys to open the Run
window, and entering the following command: rundll32.exe sysdm.cpl,EditEnvironmentVariables
.
6. Verify that slack
is installed and in your path:
$ slack version
Using slack v2.3.0
7. Verify that all dependencies have been installed:
$ slack doctor
8. Download the VSCode extension for Deno (recommended, but optional).
With the CLI installed, authorize the CLI in your workspace with the following command:
slack login
In your terminal window, you should see an authorization ticket in the form of a slash command, and a prompt to enter a challenge code:
$ slack login
📋 Run the following slash command in any Slack channel or DM
The command will open a prompt detailing the user permissions for you to approve
/slackauthticket ABC123defABC123defABC123defABC123defXYZ
? Enter challenge code
Copy the slash command and paste it into any Slack conversation in the workspace you will be developing in.
When you send the message containing the slash command, a modal will pop up, prompting you to grant certain permissions to the CLI. Click the Confirm button in the modal to move to the next step.
A new modal with a challenge code will appear. Copy that challenge code, and paste it back into your terminal:
? Enter challenge code eXaMpLeCoDe
✅ You've successfully authenticated! 🎉
Authorization data was saved to /Users/awesome.dev/.slack/credentials.json
💡 Run slack create my-app to create a new app, or slack help for details on available commands
Verify that your CLI is set up by running slack auth list
in your terminal
window:
$ slack auth list
myworkspace (Team ID: T123ABC456)
User ID: U123ABC456
Last updated: 2023-01-01 12:00:00 -07:00
You should see an entry for the workspace you just authorized. If you don't, get a new authorization ticket with slack login
to try
again.
You're now ready to begin building next generation Slack apps!
Once a day, the CLI checks for updates after running any command. When an update is available, a notification will be displayed with a link where you can find and download the new version.
Update notifications can be disabled using a command-line flag or an environment variable. When running any command, you can append the --skip-update
or -s
flag. Alternatively, you can set the SLACK_SKIP_UPDATE
environment variable and assign it any value.
You can obtain a long-lived service token for your CI/CD setups. Long-lived service tokens can be used to perform any Slack CLI action without the need to refresh tokens.
Seting up a long-lived service token will not intefere with your other authorization tokens.
1. Run the following command to get an authticket
:
slack auth token
2. Copy and paste the given /slackauthticket <your-auth-ticket>
slash command into the message composer anywhere within your Slack workspace.
3. Copy the given challenge code and paste it in the Slack CLI prompt.
4. Securely store the given service token.
In contrast to a typical authorization, the authorization information will not be saved to the your local credentials.json file.
Run the following command to authorize your Slack CLI with the long-lived service token:
slack login --auth <your-service-token>
The token
global flag allows you to pass the long-lived service token with any Slack CLI command. For example:
slack deploy --token <your-service-token>
Run the following command to revoke a long-lived service token:
slack auth revoke --token your-service-token`
Use the Slack CLI in tandem with our SDK to access our API, additional documentation, and code libraries. Click here to browse the source code on GitHub.
✨ To start creating an app, check out the create or remove an app page.
Have 2 minutes to provide some feedback?
We'd love to hear about your experience building modular Slack apps. Please complete our short survey so we can use your feedback to improve.