codeforamerica / courtbot

Your friendly neighborhood court robot. Provides an api for getting court case information.
ISC License
48 stars 55 forks source link

Courtbot

Courtbot is a simple web service for handling court case data. It offers a basic HTTP endpoint for integration with websites, and a set of advanced twilio workflows to handle text-based lookup.

Specifically, the twilio features include:

Running Locally

First, install node, postgres, and foreman.

To get started:

git clone https://github.com/codeforamerica/courtbot
cd courtbot
npm install

Then, to create the tables and load in initial data:

node utils/createQueuedTable.js
node utils/createRemindersTable.js
node utils/loaddata.js

Since the app uses twilio to send text messages, it requires a bit of configuration. Get a twilio account, create a .env file by running mv .env.sample .env, and add your twilio authentication information. While you're there, add a cookie secret and an encryption key (long random strings).

To start the web service:

foreman start

Deploying to Heroku

First, get a twilio account and auth token as described above. Then:

heroku create <app name>
heroku addons:add heroku-postgresql
heroku addons:add scheduler
heroku config:set COOKIE_SECRET=<random string>
heroku config:set TWILIO_ACCOUNT=<twilio account>
heroku config:set TWILIO_AUTH_TOKEN=<twilio auth token>
heroku config:set TWILIO_PHONE_NUMBER=<twilio phone number>
heroku config:set PHONE_ENCRYPTION_KEY=<random string>
git push heroku master
heroku run node utils/createQueuedTable.js
heroku run node utils/createRemindersTable.js
heroku run node utils/loaddata.js
heroku open

Finally, you'll want to setup scheduler to run the various tasks each day. Here's the recommended config:

scheduler settings