GithubHelp home page GithubHelp logo

isabella232 / promptly Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeforamerica/promptly

0.0 0.0 0.0 13.57 MB

Code for text message reminders

Ruby 41.37% JavaScript 11.51% CoffeeScript 0.12% CSS 19.68% HTML 27.32%

promptly's Introduction

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 not actively maintained.

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.

If you are installing on Windows try RailsInstaller. Installing Rails on Windows can be tricky. There is a fork that is being actively developed within a Windows environment at SF HSA. You can have a look at their fork here: https://github.com/sf-hsa/promptly Some users have run into an error bundling on Windows because of a kgio error. See http://stackoverflow.com/questions/11199620/rails-on-windows-without-kgio for a solution, hint: you can comment out gem unicorn and use a different web server for local development.

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
$ foreman start

You should see something this in the console:

12:01:14 worker.1 | started with pid 3228
12:01:14 web.1    | started with pid 3227
12:01:16 web.1    | I, [2013-11-11T12:01:16.139986 #3227]  INFO -- : listening on addr=0.0.0.0:5000 fd=7
12:01:16 web.1    | I, [2013-11-11T12:01:16.140103 #3227]  INFO -- : worker=0 spawning...
12:01:16 web.1    | I, [2013-11-11T12:01:16.142336 #3227]  INFO -- : master process ready
12:01:16 web.1    | I, [2013-11-11T12:01:16.144046 #3229]  INFO -- : worker=0 spawned pid=3229
12:01:16 web.1    | I, [2013-11-11T12:01:16.144531 #3229]  INFO -- : Refreshing Gem list
12:01:20 web.1    | I, [2013-11-11T12:01:20.205813 #3229]  INFO -- : worker=0 ready

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

You can sign in with email=[email protected] and pass=administrator.

Deploy to Heroku

Signup for Heroku if you havn'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=[email protected] and password=administrator. Click Welcome, Admin in the top right and update your password.

And you're all set!

codeforamerica

promptly's People

Contributors

andyhull avatar bensheldon avatar codesliced avatar iamjoanne avatar jcody avatar lippytak avatar monfresh avatar rcackerman avatar ttmp avatar waffle-with-pears avatar waltz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.