Skip to content

Commit d09ca5d

Browse files
committed
Merge branch 'staging' into master
2 parents 5408afa + 475d7d3 commit d09ca5d

File tree

13 files changed

+731
-270
lines changed

13 files changed

+731
-270
lines changed

README.md

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<div align="center">
2+
<a href="https://operationcode.org" height="750" width="750">
3+
<img
4+
alt="Operation Code Hacktoberfest Banner"
5+
src="https://operation-code-assets.s3.us-east-2.amazonaws.com/operationcode_hacktoberfest_2020.jpg"
6+
>
7+
</a>
8+
</div>
9+
<br />
10+
<br />
11+
12+
# 🎃 Hacktoberfest 🎃
13+
14+
[All the details you need](https://github.com/OperationCode/START_HERE/blob/master/README.md#-hacktoberfest-) before participating with us during Hacktoberfest.
15+
16+
<br />
17+
118
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
219
[![Twitter Follow](https://img.shields.io/twitter/follow/operation_code.svg?style=social&label=Follow&style=social)](https://twitter.com/operation_code)
320
[![Code-style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
@@ -81,6 +98,15 @@ to login to the new workspace, make sure you go ahead and do that.
8198
If you're having a hard time figuring this out, try checking out the following
8299
Slack article [Create a Slack Workspace](https://slack.com/intl/en-ca/help/articles/206845317-Create-a-Slack-workspace).
83100

101+
#### Create expected channels
102+
Several of Pybot's features involve sending messages to specific channels - in order
103+
for this to work in your personal Slack workspace you'll need to create the following channels:
104+
- mentors-internal
105+
- greetings
106+
- moderators
107+
- oc-tech
108+
109+
84110
### 2 - Create a pybot App in Your Slack Workspace
85111

86112
The next step is to create a new bot application in your workspace. While still
@@ -92,6 +118,14 @@ following this, follow the guidelines for creating a bot app as laid out in the
92118
you get to the stage of creating the bot user, make sure to write down the bot
93119
user OAuth access token that is presented, as you'll need to use it later.
94120

121+
On the `OAuth & Permissions` page configure the Pybot app with the following scopes
122+
123+
- channels:manage
124+
- chat:write
125+
- chat:write.public
126+
- commands
127+
- users:read
128+
95129
### 3 - Launch pybot Locally, Passing in Your Signing Secret
96130

97131
With your Slack workspace, app and bot user created, and your app signing secret
@@ -109,7 +143,7 @@ Here's an example of configuring these through the _pybot.env_ file:
109143

110144
```bash
111145
SLACK_BOT_SIGNING_SECRET=APP-SIGNING-SECRET
112-
BOT_OATH_TOKEN=BOT-USER-OAUTH-TOKEN
146+
BOT_USER_OAUTH_ACCESS_TOKEN=BOT-USER-OAUTH-TOKEN
113147
```
114148

115149
**NOTE**: More configuration settings than these may be specified. Please see
@@ -119,24 +153,34 @@ for details on other settings that can be set.
119153
### 4 - Attach Your pybot Instance to the Public Internet
120154

121155
With an instance of pybot running, you now need to expose this instance to the
122-
public internet so Slack can send in API requests. You can easily utilize serveo
123-
for this purpose if you wish. To do so; run the following command from your UNIX
124-
like workstation to setup an SSH port tunnel to serveo:
156+
public internet so Slack can send in API requests. You can easily utilize ngrok
157+
for this purpose if you wish. To do so; download ngrok from https://ngrok.com/download
158+
and set up a tunnel like so:
125159

126160
```bash
127-
ssh -R 80:localhost:5000 serveo.net
161+
ngrok http 5000
128162
```
129163

130164
Pay attention to copy out the response you get and keep this command running.
131165
Here's an example output from the command:
132166

133-
```text
134-
Forwarding HTTP traffic from https://supersecret.serveo.net
135-
Press g to start a GUI session and ctrl-c to quit.
167+
```bash
168+
ngrok by @inconshreveable (Ctrl+C to quit)
169+
Session Status online
170+
Session Expires 7 hours, 56 minutes
171+
Version 2.3.35
172+
Region United States (us)
173+
Web Interface http://127.0.0.1:4040
174+
Forwarding http://9d73595a7aac.ngrok.io -> http://localhost:5000
175+
Forwarding https://9d73595a7aac.ngrok.io -> http://localhost:5000
176+
Connections ttl opn rt1 rt5 p50 p90
177+
0 1 0.00 0.00 0.00 0.00
178+
HTTP Requests
136179
```
137180

138-
With this done, serveo will now expose the instance of pybot running locally
139-
on port 5000 on port 443 via the Base-URI it returns.
181+
With this done, ngrok will now expose the instance of pybot running locally
182+
on port 5000 via the "Forwarding" address it returns. Be sure to use the URL
183+
beginning with http**s**.
140184

141185
### 5 - Point Slack at Your Running pybot Instance
142186

@@ -167,7 +211,7 @@ subscriptions. When configuring your events URI; make sure you pass in the
167211
Base-URI that pybot is listening on followed by the text _/slack/events_. For
168212
example:
169213

170-
https://supersecret.serveo.net/slack/events
214+
https://123_random_code_321.ngrok.io/slack/events
171215

172216
#### Slash Commands
173217

@@ -177,7 +221,7 @@ page on Slack to setup pybot slash commands. When configuring a Slash command,
177221
make sure you configure the request URL to match the Base-URI that pybot is
178222
listening on followed by the text _/slack/commands_. For example:
179223

180-
https://supersecret.serveo.net/slack/commands
224+
https://123_random_code_321.ngrok.io/slack/commands
181225

182226
You'll use the same URI for each command. Here's a table listing of currently
183227
supported commands along with some suggested configuration text:
@@ -192,6 +236,16 @@ Command | Description | Usage Hint
192236
/roll | roll x dice with y sides | <XdY>
193237
/ticket | submit ticket to admins | (text of ticket)
194238

239+
240+
**👋 IMPORTANT!**
241+
242+
The `/lunch` command requires a valid Yelp API token stored in the `YELP_TOKEN`
243+
environment variable. See https://www.yelp.com/developers/faq
244+
245+
Similarly, the `/mentor` and `/mentor-volunteer` commands require access to an Airtable
246+
environment with a specific configuration. If you're planning on working with the mentor
247+
functionality please reach out to the `#oc-python-projects` channel for help getting set up.
248+
195249
#### Interactive Components
196250

197251
You can follow the instructions (and read helpful related information) on the
@@ -200,7 +254,7 @@ page on Slack to setup Slack interactive component configuration. When
200254
configuring the request URL, you'll want to set it to the Base-URI that pybot
201255
is listening on followed by the text _/slack/actions_. For example:
202256

203-
https://supersecret.serveo.net/slack/actions
257+
https://123_random_code_321.ngrok.io/slack/actions
204258

205259
You'll also want to make sure to configure the report message action with the
206260
following parameters:
@@ -219,8 +273,7 @@ list with more details via a PR:
219273
Name | Description | Example
220274
---- | ----------- | -------
221275
SLACK_BOT_SIGNING_SECRET | The unique signing secret used by Slack for a specific app that will be validated by pybot when inspecting an inbound API request | f3b4d774b79e0fb55af624c3f376d5b4
222-
BOT_OATH_TOKEN | The bot user specific OAuth token used to authenticate the bot when making API requests to Slack | xoxb-800506043194-810119867738-vRvgSc3rslDUgQakFbMy3wAt
223-
MENTOR_CHANNEL | Slack unique identifier (not the same as the channel name) for a workspace channel that mentors should be added to | G1DRT62UC
276+
BOT_USER_OAUTH_ACCESS_TOKEN | The bot user specific OAuth token used to authenticate the bot when making API requests to Slack | xoxb-800506043194-810119867738-vRvgSc3rslDUgQakFbMy3wAt
224277

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

docker/example.env

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
# --------------------------- #
22
### pybot.env ###
33

4-
# TOKEN=
5-
# BOT_OATH_TOKEN=
6-
# SLACK_BOT_SIGNING_SECRET=
7-
# VERIFICATION_TOKEN=
8-
# SLACK_BOT_ID=
9-
# SLACK_BOT_USER_ID=
4+
# SLACK_BOT_SIGNING_SECRET=<Client Secret>
5+
# BOT_USER_OAUTH_ACCESS_TOKEN=<Bot User OAuth Access Token>
106

11-
# PYBACK_PORT=
12-
# PYBACK_HOST=
137

8+
#~~ These are only needed if you want to override the default channel names ~~#
149
# COMMUNITY_CHANNEL=
1510
# MENTOR_CHANNEL=
1611
# TICKET_CHANNEL=
1712

1813
# AIRTABLE_API_KEY=
1914
# AIRTABLE_BASE_KEY=
2015

21-
# PYBACK_TOKEN=
2216

2317
# --------------------------- #
2418
### ngrok.env ###

0 commit comments

Comments
 (0)