Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

courtbot

Slack app providing slash commands for reserving squash courts.

Quickstart

This project is intended to support a Slack app providing custom slash commands. It uses Zappa to deploy a Flask application to AWS Lambda and Amazon API Gateway.

To get started, create a Slack app. If you haven't already, create a local AWS credentials file.

Install requirements:

$ make requirements

Package and deploy the service:

$ make deploy

Set environment variables the app needs to function:

MIT_RECREATION_PASSWORDS=your-password,another-password
MIT_RECREATION_USERNAMES=your-username,another-username
SLACK_API_TOKEN=your-slack-api-token
SLACK_TEAM_ID=your-slack-team-id
SLACK_VALID_CHANNELS=some-channel-id,another-channel-id
SLACK_VERIFICATION_TOKEN=your-slack-verification-token

Finally, configure slash commands (e.g., /look and /book) that POST to the /look and /book endpoints.

For information about additional Make targets:

$ make help

Development

courtbot is a Flask app. It can be run locally without using Lambda:

$ make serve

Remember to export the necessary environment variables. If you want to use Slack to test courtbot changes running locally, use ngrok to expose the server running on your local machine to the Internet:

$ make tunnel

Use the public URL of your tunnel to configure development slash commands (e.g., /dev-look and /dev-book) that POST to the https://<id>.ngrok.io/look and https://<id>.ngrok.io/book endpoints.

To run the linter (Flake8):

$ make lint

Design

Slack requires that "in channel" slash commands receive a response within 3 seconds. courtbot uses Zappa's auto keep-warm and asynchronous task execution features to meet this requirement in spite of Lambda's multi-second cold start time and the fact that booking can take upwards of 5 seconds.

About

Slack app providing slash commands for reserving squash courts

Topics

Resources

License

Releases

No releases published

Packages

No packages published