An easy way for UW gymnasts to sign up for the carpools for practice via text! The club usually signs up using this spreadsheet, but sign up is much easier if you can just text in to say you're going that day. Works by interacting with the spreadsheet, which can also be used to sign up, so the two will always be in sync.
You will need to do a few things in order to get this project running.
The database used for the users is stored by mlab.com. There is a main account (madisonGymnastics). Get an admin to create a user account for you by having them go to mlab.com, selecting "Users" (next to "Collections") and clicking "Add database user."
Two options here.
- Get the password, account SID, and auth token for the main number, using [email protected]'s account (contact Austin Meyer about that)
- Make your own Twilio account. Buy a phone number through Twilio.
The developer can use a normal Javascript development workflow using npm start
or if they have the nanobox
cli installed they can use the powerful tools in that for local development, dry-runs, and easy deployment.
Clone this repository. There are several environment variables necessary for sensitive information:
DBUSERNAME=YOUR_MLAB_USERNAME
DBPASSWORD=YOUR_MLAB_PASSWORD
TWILIOSID=YOUR TWILIO_SID
TWILIOAUTHTOKEN=YOUR_TWILIO_AUTH_TOKEN
You will also need the client-secret.json
file provided for use with Google Sheets. On the first access of the Sheet, Google has to ask
for the user to create a token through their browser and insert it into the command line where the server was started. When deploying the
app that input option is inaccessible, so we have converted the script to allow the file to be generated locally and deployed with the
rest of the code. How to:
- Run the server with
npm start
- Use Postman, Curl, or any other tool to send a legitimate request to the application (Making the body to be "people" will work)
- Follow the given url and paste the code into the waiting application
- You should now have a generated
.credentials/
folder in your app directory
kevin@kevinlaptop:~/work/gymnastics-text$ ./run-local.sh -h
Running GymnasticsText + Ngrok
_______________________________
run-local.sh [-h] [-b]
-h, for help message
-b, add build argument to docker-compose
Script starts node app and then brings up ngrok as well, to
make setup as simple as ./run-local.sh
. Script checks (in order)
if docker-compose, docker, or neither are installed and
runs the appropriate command.
For ngrok, it checks first in your path then the local directory.
If docker-compose is installed, you can skip the image building stage
of the installation instructions by passing the -b
flag.
The Dockerfile handles npm setup work inside the image, and building requires running:
docker build -t gymnasticstext_node-app .
so the only thing left to do is start up the container with the current directory as a volume and run npm start.
To do so interactively, run:
docker run --rm -it -v "$(pwd)":/app -p 1337:1337 gymnasticstext_node-app /bin/bash
root@8f537bea9e65:/app# npm start
Otherwise the run-local script will start it as a daemon.
Install all dependencies from package.json:
npm install
Install and run ngrok
npm install -g ngrok
ngrok http 1337
Once ngrok is running you will see two lines that start with "Forwarding".
Take the https://#########.ngrok.io from the second one and append /sms
Go to your Twilio account, find the number you will be using, click on it. Scroll down until you see "Messaging."
In the box next to "A message comes in" paste your version of https://#########.ngrok.io/sms
Ensure that to the left it says Webhook and to the right it says HTTP POST.
Run npm start and you're done!
Currently tests on the app are run from a Python script in tests/
.
see the README
in the directory for details.
The first deployment of the app uses Nanobox with Digital Ocean as the VPS provider https://nanobox.io/.
To use Nanobox, you must first follow their installation instructions for their CLI tool and create an account.
You must also have an account with one of the many VPS providers like Digital Ocean, AWS, Azure, etc.
Then for developing & setting up the app, follow the Express app documentation on their website, and env variables will have to be added using the nanobox tool.
The only thing I found to be not necessary (which is probably from our lack of experience) is the step about bin/www
, didn't end up knowing how to use it and wasn't needed.
For deployment, follow the instructions given in your Nanobox dashboard.
- Austin Meyer - All the phone stuff - frizzkitten
- Raizel Lieberman - All the spreadsheet stuff - rlieberman2
- Kevin Quinn - Mentor and inspiration to us all - i-dont-remember
See also the list of contributors who participated in this project.
- Thank you to the forward-thinking leadership of the Wisconsin Gymnastics Club for allowing us to try this out.