Skip to content

Docs: guide quick start app creation using the slack cli. #1317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

technically-tracy
Copy link
Contributor

@technically-tracy technically-tracy commented Jun 12, 2025

Summary

Docs: guide quick start app creation using the slack CLI following the Bolt for JS structure authored by @zimeg.

Testing

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@technically-tracy technically-tracy requested a review from zimeg June 12, 2025 13:27
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.96%. Comparing base (260e9b9) to head (46b4c83).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1317   +/-   ##
=======================================
  Coverage   90.96%   90.96%           
=======================================
  Files         222      222           
  Lines        7501     7501           
=======================================
  Hits         6823     6823           
  Misses        678      678           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zimeg zimeg added the docs Improvements or additions to documentation label Jun 13, 2025
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@technically-tracy Wow! Thanks so much for putting this together so fast 🤖 ✨

I left a few comments on changes we'll need to make on the linked sample app and also some sample code we might want to include here!

These paths otherwise read well and some comments have thoughts on separating requirements more, but right now this makes most sense with the current capabilities released in the CLI ⚡

The comments on incoming CLI changes IMO don't have to block this from releasing either if we're alright with fast follows as well! 🚢 💨


This page contains an overview of your app in addition to important credentials you'll need later.
A few tools are needed for the following steps. We recommend using the [**Slack CLI**](https://tools.slack.dev/slack-cli/) for the smoothest experience, but other options remain available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📺 💾 We might also want to add an option of using git and the latest stable version of python?


### Create an app {#create-an-app}
First thing's first: before you start developing with Bolt, you'll want to [create a Slack app](https://api.slack.com/apps/new).
When complete, you'll have a local environment configured with a customized [app](https://github.com/slackapi/bolt-python/tree/main/examples/getting_started) running to modify and make your own.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👾 The standalone "Getting Started App" repo might be alright to link here though I'm noticing a change is needed first:

  • manifest.json: To define the features of an app!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗣️ Changes to the sample app are in progress here: slack-samples/bolt-python-getting-started-app#3


---
After a project is created you'll have a `package.json` file for app dependencies and a `.slack` directory for Slack CLI configuration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
After a project is created you'll have a `package.json` file for app dependencies and a `.slack` directory for Slack CLI configuration.
After a project is created you'll have a `requirements.txt` file for app dependencies and a `.slack` directory for Slack CLI configuration.

Right now this is unversioned which we might revisit soon with the kind help of @dependabot!


```shell
```sh
which python3
# Output: /path/to/first-bolt-app/.venv/bin/python3
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once the virtual environment is active, install the required project dependencies with the following command:
```sh
pip install -r requirements.txt
```

IIRC some efforts are in progress to handle the creation and installation of packages in a virtual environment for the CLI track, but this command can be useful to include for now in both cases!

Polite tagging of @mwbrooks here for awareness 🙏 ✨


<Tabs groupId="socket-or-http">
<TabItem value="socket-mode" label="Socket Mode">
Using an editor of choice, open the app.py file and add the following message listener after the "hello" handler:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using an editor of choice, open the app.py file and add the following message listener after the "hello" handler:
Using an editor of choice, open the app.py file and add the following import to the top of the file, and message listener after the "hello" handler:
```python
import random
```

This might not be the most clear organization, but TIL random is not a default package of Python! 🐍 ✨

import os
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler
// SAMPLE CODE HERE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// SAMPLE CODE HERE
@app.message("goodbye")
def message_goodbye(say):
responses = ["Adios", "Au revoir", "Farewell"]
parting = random.choice(responses)
say(f"{parting}!")

👋 Farewell or au revior or adios I cannot tell what this might output.


We're going to use bot and app-level tokens for this guide.

1. Navigate to the **OAuth & Permissions** on the left sidebar and scroll down to the **Bot Token Scopes** section. Click **Add an OAuth Scope**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Navigate to the **OAuth & Permissions** on the left sidebar and scroll down to the **Bot Token Scopes** section. Click **Add an OAuth Scope**.
1. Navigate to **OAuth & Permissions** on the left sidebar and scroll down to the **Bot Token Scopes** section. Click **Add an OAuth Scope**.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or "Navigate to the OAuth & Permissions page"


The value inside of `say()` is now an object that contains an array of `blocks`. Blocks are the building components of a Slack message and can range from text to images to datepickers. In this case, your app will respond with a section block that includes a button as an accessory. Since we're using `blocks`, the `text` is a fallback for notifications and accessibility.

You'll notice in the button `accessory` object, there is an `action_id`. This will act as a unique identifier for the button so your app can specify what action it wants to respond to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You'll notice in the button `accessory` object, there is an `action_id`. This will act as a unique identifier for the button so your app can specify what action it wants to respond to.
You'll notice in the button `accessory` object, there is an `action_id`. This will act as a unique identifier for the button so your app can specify which action it wants to respond to.


Now, if you restart your app and say "hello" in a channel your app is in, you'll see a message with a button. But if you click the button, nothing happens (_yet!_).

Let's add a handler to send a followup message when someone clicks the button:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Let's add a handler to send a followup message when someone clicks the button:
Let's add a handler to send a follow-up message when someone clicks the button:

Copy link
Contributor

@haleychaas haleychaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small nits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants