Simple slackbot that polls Piazza every minute for new posts and posts their content to the Piazza channel on Slack with a link
Installation and Deployment
- Under Administration > Manage Apps > Custom Integrations > Bots, create a new bot integration. It should require you to give a bot a username.
- Decide on which channel the bot should post to and then add the bot to the channel. The bot cannot post if it is not already in the channel.
The bot needs to run somewhere. A free tier Heroku deployment would suffice.
- Create a new app on Heroku. You can do this either via the Heroku CLI or using the web interface. Follow the instructions to create a local Heroku git repo.
- The required environment variables can be found on in
.env.template. Fill in the corresponding fields on the app deployment (this is so that we don't put confidential credentials in the program itself)
- Follow the deployment instructions provided by Heroku
The supporting files required for Heroku deployment are provided, you can modify them if you wish. Their functions are roughly listed below:
Procfile - specifies to Heroku the type of application and the instruction to run
requirements.txt - packages/dependencies to install
runtime.txt - which version of Python we are using
You can also run the bot on your local machine for testing purposes.
- Create a
.envfile from the
.env.templateand fill it up with your own credentials
- Install the required packages using
pip install -r requirements.txt. Using a virtualenv is recommended to isolate dependencies
- Run the bot with
If everything goes well, the bot should print a relatively healthy message every minute
Inspired by t-davidson's piazza-slackbot. Modified the handling of env variables, as rewriting the logic for pulling new posts.