Skip to main content

Geschätzte Zeit

Themen

Die Community fragen

Create Your Project with the Slack CLI

Set Up the Slack CLI

To build and host your app, you use the Slack command-line interface (CLI). The Slack CLI enables you to create and manage Slack apps from the command line.

The following are steps to install and authenticate the Slack CLI for MacOS. If you’re running a Windows machine, you can check out the instructions here.

Install the Slack CLI

First, get the Slack CLI onto your machine.

  1. Open Terminal from Applications or search and select Terminal using command + space.
  2. Download the Slack CLI with the following command: curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash
  3. Terminal will respond that it’s installing the Slack CLI,

Terminal window with the command entered and Terminal responds Hello and welcome! Now beginning to install the … Slack CLI

  1. Confirm the install with the command slack version.

Terminal responds with the Slack CLI version installed on your machine.

Note

Having Trouble Installing the Slack CLI?

If for some reason there’s an issue installing the Slack CLI, you can find troubleshooting steps for common issues here.

Authenticate the Slack CLI

You then connect the Slack CLI to your Trailhead Slack playground. The authentication ticket you receive in this step is time-sensitive and times out in 5 minutes. Ensure you use it promptly. If it happens to time out and you get an error, follow the below steps from the beginning.

  1. If you don’t have your Trailhead Slack Playground open, go ahead and launch it.
  2. Then, head back to Terminal and enter slack login to retrieve an auth ticket. You’ll get instructions to run a slash command in your Slack environment, /slackauthticket [48 character string]

Terminal with the slack login command run, and the Slack CLI response Run the following slash command in any Slack channel or DM, followed by the auth ticket

  1. Copy this slash command and the entire string. Keep your Terminal window open.Head to your Trailhead Slack Playground. Enter the command in any channel or DM. You may also create a private channel, like #the-slack-cli, to keep your workspace tidy. Once the command is entered, a modal pops up listing all the permissions you granted to the Slack CLI.

Slack CLI Authentication modal listing the permissions the Slack CLI is asking for, like View and see information about your Slack apps, View and see data from your Slack App Datastore, and View basic information about your private channels

  1. Click Confirm to retrieve your challenge code.

modal in Slack, Submit Challenge Code with an 8 character string

  1. Copy and paste the challenge code back in your open Terminal window.

Once the challenge code is entered, you receive a message of successful authentication from the Slack CLI.

Terminal showing successful authentication, You successfully authenticated! And information about where the authorization data was saved

You’re now ready to build and host your app on your machine!

Create the Project

The Slack CLI create command enables you to set up your project where you’re working.

  1. In Terminal, enter slack create say-hello --template slack-samples/bolt-js-getting-started-app
    This creates the say-hello project on your machine, based on the getting started with Bolt template. You’ll see the Slack CLI respond by creating the project to path ~/say-hello and installing project dependencies.
    1. You may be prompted to agree to the download of Slack developer tools. In this case, go ahead and agree.

Terminal with the command entered, response Created a new Slack project and Installed project dependencies with next steps

  1. To confirm the project was set up, search for and open the project folder say-helloon your computer.

The work you did in this step was on your machine, so we won’t check it. Go ahead and click Verify step to earn 100 points to move forward. In the next step, you use your preferred text editor, like VS Code, to develop the app.

Teilen Sie Ihr Trailhead-Feedback über die Salesforce-Hilfe.

Wir würden uns sehr freuen, von Ihren Erfahrungen mit Trailhead zu hören: Sie können jetzt jederzeit über die Salesforce-Hilfe auf das neue Feedback-Formular zugreifen.

Weitere Infos Weiter zu "Feedback teilen"