The command line interface allows you to interact with your apps via the command line. Using the main command slack
, you can create, run, and deploy apps, as well as create triggers, and query datastores.
Running slack help
will display available commands in your terminal window.
The following is a comprehensive guide to the Slack CLI commands and each command's respective parameters and flags. Each category below is a Slack command and each item under it is a subcommand, so you would use them like so (unless otherwise noted):
slack <command> <subcommand> [flags]
To view global flags and each subcommand's flags, run the following in your terminal:
slack <subcommand> --help
Command | Description |
---|---|
auth |
Add and remove local workspace authorizations |
collaborator |
Manage app collaborators. |
datastore |
Query an App Datastore. |
env |
Add, remove, and list environment variables. |
external-auth |
Add and remove external authorizations and client secrets for providers in your app. |
function |
Manage who can view and use functions. |
manifest |
Display and validate app manifest when run in a valid project directory. |
platform |
Access Slack Platform. |
trigger |
List details of triggers declared in a valid project directory. |
workspace |
Install, uninstall, and list workspaces that installed the app. |
create |
Create a Slack project |
deno |
Runs deno command with DENO_AUTH_TOKENS mapped to Slack workspace tokens |
doctor |
Checks and reports on relevant system dependencies |
feedback |
Share feedback about your experience |
help |
Help about any command |
upgrade |
Check available updates for the CLI and SDK |
version |
Print the version number |
Flag | Description |
---|---|
--app string |
Use a specific app ID or environment |
-f , --force |
Ignore warnings and continue executing command |
h , --help |
Help for slack commands. Use this flag with any command (e.g. slack create --help ) for more information about a specific command |
-r , --runtime string |
Project's runtime language: deno , deno1.1 , deno1.x , etc. (default: deno ) |
-s , --skip-update |
Skip checking for the latest version of the CLI |
v , --verbose |
Set to print debug logging. When used with the validate command, you will be prompted to choose an AppID to validate against. |
-w , --workspace string |
Set a specific workspace by domain name or team ID |
Add and remove local workspace authorizations.
Subcommand | Description |
---|---|
list |
List all authorized workspaces |
login |
Login to a new or inactive workspace |
logout |
Log out of a workspace |
list
List all authorized workspaces.
Flag | Description |
---|---|
-h , --help |
Help for list |
login
Log in to a new or inactive workspace.
Flag | Description |
---|---|
--auth <string> |
Provide the user token for pre-authed login |
--challenge <string> |
Provide the challenge for the pre-authed login |
-h , --help |
Help for login |
--no-prompt |
Create a ticket for collecting a challenge code |
--ticket <string> |
Provide the auth ticket value |
logout
Log out of a workspace.
Flag | Description |
---|---|
-a, --all |
Log out of all workspaces |
-h , --help |
Help for logout |
Manage app collaborators.
Subcommand | Description |
---|---|
add |
Add a collaborator to your app |
list |
List all collaborators of an app |
remove |
Remove a collaborator from an app |
add
Add a collaborator to your app by Slack email address or user ID.
slack collaborator add <email|user_id> [flags]
Flag | Description |
---|---|
-h, --help |
Help for add |
list
List all collaborators of an app.
Flag | Description |
---|---|
-h, --help |
Help for list |
remove
Remove a collaborator from an app by Slack email address or user ID.
slack collaborator remove <email|user_id> [flags]
Flag | Description |
---|---|
-h, --help |
Help for remove |
Query an App Datastore. Useful for auditing your datastore and testing your queries.
Subcommand | Description |
---|---|
delete |
Delete an item from a datstore. |
get |
Get an item from a datastore. |
put |
Create or update an item in a datastore. Will overwrite entire datastore item. |
query |
Query a datastore for items. |
update |
Create or update an item in a datastore. Will only overwrite specified individual fields. |
delete
Delete an item from a datastore.
slack datastore delete <query> [flags]
Flag | Description |
---|---|
-h, --help |
Help for delete |
The delete
operation takes a primary key and deletes an item as in the following example:
$ slack datastore delete '{ "datastore": "running_datastore", "id": "50" }'
You'll see the following in your terminal:
🎉 Deleted from datastore: running_datastore
primary_key: 50
To inspect the datastore after updates, run slack datastore query [expression]
get
Get an item from a datastore.
slack datastore get <query> [flags]
Flag | Description |
---|---|
-h, --help |
Help for get |
--output <string> |
Output format: text, json (Default: text) (default "text") |
The get
command is used to retrieve a single item by its primary key. Here's an example:
$ slack datastore get '{ "datastore": "running_datastore", "id": "50" }'
You'll see the following in your terminal:
🎉 Get from Datastore: running_datastore
{
"distance": 26.2,
"id": "50",
"rundate": "2023-03-19",
"runner": "ABCD1234EFG"
}
To inspect the datastore after updates, run slack datastore get [expression]
put
Create or replace an item in a datastore. Will overwrite entire datastore item.
slack datastore put [item details] [flags]
Flag | Description |
---|---|
-h, --help |
Help for put |
Let's use the datastore we defined in the Virtual Running Buddies sample app to add an item to the datastore
. Given our datastore definition:
// datastores/run_data.ts
import { DefineDatastore, Schema } from "deno-slack-sdk/mod.ts";
export const RUN_DATASTORE = "running_datastore";
const RunningDatastore = DefineDatastore({
name: RUN_DATASTORE,
primary_key: "id",
attributes: {
id: {
type: Schema.types.string,
},
runner: {
type: Schema.slack.types.user_id,
},
distance: {
type: Schema.types.number,
},
rundate: {
type: Schema.slack.types.date,
},
},
});
export default RunningDatastore;
The put
request can look like:
slack datastore put '{ "datastore": "running_datastore", "item": { "id": "50", "runner": "ABCD1234EFG", "distance": "26.2", "rundate": "2023-03-19"} }'
You'll see the following in your terminal:
🎉 Stored below record in the datastore: running_datastore
{
"distance": 26.2,
"id": "50",
"rundate": "2023-03-19",
"runner": "ABCD1234EFG"
}
To inspect the datastore after updates, run slack datastore query [expression]
Be sure to double-check that the item's property names are correct when executing the put
command; if they are not, they will be ignored. If the API call is otherwise successful, no error code will be returned, and you'll have some garbage data on your hands.
Replacing data is done in the same way as creating data: simply provide the primary key of the item you'd like to replace.
query
Query a datastore for items.
slack datastore query [expression] [flags]
Flag | Description |
---|---|
-h, --help |
Help for query |
--output <string> |
Output format: text, json (Default: text) (default "text") |
Use the query
command when you're looking for a number of items, or when you don't know the ID of a particular item.
✨ To learn more about the language used for making queries, check out querying the datastore.
Let's check out what a query for runs logged on a certain date (March 19th, 2023) looks like:
$ slack datastore query '{ "datastore": "running_datastore", "expression": "rundate = :rundate", "expression_values": {":rundate": "2023-03-19"} }'
You'll see the following in your terminal:
🎉 Retrieved 1 items from datastore: running_datastore
{
"distance": 26.3,
"id": "50",
"rundate": "2023-03-19",
"runner": "ABCD1234EFG"
}
To create or update existing items run slack datastore put [item]
If you were to run this command without any expression, as in the following example:
slack datastore query '{"datastore": "running_datastore"}'
It would return all of the items in the datastore. Be careful though, as you could end up thinking you've lost data, when it could actually just be on another page.
update
Create or update an item in a datastore. Will only overwrite specified individual fields.
Flag | Description |
---|---|
-h, --help |
Help for update |
Unlike the put
command, which will overwrite an entire datastore item, the update
command will only overwrite the individual fields included in the command. For example:
$ slack datastore update '{ "app_id": "UVW987XYZ65", "datastore": "running_datastore", "item": { "id": "50", "runner": "ABCD1234EFG", "distance": "26.3", "rundate": "2023-03-19"} }'
You'll see the following in your terminal:
🎉 Stored below record in the datastore: running_datastore
{
"distance": 26.3,
"id": "50",
"rundate": "2023-03-19",
"runner": "ABCD1234EFG"
}
To inspect the datastore after updates, run slack datastore query [expression]
Add, remove, and list environment variables. Note this is for deployed apps only. To store local environment variables, use the .env
file.
Subcommand | Description |
---|---|
add |
Add an environment variable to the app |
list |
List all environment variables for the app |
remove |
Remove an environment variable from the app |
add
Add an environment variable to the app, prompting for a name or value if none is provided.
slack env add [name] [value] [flags]
Flag | Description |
---|---|
-h, --help |
Help for add |
list
List all environment variables for the app.
Flag | Description |
---|---|
-h, --help |
Help for list |
remove
Remove an environment variable from the app, selecting from set variables if none is provided.
slack env remove [name] [flags]
Flag | Description |
---|---|
-h, --help |
Help for remove |
Add and remove external authorizations and client secrets for providers in your app.
Subcommand | Description |
---|---|
add |
Initiate the oauth2 flow for a provider in your app for the current Slack team |
add-secret |
Add client secret for a provider in your app for the current Slack team |
remove |
Remove token(s) for your app in the current Slack team |
add
Initiate the Oauth2 flow for a provider in your app for the current Slack team.
Flag | Description |
---|---|
-h, --help |
Help for add |
-p, --provider <string> |
External Auth Provider Key |
add-secret
Add client secret for a provider in your app for the current Slack team that will be used to initiate the auth flow.
slack external-auth add-secret --provider provider_key --secret client_secret [flags]
Flag | Description |
---|---|
-h, --help |
Help for add-secret |
-p, --provider <string> |
Specifies an external auth provider to add a secret |
-x, --secret <string> |
External auth client secret for the specified provider |
remove
Remove token(s) for your app and optionally providers in the current Slack team. Note that this command will not revoke existing tokens. You might be able to revoke them from a provider's dev console or APIs.
Flag | Description |
---|---|
-a, --all |
Remove tokens for all providers |
-h, --help |
Help for remove |
-p, --provider <string> |
External Auth Provider Key |
Manage who can view and use functions.
Subcommand | Description |
---|---|
distribute |
Manage who can view functions published by your app |
distribute
Manage who can view functions published by your app.
Flag | Description |
---|---|
-A, --app-collaborators |
Grant permission to only those collaborating on your app |
-E, --everyone |
Grant permission to everyone in your workspace |
-G, --grant |
Grant permission to --users to use the function identified by --name |
-h, --help |
Help for distribute |
-I, --info |
Check who has access to the function identified by --name |
-R, --revoke |
Revoke permission for --users to use the function identified by --name |
-U, --users <string> |
A comma-separated list of one or more Slack user IDs |
Displays app manifest when run in a valid project directory.
Subcommand | Description |
---|---|
info |
Displays the app manifest when run in a valid project directory |
validate |
Validates the app manifest generated from a valid project directory |
info
Displays the app manifest when run in a valid project directory.
Flag | Description |
---|---|
-h, --help |
Help for info |
validate
Validates the app manifest generated from a valid project directory.
Flag | Description |
---|---|
-h, --help |
Help for validate |
Access Slack Platform.
Subcommand | Description |
---|---|
activity |
Print app activity |
deploy |
Deploy the Slack app |
run |
Develop and run locally |
activity
Print logging info from your app.
Flag | Description |
---|---|
--component <string> |
Component type to filter |
--component-id <string> |
Component ID (function ID, or workflow ID) to filter |
--event <string> |
Event type to filter |
-h, --help |
Help for activity |
--idle <int> |
Time in minutes to continue without results before exiting (default 5) |
-i, --interval <int> |
Polling interval in seconds (default 3) |
--level <string> |
Minimum level to display (trace, debug, info, warn, error, fatal) (default "info") |
--limit <int> |
Limit the amount of logs retrieved (default 100) |
--max-date-created <int> |
Maximum timestamp to filter (Unix timestamp in microseconds) |
--min-date-created <int> |
Minimum timestamp to filter (Unix timestamp in microseconds) |
--source <string> |
Source (slack or developer) to filter |
-t, --tail |
Continuously poll for new activity |
--trace-id <string> |
Trace ID to filter |
deploy
Deploys the Slack app.
Flag | Description |
---|---|
-f, --force |
Ignore warnings and continue deploying |
-h, --help |
Help for deploy |
run
Develop and run locally with live updates in your workspace.
Flag | Description |
---|---|
--activity-level <string> |
Minimum activity level to display (trace, debug, info, warn, error, fatal) (default "info") |
--cleanup |
Remove the local app from the target workspace after run command terminates |
-h, --help |
Help for run |
--no-activity |
Hide Slack Platform log activity |
--show-triggers |
Whether to show the currently installed triggers for the app's workflows on startup |
List details of triggers declared in a valid project directory.
Subcommand | Description |
---|---|
access |
Manage who can run your triggers |
create |
Create a trigger for a workflow |
delete |
Deletes an existing trigger |
info |
Get details for a specific trigger |
list |
List details of triggers declared in a valid project directory |
update |
Fully updates an existing trigger |
access
Manage who can run your triggers.
slack trigger access --trigger-id <id> [flags]
Flag | Description |
---|---|
-A, --app-collaborators |
Grant permission to only those collaborating on your app |
-C, --channels <string> |
A comma-separated list of one or more Slack channel IDs |
-E, --everyone |
Grant permission to everyone in your workspace |
-G, --grant |
Grant permission to --users or --channels to run the trigger identified by --trigger-id |
-h, --help |
Help for access |
-I, --info |
Check who has access to the trigger identified by --trigger-id |
-O, --organizations <string> |
A comma-separated list of one or more Slack organization IDs |
-R, --revoke |
Revoke permission for --users or --channels to run the trigger identified by --trigger-id |
-T, --trigger-id <string> |
The ID of the trigger |
-U, --users <string> |
A comma-separated list of one or more Slack user IDs |
-W, --workspaces <string> |
A comma-separated list of one or more Slack workspace IDs |
create
Creates a trigger which can be used to initiate a workflow execution.
slack trigger create --workflow <reference> [flags]
Flag | Description |
---|---|
--description <string> |
The description of this trigger |
-h, --help |
Help for create |
--interactivity slack#/types/interactivity |
When used with --workflow , adds a slack#/types/interactivity parameter to the trigger with the name specified by --interactivity-name |
--interactivity-name <string> |
When used with --interactivity , specifies the name of the interactivity parameter to use (default "interactivity") |
--title <string> |
The title of this trigger (default "My Trigger") |
--trigger-def <string> |
Path to a JSON file containing the trigger definition. If provided, other flags setting trigger properties are ignored. |
--workflow #/workflows/<workflow callback id> |
A reference to the workflow to execute, formatted like #/workflows/ |
delete
Deletes an existing trigger.
slack trigger delete --trigger-id <id> [flags]
Flag | Description |
---|---|
-h, --help |
Help for delete |
--trigger-id <string> |
The ID of the trigger |
info
Get details for a specific trigger.
slack trigger info --trigger-id <id> [flags]
Flag | Description |
---|---|
-h, --help |
Help for info |
--trigger-id <string> |
The ID of the trigger |
list
List details of triggers declared in a valid project directory.
Flag | Description |
---|---|
-h, --help |
Help for list |
update
Fully updates an existing trigger with the updated definition. Only supports full replacement, no partial update.
slack trigger update --trigger-id <id> --workflow <reference> [flags]
Flag | Description |
---|---|
--description <string> |
The description of this trigger |
-h, --help |
Help for update |
--interactivity slack#/types/interactivity |
When used with --workflow , adds a slack#/types/interactivity parameter to the trigger with the name specified by --interactivity-name |
--interactivity-name <string> |
When used with --interactivity , specifies the name of the interactivity parameter to use (default "interactivity") |
--title <string> |
The title of this trigger (default "My Trigger") |
--trigger-def <string> |
Path to a JSON file containing the trigger definition. If provided, other flags setting trigger properties are ignored. |
--trigger-id <string> |
The ID of the trigger to update |
--workflow #/workflows/<workflow callback id> |
A reference to the workflow to execute, formatted like #/workflows/ |
Install, uninstall, and list workspaces that installed the app.
Subcommand | Description |
---|---|
delete |
Deletes the app from a workspace |
install |
Install the app to a workspace |
list |
List all workspaces that installed the app |
delete
Uninstalls the app from the team workspace and deletes the app manifest from the Slack API.
Flag | Description |
---|---|
-h, --help |
Help for uninstall |
install
Install the app to a workspace.
Flag | Description |
---|---|
-h, --help |
Help for install |
list
List all workspaces that installed the app.
Flag | Description |
---|---|
-h, --help |
Help for list |
Create a Slack project on your local machine with an optional template.
slack create [name] [flags]
Flag | Description |
---|---|
-b, --branch <string> |
Name of git branch to checkout |
-h, --help |
Help for create |
-t, --template <string> |
Template URL for your app |
Runs deno
command with DENO_AUTH_TOKENS mapped to Slack workspace tokens.
The deno
command is a bit different than the others listed here. This is how you use it:
deno [OPTIONS] [SUBCOMMAND]
Option | Description |
---|---|
-h, --help |
Print help information |
-q, --quiet |
Suppress diagnostic output |
--unstable |
Enable unstable features and APIs |
-V, --version |
Print version information |
The flags for each subcommand can be found by running the following in your terminal window:
slack deno <subcommand> --help
Subcommand | Description |
---|---|
bench |
Run benchmarks |
bundle |
Bundle module and dependencies into single file |
cache |
Cache the dependencies |
check |
Type-check the dependencies |
compile |
UNSTABLE: Compile the script into a self contained executable |
completions |
Generate shell completions |
coverage |
Print coverage reports |
doc |
Show documentation for a module |
eval |
Eval script |
fmt |
Format source files |
help |
Print this message or the help of the given subcommand(s) |
info |
Show info about cache or info related to source file |
init |
Initialize a new project |
install |
Install script as an executable |
lint |
Lint source files |
lsp |
Start the language server |
repl |
Read Eval Print Loop |
run |
Run a JavaScript or TypeScript program |
task |
Run a task defined in the configuration file |
test |
Run tests |
types |
Print runtime TypeScript declarations |
uninstall |
Uninstall a script previously installed with deno install |
upgrade |
Upgrade deno executable to given version |
vendor |
Vendor remote modules into a local directory |
The Slack CLI and Deno support the standard, proxy-related environment variables. Proxy configuration is read from the environment variables HTTP_PROXY
, HTTPS_PROXY
and NO_PROXY
. To use these variables, ensure you have the minimum Deno version of 1.28. You can check which version you have by running slack deno --version
in your terminal window. All of the supported environment variables are listed here:
Environment variable | Description |
---|---|
DENO_AUTH_TOKENS |
A semi-colon separated list of bearer tokens and hostnames to use when fetching remote modules from private repositories (e.g. "abcde12345@deno.land;54321edcba@github.com") |
DENO_TLS_CA_STORE |
Comma-separated list of order dependent certificate stores. Possible values: "system", "mozilla". Defaults to "mozilla". |
DENO_CERT |
Load certificate authority from PEM encoded file |
DENO_DIR |
Set the cache directory |
DENO_INSTALL_ROOT |
Set deno install's output directory (defaults to $HOME/.deno/bin) |
DENO_NO_PROMPT |
Set to disable permission prompts on access (alternative to passing --no-prompt on invocation) |
DENO_NO_UPDATE_CHECK |
Set to disable checking if a newer Deno version is available |
DENO_WEBGPU_TRACE |
Directory to use for wgpu traces |
DENO_JOBS |
Number of parallel workers used for the --parallel flag with the test subcommand. Defaults to number of available CPUs. |
HTTP_PROXY |
Proxy address for HTTP requests (module downloads, fetch) |
HTTPS_PROXY |
Proxy address for HTTPS requests (module downloads, fetch) |
NPM_CONFIG_REGISTRY |
URL to use for the npm registry |
NO_COLOR |
Set to disable color |
NO_PROXY |
Comma-separated list of hosts which do not use a proxy (module downloads, fetch) |
Checks and reports on relevant system dependencies.
Flag | Description |
---|---|
-h, --help |
Help for doctor |
Help us make the next generation platform better by completing the feedback survey.
Flag | Description |
---|---|
-h, --help |
Help for feedback |
Help provides help for any command in the application. Simply type slack help [path to command] for full details.
Flag | Description |
---|---|
-h, --help |
Help for help |
List and create an app from the available samples.
Flag | Description |
---|---|
-h, --help |
Help for samples |
Checks available updates for the CLI and SDK.
Flag | Description |
---|---|
-h, --help |
Help for upgrade |
All software has versions. This is ours.
Flag | Description |
---|---|
-h, --help |
Help for version |
✨ 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.