Skip to content

Commit 7c3d3cf

Browse files
committed
Provide config files to simplify bot deployment
1 parent 24935f7 commit 7c3d3cf

2 files changed

Lines changed: 66 additions & 39 deletions

File tree

README.md

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -83,63 +83,44 @@ Slack Bot Setup
8383
SEURON supports two connection modes for its Slack bot: **Socket Mode** (recommended) and **RTM** (legacy).
8484

8585
### Socket Mode (Recommended)
86-
Socket Mode uses a WebSocket connection managed through an app-level token. It works with modern Slack apps and does not require a public URL or classic bot tokens.
87-
88-
#### 1. Create a Slack App
89-
1. Go to [https://api.slack.com/apps](https://api.slack.com/apps) and click **Create New App** > **From scratch**
90-
2. Name the app (e.g. `seuron`) and select your workspace
91-
92-
#### 2. Enable Socket Mode
93-
1. In the app settings, go to **Settings** > **Socket Mode**
94-
2. Toggle **Enable Socket Mode** on
95-
3. When prompted, create an app-level token with the `connections:write` scope
96-
4. Save the generated token (starts with `xapp-`) -- this is your `SLACK_APP_TOKEN`
97-
98-
#### 3. Subscribe to Events
99-
1. Go to **Features** > **Event Subscriptions** and toggle **Enable Events** on
100-
2. Under **Subscribe to bot events**, add the following events:
101-
* `message.channels` -- messages in public channels
102-
* `message.groups` -- messages in private channels
103-
* `message.im` -- direct messages
104-
* `message.mpim` -- group direct messages
105-
* `reaction_added` -- emoji reactions
106-
107-
#### 4. Configure Bot Token Scopes
108-
1. Go to **Features** > **OAuth & Permissions**
109-
2. Under **Scopes** > **Bot Token Scopes**, add:
110-
* `chat:write` -- send messages
111-
* `files:read` -- access uploaded files
112-
* `files:write` -- upload files
113-
* `users:read` -- look up user display names
114-
* `reactions:read` -- read emoji reactions
115-
* `channels:history` -- view messages in public channels
116-
* `groups:history` -- view messages in private channels
117-
* `im:history` -- view direct messages
118-
* `mpim:history` -- view group direct messages
119-
* `channels:read` -- view basic channel info
120-
121-
#### 5. Install the App
86+
Socket Mode uses a WebSocket connection managed through an app-level token. It works with modern Slack apps and does not require a public URL or classic bot tokens. A pre-built [app manifest](slack_manifest.json) is provided to configure all required permissions and events automatically.
87+
88+
#### 1. Create the Slack App from the manifest
89+
1. Go to [https://api.slack.com/apps?new_app=1](https://api.slack.com/apps?new_app=1) and choose **From an app manifest**
90+
2. Select your workspace and click **Next**
91+
3. Choose the **JSON** tab and paste the contents of [`slack_manifest.json`](slack_manifest.json)
92+
4. Click **Next**, review the summary, then click **Create**
93+
94+
This configures Socket Mode, all required bot token scopes, and event subscriptions in one step.
95+
96+
#### 2. Generate the App-Level Token
97+
1. After creating the app, go to **Settings** > **Basic Information**
98+
2. Scroll down to **App-Level Tokens** and click **Generate Token and Scopes**
99+
3. Name the token (e.g. `seuron-socket`), add the `connections:write` scope, and click **Generate**
100+
4. Copy the token (starts with `xapp-`) -- this is your `SLACK_APP_TOKEN`
101+
102+
#### 3. Install and get the Bot Token
122103
1. Go to **Settings** > **Install App** and click **Install to Workspace**
123104
2. Authorize the requested permissions
124105
3. Copy the **Bot User OAuth Token** (starts with `xoxb-`) -- this is your `SLACK_TOKEN`
125106

126-
#### 6. Configure SEURON
107+
#### 4. Configure SEURON
127108
For **local deployment**, the `start_seuronbot.local` script will prompt you for both tokens. Alternatively, set them directly in `.env.local`:
128109
```
129110
SLACK_TOKEN=xoxb-your-bot-token
130111
SLACK_APP_TOKEN=xapp-your-app-level-token
131112
SLACK_NOTIFICATION_CHANNEL=seuron-alerts
132113
```
133114

134-
For **Google Cloud deployment**, add the app token to `cloud/google/cloud-deployment.yaml`:
115+
For **Google Cloud deployment**, set the tokens in `cloud/google/cloud-deployment.yaml`:
135116
```yaml
136117
slack:
137118
botToken: xoxb-your-bot-token
138119
appToken: xapp-your-app-level-token
139120
notificationChannel: seuron-alerts
140121
```
141122
142-
#### 7. Invite the Bot
123+
#### 5. Invite the Bot
143124
Invite the bot user to any Slack channels where you want to interact with it, including the notification channel.
144125
145126
### RTM Mode (Legacy)

slack_manifest.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"display_information": {
3+
"name": "seuron",
4+
"description": "SEUnglab neuRON pipeline task manager"
5+
},
6+
"features": {
7+
"bot_user": {
8+
"display_name": "seuronbot",
9+
"always_online": true
10+
}
11+
},
12+
"oauth_config": {
13+
"scopes": {
14+
"bot": [
15+
"chat:write",
16+
"chat:write.customize",
17+
"files:read",
18+
"files:write",
19+
"users:read",
20+
"reactions:read",
21+
"reactions:write",
22+
"channels:history",
23+
"groups:history",
24+
"im:history",
25+
"mpim:history",
26+
"channels:read"
27+
]
28+
}
29+
},
30+
"settings": {
31+
"event_subscriptions": {
32+
"bot_events": [
33+
"message.channels",
34+
"message.groups",
35+
"message.im",
36+
"message.mpim",
37+
"reaction_added"
38+
]
39+
},
40+
"interactivity": {
41+
"is_enabled": true
42+
},
43+
"org_deploy_enabled": false,
44+
"socket_mode_enabled": true
45+
}
46+
}

0 commit comments

Comments
 (0)