Skip to main content

Creating an app

Workflow apps require a paid plan

Join the Developer Program and provision a sandbox with access to all Slack features for free.

An app goes through stages of development, from creation to experimentation and development to production. Sometimes a removal happens too.

The Slack CLI provides a set of commands to make managing these stages a bit easier with the following offerings:

Verify workspace authenticationโ€‹

Before you can create (or remove) an app, ensure your CLI is authenticated into the workspace you want to develop in. You can do so with the slack auth list command:

$ slack auth list

myworkspace (Team ID: T123456789)
User ID: U123456789
Last update: 2022-03-24 18:20:47 -07:00
Authorization Level: Workspace

To change your active workspace authorization run slack login

Create an appโ€‹

With your CLI authenticated into the workspace you want to develop in, the next step is to scaffold an app with the slack create command:

$ slack create my-app

The above command will scaffold a new app called my-app in a directory with the same name. If you don't pass an app name, slack will scaffold an app with a random alphanumeric name.

You will be presented with three options to build from:

tip

If you'd like to build from a specific sample app, see Create an app from a template below.

? Select a template to build from: [Use arrows to move]

> Issue submission (default sample)
Basic app that demonstrates an issue submission workflow

Scaffolded project
Solid foundation that includes a Slack datastore

Blank project
A, well.. blank project

View more samples

Guided tutorials can be found at api.slack.com/automation/samples

Once you select an option the Slack CLI will get you set up for success.

$ slack create my-app

โš™๏ธ Creating a new Slack app in ~/programming/my-app

๐Ÿ“ฆ Installed project dependencies

โœจ my-app successfully created

๐Ÿงญ Explore the documentation to learn more
Read the README.md or peruse the docs over at api.slack.com/automation
Find available commands and usage info with `slack help`

๐Ÿ“‹ Follow the steps below to begin development
Change into your project directory with `cd my-app`
Develop locally and see changes in real-time with `slack run`
When you're ready to deploy for production use `slack deploy`
Create a trigger to invoke your workflows `slack trigger create`

After creating an app, don't forget to cd into your app project's directory.

โžก๏ธ To keep building your own app, learn about your app's manifest in the manifest section.

โคต๏ธ To use a sample app as a template instead, read on!

Create an app from a templateโ€‹

Evaluate third-party apps

Exercise caution before trusting third-party and open source applications and automations (those outside of slack-samples). Review all source code created by third-parties before running slack create or slack deploy.

We have a collection of sample apps containing a bevy of use cases. Find one particularly suited for your needs? Great! You can use it as a template to build from.

Create an app from a template by using the create command with the --template (or -t) flag and passing the link to the template's Github repo.

For example, the following command creates an app using our Welcome Bot app as a template:

slack create my-welcome-bot-app -t https://github.com/slack-samples/deno-welcome-bot

Create an app from a specific branchโ€‹

Use a specific branch of a template repo by using the --branch (or -b) flag and passing the name of a branch:

slack create my-welcome-bot-app -t https://github.com/slack-samples/deno-welcome-bot -b main

Apps that were created without the CLI can still be used with the CLI for ease in app management. This requires the app link command to save information about the app with the project it exists on:

slack app link --app A0123456789 --team T0123456789 --environment "deployed"
๐Ÿ  An existing app was added to the project
my-workspace:
App ID: A0123456789
Team ID: T0123456789
Status: Installed

This command can be used without flags, but the above example would use the app ID "A01234567890" from team "T01234567890" - the team the app was created on - as a "deployed" app. Following selections in commands will reveal this app as an option and it's all set for CLI use!

Another --environment option is "local" and this saves apps to .slack/apps.dev.json. Local apps are intended for personal development and experimentation while "deployed" apps - saved to .slack/apps.json - serve the needs of production.

Just one app ID can exist for each combination of team ID and environment to avoid accidental selections with duplicated possibilities. The provided app ID must also exist for this link command to complete with success.


Onwardโ€‹

Your wish is our command! For information about other actions you can perform from the CLI, refer to the Slack CLI commands guide.

Check out more about how to configure your app via the manifest. You can also start building functions to perform some logic, chain them together in workflows, and create triggers to invoke those workflows.