You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-20Lines changed: 76 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,57 +2,113 @@
2
2
3
3
This is a generic Bolt for Python template app used to build out Slack apps.
4
4
5
-
Before getting started, make sure you have a development workspace where you have permissions to install apps. If you don’t have one setup, go ahead and [create one](https://slack.com/create).
5
+
## Setup
6
+
7
+
Before getting started, make sure you have a development workspace where you have permissions to install apps. If you don't have one setup, go ahead and [create one](https://slack.com/create).
8
+
9
+
### Developer Program
10
+
11
+
Join the [Slack Developer Program](https://api.slack.com/developer-program) for exclusive access to sandbox environments for building and testing your apps, tooling, and resources created to help you build and grow.
1. Open [https://api.slack.com/apps/new](https://api.slack.com/apps/new) and choose "From an app manifest"
10
44
2. Choose the workspace you want to install the application to
11
45
3. Copy the contents of [manifest.json](./manifest.json) into the text box that says `*Paste your manifest code here*` (within the JSON tab) and click *Next*
12
46
4. Review the configuration and click *Create*
13
47
5. Click *Install to Workspace* and *Allow* on the screen that follows. You'll then be redirected to the App Configuration dashboard.
14
48
15
49
#### Environment Variables
50
+
16
51
Before you can run the app, you'll need to store some environment variables.
17
52
18
-
1. Open your apps configuration page from this list, click **OAuth & Permissions** in the left hand menu, then copy the Bot User OAuth Token. You will store this in your environment as `SLACK_BOT_TOKEN`.
19
-
2. Click ***Basic Information** from the left hand menu and follow the steps in the App-Level Tokens section to create an app-level token with the `connections:write` scope. Copy this token. You will store this in your environment as `SLACK_APP_TOKEN`.
53
+
1. Open your apps configuration page from [this list](https://api.slack.com/apps), click **OAuth & Permissions** in the left hand menu, then copy the Bot User OAuth Token. You will store this in your environment as `SLACK_BOT_TOKEN`.
54
+
2. Click **Basic Information** from the left hand menu and follow the steps in the App-Level Tokens section to create an app-level token with the `connections:write` scope. Copy this token. You will store this in your environment as `SLACK_APP_TOKEN`.
source .venv/bin/activate # for Windows OS, .\.venv\Scripts\Activate instead should work
74
+
```
75
+
76
+
#### Install dependencies
38
77
39
-
# Install the dependencies
78
+
```sh
40
79
pip install -r requirements.txt
80
+
```
81
+
82
+
</details>
41
83
42
-
# Start your local server
84
+
## Development
85
+
86
+
### Starting the app
87
+
88
+
#### Slack CLI
89
+
90
+
```sh
91
+
slack run
92
+
```
93
+
94
+
#### Terminal
95
+
96
+
```sh
43
97
python3 app.py
44
98
```
45
99
46
-
#### Linting
100
+
### Linting
101
+
47
102
```zsh
48
103
# Run ruff from root directory for linting
49
-
ruff check.
104
+
ruff check
50
105
51
106
# Run ruff from root directory for code formatting
52
-
ruff format.
107
+
ruff format
53
108
```
54
109
55
-
#### Testing
110
+
### Testing
111
+
56
112
```zsh
57
113
# Run pytest from root directory for unit testing
58
114
pytest .
@@ -70,15 +126,15 @@ pytest .
70
126
71
127
### `/listeners`
72
128
73
-
Every incoming request is routed to a "listener". Inside this directory, we group each listener based on the Slack Platform feature used, so `/listeners/shortcuts` handles incoming [Shortcuts](https://api.slack.com/interactivity/shortcuts) requests, `/listeners/views` handles [View submissions](https://api.slack.com/reference/interaction-payloads/views#view_submission) and so on.
129
+
Every incoming request is routed to a "listener". Inside this directory, we group each listener based on the Slack Platform feature used, so `/listeners/shortcuts` handles incoming [Shortcuts](https://docs.slack.dev/interactivity/implementing-shortcuts/) requests, `/listeners/views` handles [View submissions](https://api.slack.com/reference/interaction-payloads/views#view_submission) and so on.
74
130
75
131
## App Distribution / OAuth
76
132
77
133
Only implement OAuth if you plan to distribute your application across multiple workspaces. A separate `app_oauth.py` file can be found with relevant OAuth settings.
78
134
79
135
When using OAuth, Slack requires a public URL where it can send requests. In this template app, we've used [`ngrok`](https://ngrok.com/download). Checkout [this guide](https://ngrok.com/docs#getting-started-expose) for setting it up.
80
136
81
-
Start `ngrok` to access the app on an external network and create a redirect URL for OAuth.
137
+
Start `ngrok` to access the app on an external network and create a redirect URL for OAuth.
0 commit comments