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
+84-20Lines changed: 84 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,57 +2,121 @@
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
52
2. Choose the workspace you want to install the application to
11
53
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
54
4. Review the configuration and click *Create*
13
55
5. Click *Install to Workspace* and *Allow* on the screen that follows. You'll then be redirected to the App Configuration dashboard.
14
56
15
57
#### Environment Variables
58
+
16
59
Before you can run the app, you'll need to store some environment variables.
17
60
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`.
61
+
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`.
62
+
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
82
+
```
38
83
39
-
# Install the dependencies
84
+
#### Install dependencies
85
+
86
+
```sh
40
87
pip install -r requirements.txt
88
+
```
41
89
42
-
# Start your local server
90
+
</details>
91
+
92
+
## Development
93
+
94
+
### Starting the app
95
+
96
+
#### Slack CLI
97
+
98
+
```sh
99
+
slack run
100
+
```
101
+
102
+
#### Terminal
103
+
104
+
```sh
43
105
python3 app.py
44
106
```
45
107
46
-
#### Linting
108
+
### Linting
109
+
47
110
```zsh
48
111
# Run ruff from root directory for linting
49
-
ruff check.
112
+
ruff check
50
113
51
114
# Run ruff from root directory for code formatting
52
-
ruff format.
115
+
ruff format
53
116
```
54
117
55
-
#### Testing
118
+
### Testing
119
+
56
120
```zsh
57
121
# Run pytest from root directory for unit testing
58
122
pytest .
@@ -70,15 +134,15 @@ pytest .
70
134
71
135
### `/listeners`
72
136
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.
137
+
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
138
75
139
## App Distribution / OAuth
76
140
77
141
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
142
79
143
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
144
81
-
Start `ngrok` to access the app on an external network and create a redirect URL for OAuth.
145
+
Start `ngrok` to access the app on an external network and create a redirect URL for OAuth.
0 commit comments