Skip to content

Commit 4f5927e

Browse files
Joel GerberJoel Gerber
authored andcommitted
Point user at Slack docs and simplify text to make more future proof
1 parent b926b85 commit 4f5927e

1 file changed

Lines changed: 71 additions & 49 deletions

File tree

README.md

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -89,62 +89,52 @@ The following sections will guide you through each of these stages.
8989
### 1 - Setup Your Own Slack Workspace
9090

9191
To start, you'll want to visit Slack's [Getting
92-
Started](https://slack.com/get-started) page. From this page, choose the option
93-
to create a new workspace. It will request that you enter in an email address,
94-
feel free to enter in an email address that you have access to and continue
95-
through the process. It will email you a 6 digit code, check your email for
96-
this code and then input it into Slack to continue the process. Enter in the
97-
name of the workspace that you're going to play around with the pybot in. When
98-
it asks for a project you're working on, put in whatever you want. Maybe pybot
99-
would be a good choice? It will ask you to input other team members that you'd
100-
like to join in. Feel free to put in other emails here, or just skip this step
101-
altogether. Then, it gives you an option to login to your new workspace. Go
102-
ahead and do that!
103-
104-
With your new workspace created, you'll see that it has created a channel for
105-
the project name you entered. Congratulations, you've completed the first stage!
92+
Started](https://slack.com/get-started) page. From this page, follow the steps
93+
required to create a new workspace. The names/options you configure during
94+
creation don't matter so much, but make sure you associate it with an email
95+
address you have access to. Once complete it should present you with an option
96+
to login to the new workspace, make sure you go ahead and do that.
97+
98+
If you're having a hard time figuring this out, try checking out the following
99+
Slack article [Create a Slack Workspace](https://slack.com/intl/en-ca/help/articles/206845317-Create-a-Slack-workspace).
106100

107101
### 2 - Create a pybot App in Your Slack Workspace
108102

109-
While logged in to your Slack workspace, click on the drop-down menu in the top
110-
left corner, find the administration menu and then select _Manage Apps_. Once
111-
here, to the top right, find the build option and select it. It will bring you
112-
to the Slack API page. Click on the _Start Building_ option. From here, it will
113-
prompt you to enter in an application name and to attach it to a workspace. Go
114-
ahead and name your new pybot bot and attach it to your newly created workspace.
115-
Then click _Create App_ to do the deed. It will bring you to a new page. On this
116-
page, find the app credentials section, and from here, copy out your app's new
117-
signing secret. This is what you'll configure pybot with so that it can
118-
authenticate inbound requests.
119-
120-
Next, near the top of the screen select Add features and functionality and
121-
then chose _Bots_. Click on the _Add a Bot User_ button, add in a display name,
122-
enable _Always Show My Bot as Online_ and then select _Add Bot User_. Then, to
123-
the left, under Settings, choose _Install App_ and then click on _Install App to
124-
Workspace_, click _Allow_ and then copy off the bot user OAuth access token for
125-
later. You'll also be configuring pybot with this so that it can authenticate
126-
itself with Slack.
103+
The next step is to create a new bot application in your workspace. While still
104+
logged in, visit the [App Management](https://api.slack.com/apps) page and
105+
choose to create a new app. During this process, make sure to copy down the
106+
signing secret key that gets generated for your app, as you'll need it later,
107+
following this, follow the guidelines for creating a bot app as laid out in the
108+
[Enabling interactions with bots](https://api.slack.com/bot-users) article. When
109+
you get to the stage of creating the bot user, make sure to write down the bot
110+
user OAuth access token that is presented, as you'll need to use it later.
127111

128112
### 3 - Launch pybot Locally, Passing in Your Signing Secret
129113

130-
Either configure a pybot.env file in the root of this repository, or set an
131-
exported variable in your shell environment. Here's the required parameters
132-
shown as being configured in pybot.env (these also can be set as environment
133-
variables in your shell of choice instead.)
114+
With your Slack workspace, app and bot user created, and your app signing secret
115+
and bot user OAuth access token in hand, you should now be ready to configure
116+
pybot to integrate with your new Slack workspace. To do this, you'll first want
117+
to setup the proper configuration in pybot.
134118

135-
Example _pybot.env_:
119+
pybot configuration is specified completely through environment variables. When
120+
running locally, you can configure the _./docker/pybot.env_ file with the
121+
environment variable name/value pairings, which will get evaluated on
122+
application start. Otherwise, make sure to export or pass in the correct
123+
environment variables through your shell when launching pybot.
136124

137-
```text
138-
SLACK_BOT_SIGNING_SECRET=SUPER-SECRET-SIGNING-SECRET-HERE
139-
BOT_OAUTH_TOKEN=BOT-USER-OAUTH-ACCESS-TOKEN-HERE
140-
SLACK_BOT_USER_ID=BOT-DISPLAY-NAME
125+
Here's an example of configuring these through the _pybot.env_ file:
126+
127+
```bash
128+
SLACK_BOT_SIGNING_SECRET=APP-SIGNING-SECRET
129+
SLACK_TOKEN=BOT-USER-OAUTH-TOKEN
141130
```
142131

143132
### 4 - Attach Your pybot Instance to the Public Internet
144133

145-
You can easily utilize serveo to publish your pybot instance to the public
146-
internet. Just run the following command from your UNIX like workstation to
147-
setup an SSH port tunnel to serveo:
134+
With an instance of pybot running, you now need to expose this instance to the
135+
public internet so Slack can send in API requests. You can easily utilize serveo
136+
for this purpose if you wish. To do so; run the following command from your UNIX
137+
like workstation to setup an SSH port tunnel to serveo:
148138

149139
```bash
150140
ssh -R 80:localhost:5000 serveo.net
@@ -158,14 +148,46 @@ Forwarding HTTP traffic from https://supersecret.serveo.net
158148
Press g to start a GUI session and ctrl-c to quit.
159149
```
160150

151+
With this done, serveo will now expose the instance of pybot running locally
152+
on port 5000 on port 443 via the Base-URI it returns.
153+
161154
### 5 - Point Slack at Your Running pybot Instance
162155

163-
From the Slack API interface that you used to create your bot, under Features
164-
on the left, select _Event Subscriptions_, slide it to on, paste in your serveo
165-
Base-URI followed by _/pybot/api/v1/slack/verify_ (IE:
166-
_https://cool.serveo.net/pybot/api/v1/slack/verify_) and then save your changes.
156+
With the initial Slack configuration complete and your instance of pybot
157+
running on the public internet, it is now the perfect time to fully configure
158+
Slack to interact with your bot. Depending on the interactions you're wanting to
159+
play with, there are various configurations you can specify, which can be
160+
broken down into the following parts:
161+
162+
* Event Subscriptions - this allows pybot to respond to various events that may
163+
occur in your Slack workspace.
164+
* Slash Commands - this allows a user to invoke various commands from any
165+
channel in your workspace to interact with pybot.
166+
* Interactive Components - this allows various options to be exposed when
167+
right clicking on a message, or, when the bot presents various user
168+
elements that can be interacted with, instructs Slack on where to send the
169+
results for such interactions.
170+
171+
High level steps for configuring each of these can be found in the following
172+
sub-sections; note that you don't need to necessarily configure all of these,
173+
it all depends on what areas of pybot you're wanting to play with.
174+
175+
#### Event Subscriptions
176+
177+
You can follow the instructions (and read helpful related information) on the
178+
[Events API](https://api.slack.com/events-api) page on Slack. When configuring
179+
your events URI; make sure you pass in the Base-URI that pybot is listening on
180+
followed by the text _/slack/events_. For example:
181+
182+
https://supersecret.serveo.net/slack/events
183+
184+
#### Slash Commands
185+
186+
WIP
187+
188+
#### Interactive Components
167189

168-
Everything should now be done!
190+
WIP
169191

170192
## License
171193
This package is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)