Skip to content

Commit bf093a0

Browse files
committed
Second pass at README.md update
1 parent 599dd64 commit bf093a0

File tree

1 file changed

+66
-11
lines changed

1 file changed

+66
-11
lines changed

README.md

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,46 @@ Secondary features :
5050
!wolfram ask <question> (Ask wolfram alpha a question)
5151
```
5252

53-
## Retrieving the API token
53+
## Retrieving the API tokens
5454

5555
Bot applications are not allowed to access all api methods from Slack. Thus, if
5656
you create a bot integration on slack, the bot won't be able to create new
5757
channels for example. To get around this restriction you must create a new
58-
slack integration ("Slack App"), assign it to your workspace, and generate both
59-
a "Bot User Token" and an "App Level Token" (`xoxb` and `xapp1`, respectively).
58+
slack integration ("Slack App"), assign it to your workspace, enable the Socket
59+
Mode event feed, generate an "App Level Token" (`xapp1`), assign scopes to your
60+
bot user and subsequently create a "Bot User Token" (`xoxb`), and then finally
61+
install it to your workspace.
62+
6063
Once generated, the tokens must be scoped to the appropriate privilege levels
6164
required for the bot to function. Finally, you must ensure that you have
6265
subscribed the bot users to the list of events it will need to receive in order
6366
to operate.
6467

65-
1) App Level Token
68+
1) First, navigate to `api.slack.com/apps` and create a new slack app. Give it
69+
a name and select the workspace that it will serve, and then click create.
70+
71+
2) Enable socket mode by clicking on the menu of the same name and then
72+
clicking on the toggle labelled "Enable Socket Mode". You'll be prompted to
73+
create an App Level Token which you must do next.
74+
75+
2) App Level Token
6676

6777
This token is used by the bot to access the websocket event feed in version 3
68-
of the Slack API. It comes with the `connections:write` scope and that's all
69-
you should need for this particular token. Place this token into the config
70-
file under the entry `app_key`.
78+
of the Slack API. The toggle you enabled in the previous step, "Enable Socket
79+
Mode", is what turns on the event feed. Assuming you've not already created an
80+
App Level Token you'll now be prompted to do so. Place it into the config file
81+
under the entry `app_key`.
7182

72-
2) Bot User Token
83+
3) Bot User Token
7384

7485
This token is used by the bot to interact with the workspace and users via
75-
Slack's conversations API. Once you've created it you will need to authorize it
76-
for the following scopes. Then you will need to put the token into the config
77-
file under the entry `api_key`.
86+
Slack's conversations API. In order to create this token you must first
87+
navigate to the OAuth & Permissions section of the Slack API control panel.
88+
89+
Once there, take note of the greyed out "Install to Workspace" button. You need
90+
to add scopes to the bot user's token before you can install the bot. Scroll
91+
down to the bottom of this page and in the section labelled "Bot Token Scopes"
92+
add the following scopes.
7893

7994
```
8095
app_mentions:read
@@ -109,6 +124,46 @@ users:read
109124
users:write
110125
```
111126

127+
Next, return to the top of the page and install the bot user using the button
128+
from before which should no longer be greyed out. Now copy the "Bot User OAuth
129+
Access Token" (begins with `xoxb`) into the config file under the entry
130+
`api_key`. The bot should show up inside the workspace now. You can change its
131+
display name using the menu on the left labelled "Basic Information", if you
132+
want.
133+
134+
4) Event subscription
135+
136+
NOTE: Make sure you toggle "Enable Socket" (step 2) before attempting this!
137+
138+
Once the tokens have been configured you will need to navigate to the Event
139+
Subscriptions panel of the slack API control panel and register the bot to
140+
receive the events it needs to operate.
141+
142+
First toggle the switch labelled "Enable Events", then use the picker to select
143+
at least the events below. They are probably all that you will need, but it's
144+
fine to select all of the event subscriptions here just to be on the safe side.
145+
146+
```
147+
app_mention
148+
app_mentions:read
149+
emoji_changed
150+
emoji:read
151+
link_shared
152+
links:read
153+
message.channels
154+
channels:history
155+
message.groups
156+
groups:history
157+
message.im
158+
im:history
159+
message.mpim
160+
mpim:history
161+
reaction_added
162+
reactions:read
163+
reaction_removed
164+
reactions:read
165+
```
166+
112167

113168
## Installation
114169

0 commit comments

Comments
 (0)