Visitar URL original
GitHub - sf-hsa/promptly: Code for text message reminders · GitHub
Skip to content

About

Code for text message reminders

Resources

Stars

0 stars

Watchers

2 watching

Forks

 
 

Repository files navigation

Codeship Status for postcode/promptly Build Status Stories in Ready

Promptly

Promptly is a text message notification system originally built by 2013 Code for America fellows for the San Francisco Human Services Agency. See promptly.io for more info on the project. See our wiki for documentation.

Contribute

This project is young and in flux. Feel free to email info@postcode.io if you're interested in deploying or contributing.

Requirements

Promptly is a Ruby on Rails application that uses Twilio to send text messages.

If you need help setting up RVM, Ruby, and all that stuff, we recommend Moncef's great tutorial on setting up a Mac for development with Xcode, Homebrew, Git, RVM & Ruby.

You'll also need to setup a Twilio account and buy a Twilio phone number. You can get a development phone number for free but you'll need to pay to send text messages. Check our their pricing.

Install locally

  1. Install Bundler
$ gem install bundler
  1. Install the Heroku Toolbelt: https://toolbelt.heroku.com/

  2. Install and run PostgreSQL

Make sure PostgreSQL is running. If you're using Postgres.app, just run the application and then look for a cute elephant in the menu bar.

  1. Clone this repo
$ git clone https://github.com/postcode/promptly.git
  1. Install required gems
$ cd promptly
$ bundle install
  1. Configure environment variables by renaming .sample_env to .env and adding your (secret) keys
$ mv .sample_env .env

Promptly requires the following environment variables:

  • TWILIO_NUMBER is your Twilio phone number (just numbers, no punctuation)
  • TWILIO_SID is your Twilio account SID
  • TWILIO_TOKEN is your twilio auth token
  • SECRET_TOKEN is used to prevent cookie tampering. Run $ rake secret to get a pseudo-random key to use.

Add one variable per line in the .env file like this:

TWILIO_NUMBER=5105555555
TWILIO_SID=AC1365ff47...
...
  1. Create the file config/database.yml Insert the text below into database.yml. You will have to include your PostgreSQL username. Postgres.app creates a default user $USER with no password. Otherwise you'll have to make one yourself.
development:
  adapter: postgresql
  host: localhost
  username: [PostgreSQL username]
  #password: [Optional PostgreSQL password]
  database: promptly
  1. Setup the database
$ rake db:setup

# Equivalent to:
# rake db:create
# rake db:schema:load
# rake db:seed
  1. Start the server
$ rails s

You should see something this in the console:

=> Booting WEBrick
=> Rails 3.2.19 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-10-01 12:30:02] INFO  WEBrick 1.3.1
[2014-10-01 12:30:02] INFO  ruby 2.0.0 (2014-05-08) [x86_64-darwin13.1.0]
[2014-10-01 12:30:02] INFO  WEBrick::HTTPServer#start: pid=31272 port=3000

You can now visit Promptly at http://localhost:3000

You can sign in with email=admin@example.com and pass=administrator.

Deploy to Heroku

Signup for Heroku if you haven't already.

  1. Create a Heroku app and push your code
$ heroku login
$ heroku create
$ git push heroku master
  1. Add the Heroku PostgreSQL addon and promote it
$ heroku addons:add heroku-postgresql
$ heroku pg:promote HEROKU_POSTGRESQL_[YOUR COLOR]_URL
  1. Configure Heroku environment variables
$ heroku config:add TWILIO_NUMBER=[your Twilio phone number]

Repeat for TWILIO_SID, TWILIO_TOKEN, and SECRET_TOKEN using the values from your .env file (see above for details).

  1. Setup the database
$ heroku run rake db:setup

At this point you can run $ heroku open to see the project. We're almost done!

  1. Add a worker dyno

Promptly requires a worker dyno to queue the text message reminders. Please note this will cost you money. See the Heroku dev center for details on delayed job and pricing.

$ heroku ps:scale worker=1
  1. Add the Heroku scheduler addon

For annoying reasons we won't go into here, Promptly requires a periodic rake task to update the conversations model with incoming text messages from users. You can do this on Heroku using the scheduler addon.

$ heroku addons:add scheduler
$ heroku addons:open scheduler

Run the task rake update_conversations every 10 minutes: heroku scheduler addon

  1. Change the admin password
$ heroku open

Sign in with email=admin@example.com and password=administrator. Click Welcome, Admin in the top right and update your password.

And you're all set!

codeforamerica

About

Code for text message reminders

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages