Sakabot is a slackbot designed to help Andelans find the owners of lost and found equipment. It is built off of Slack's Events API.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Python 3.6.x
-
Clone the repo from Github by running
$ git clone [email protected]:RyanSept/sakabot.git
-
Change directory into package
$ cd sakabot
-
Install the dependencies by running
$ pip install requirements.txt
-
Create a .env file from the .env.sample file, populating it with values you'll find on the Slack app page. You can then dump the variables into your environment by running
$ source .env
Before running the app, you need to setup the datastore and populate it by running the extractor on the asset/work tools spreadsheet. To run the extractor, you need Google API credentials. To get these, you need to setup a project on the Google Developers Console. Follow this guide https://developers.google.com/sheets/api/quickstart/python to get the credentials and download the Client Configuration file to app/utils/credentials as the file sakabot-cred.json. Copy the client email value in the credentials file you got and share the spreadsheet with that email. See this other readme for documentation on the module.
-
Go to https://api.slack.com/apps and click on
Create new app
. -
Once you've given it a name and chosen, the workspace, you will be redirected to the app's page.
-
Navigate to
Add features and functionality > Bots
and click on add a bot user. Give it a name and check theAlways Show My Bot as Online
checkbox and then click "Create bot user". -
On the app page, go to
Add features and functionality > Event Subscriptions
. Enable events and insert the webhook uri for events eg.https://sakabot.herokuapp.com/slack/events
-
Still on the events page, on the
Subscribe to Bot Events
section, add the bot user events app_mention and message.im. Save changes and go back to the app page. -
On the app page and navigate to
Add features and functionality > Interactivity
. Switch on Interactivity. Insert the api endpoint uri eg.https://sakabot.herokuapp.com/interactive
You're done!
$ git checkout deploy
$ git push heroku deploy:master