Our future generation platform is in closed beta. Please request to participate. During the beta, expect some rough edges, broken windows overlooking blue sky vistas, and regularly scheduled changes.

Your development environment & workspace

Your Slack application can be installed on multiple workspaces, which can be managed from the CLI via the workspace command. This makes it easy to fix bugs using a dev workspace and a separate branch of your code, for example, or to work on new features without disturbing a production app.

The slack CLI includes an workspace command that lets you install, list, and uninstall an app from any workspace.

Most commands accept an optional -w or --workspace flag, which runs that command for the given workspace. For example, if you've created a test Slack workspace such as my-test-workspace.slack.com and installed the app there with the slack workspace install command, you could then deploy to it by running slack deploy -w my-test-workspace.

The slack workspace list command will list all available workspaces.

Environment variables

Environment variables allow for persistent data storage for your application's runtime and behave similarly to the way standard Unix environment variables work. They are useful for storing configuration data for your app, such as an access token to another API, that you don't want to hard code into your app for security reasons or that you may need to update without wanting to re-deploy the application.

Environment variables are accessible in your application's code via the env object made available by the TypeScript SDK. For example, an environment variable named FOO would be accessed via:


Caution: environment variables
When developing locally, environment variables stored in a .env file at the root of your project will be read at runtime. Do not commit the .env file to version control, as it likely contains secrets you don't want to show up in a repo that might be made public.

When deploying to Slack's managed hosting, add variables using the var command.

When you add variables, you add them for specific workspaces by passing the -w flag. If the flag is left off, the workspace you are currently logged into is used.

For example, here is how you can add an environment variable:

$ slack var add FOO my_test_value

And here is how you would use a different value of that same variable on a different workspace:

$ slack var add FOO my_other_value -w my-test-workspace

To check your environment variables, run slack var list. You should see your variables, but won’t have access to the values. Every environment variable is treated as a secret, and the values are only exposed at runtime.

Was this page helpful?