The Auto Mod bot implementation for the OSU Online CS Post bacc slack community
What does this bot do?
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
Node JS dependencies & Local Development
- 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
npm installto 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
- Under the
OAuth & Permissionstab, copy the
Bot User OAuth Access Token
- Use this token as the
SLACK_TOKENenvironment variable in
- Under the
Basic Informationtab, copy the
- Use this token as the
SLACK_VERIFICATION_TOKENenvironment variable in
- Specify a
PORTenvironment variable (I usually do 8080)
- You must also include the
AUTO_MODuser code. This can be somewhat complicated as it requires you to interact with the Slack API through Curl with your token. Here is the
user.listmethod that can be used with Curl to find the bot users ID
- Additionally, you will need to include the
ADMINSchannel. This can also be found through the API with the
channels.listmethod. Can be found here.
- Further, you must include the
ADMINS_TESTenv variables. If you do not plan to use this in a seperate testing environment, simply enter an empty string. Refere to the
.env.samplefile for a reference environment.
- Finally, you must include a
ENVvariable. This must ether be
(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!
Run the app locally!
- Start the app with
- In another terminal window, start ngrok on the same local port you specified in
ngrok http 8080- This allows your local instance of the node microservice to be tunneled through the internet to the slack API!
Configure the Slack API
- Back on the Slack API app web page, navigate to the
- 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!
Local development roadmap
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).
There are many options for deploying the bot.
The main thing to get correct are the environment variables
ENV setting that this will run.
If you are running this on the official slack,
the variable must be set to
.env file has been configured,
simply run the node app in a VM instance,
on an App Engine, or at home! Make sure that port 8080
is exposed and reachable and then configure your production slack to use the public facing IP / domain.
All contributors must follow the OSU student code of conduct
Where to get help
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
Current Project Owners