Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 2.51 KB

README.md

File metadata and controls

61 lines (44 loc) · 2.51 KB

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:

  • Payable Prompt. If a case can be paid immediately, the app offers a phone number and link to begin payment.
  • Reminders. If a case requires a court appearance, the app allows users to sign up for reminders, served 24 hours in advance of the case.
  • Queued Cases. If a case isn't in the system (usually because it takes two weeks for paper citations to be put into the computer), the app allows users to get information when it becomes available. The app continues checking each day for up to 16 days and sends the case information when found (or an apology if not).

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