The Auto Mod bot implementation for the OSU Online CS Post bacc slack community
Currently, the Auto Mod bot on the OSU Online Post Bacc CS slack doesn't do much. It tells the admins when a new channel has been created, and that's about it. This project is an adaptation of the Slack API terms of service bot open source project. We are looking to add a number of features to the Auto Mod in order to make our community more inclusive & dynamic as it continues to grow. This includes anonymous reporting, welcome messages, terms of service signing, etc.
Please refer to the CONTRIBUTING.md file for the guidelines!
There are several steps required to get the slack bot up and running for local development (if you think there is a way to optimize this, submit an issue!)
- Create an account on the development slack instance - this can be found here
- Send a message to @John McBride for admin access & collaborative permissions to the development slack
- Install ngrok globally. A nice tutorial can be found here on how ngrok works and why it makes local development of slack apps possible
- Pull this github repository code
- Run
npm install
to download the project dependencies
- Once you are on the development slack and you have admin access, enter the admin pannel and go to the Slack API webpage. It can also be found here - Enter the page for the Auto Mod test bot
- Create a NEW file in the root of your project files named
.env
exactly - Under the
OAuth & Permissions
tab, copy theBot User OAuth Access Token
- Use this token as the
SLACK_TOKEN
environment variable in.env
- Under the
Basic Information
tab, copy theVerification Token
- Use this token as the
SLACK_VERIFICATION_TOKEN
environment variable in.env
- Specify a
PORT
environment variable (I usually do 8080) - You must also include the
AUTO_MOD
user code. This can be somewhat complicated as it requires you to interact with the Slack API through Curl with your token. Here is theuser.list
method that can be used with Curl to find the bot users ID - Additionally, you will need to include the
ADMINS
channel. This can also be found through the API with thechannels.list
method. Can be found here. - Further, you must include the
SLACK_TOKEN_TEST
,SLACK_VERIFICATION_TOKEN_TEST
,AUTO_MOD_TEST
, andADMINS_TEST
env variables. If you do not plan to use this in a seperate testing environment, simply enter an empty string. Refere to the.env.sample
file for a reference environment. - Finally, you must include a
ENV
variable. This must ether beTEST
orPROD
.
(in the future we hope to automate this further to make testing and getting set up easier for you.)
NOTE: Check out .env.sample
for how this environment variable file should look!
- Start the app with
npm start
- In another terminal window, start ngrok on the same local port you specified in
.env
like this:ngrok http 8080
- This allows your local instance of the node microservice to be tunneled through the internet to the slack API!
- Back on the Slack API app web page, navigate to the
Events Subscriptions
- Under the Request URL, change the URL to
http:// xxx.ngrok.io/events
(see your ngrok instance for the specific tunnel that your node instance can be reached on) - Ensure that the app is verified. You're all good to go!!
NOTE: If two people are attempting to develop at the same time, on the same development slack workspace, this process will NOT work. If you run into these issues, you may need to create your own development slack workspace! This would require a few additionally steps, so head over to #auto_mod and let the projects owners know if there are slack ngrok collision issues!
In the future, all contributors will be required to have their own development slack workspaces. As the project grows, we will begin to use the OSU-Auto-Mod slack as a "production test" envrionment before pushing up changes to the bot in the actual "production" enviroment (aka, the OSU Post Bacc slack).
All contributors must follow the OSU student code of conduct
Join the #Auto_Mod channel on the OSU Online CS Post Bacc slack found at https://osu-cs.slack.com/ Note: You MUST have an @oregonstate.edu email to sign up for this slack
John McBride
OSU Slack: @John McBride
Email: mcbridej@oregonstate.edu
Hunter Schallhorn
OSU Slack: @schallhh
Email: schallhh@oregonstate.edu