Coder Social home page Coder Social logo

spoke's Introduction

Build Status

Spoke

Spoke is an open source text-distribution tool for organizations to mobilize supporters and members into action. Spoke allows you to upload phone numbers, customize scripts and assign volunteers to communicate with supporters while allowing organizations to manage the process.

Spoke was created by Saikat Chakrabarti and Sheena Pakanati, and is now maintained by MoveOn.org.

The latest version is 2.0.0 (see release notes) which we recommend for production use, while our main branch is where features still in development and testing will be available.

Deploy to Heroku

Deploy

Follow up instructions located here

Please let us know if you deployed by filling out this form here

Getting started

  1. Install either sqlite (or another knex-supported database)

  2. Install the Node version listed in .nvmrc. NVM is one way to do this (from the spoke directory):

    nvm install
    nvm use
    
  3. yarn install (If yarn is not yet installed, run npm install -g yarn first)

  4. cp .env.example .env

  5. If you want to use Postgres:

    • In .env set DB_TYPE=pg. (Otherwise, you will use sqlite.)
    • Set DB_PORT=5432, which is the default port for Postgres.
    • Create the spokedev database: psql -c "create database spokedev;"
  6. Some other settings to tweak in dev -- make sure you are NOT editing .env.example -- edit .env:

    • For development, you should probably set DEFAULT_SERVICE=fakeservice to skip using an SMS provider (Twilio or Nexmo) and insert the message directly into the database.
    • For production, you'll want to use Auth0 for login and set PASSPORT_STRATEGY=auth0 -- see Auth0 for authentication for setup instructions
  7. Run yarn dev to start the app. Wait until you see both "Node app is running ..." and "webpack: Compiled successfully." before attempting to connect. (make sure environment variable JOBS_SAME_PROCESS=1)

  8. Go to http://localhost:3000 to load the app and create the database (Note: the terminal will say it's running on port 8090 -- don't believe it :-) -- it's running a proxy on port 3000 which also includes static asset serving, etc.

  9. As long as you leave SUPPRESS_SELF_INVITE= blank and unset in your .env you should be able to invite yourself from the homepage.

    • If you DO set that variable, then spoke will be invite-only and you'll need to generate an invite. Run:
      echo "INSERT INTO invite (hash,is_valid) VALUES ('abc', 1);" |sqlite3 mydb.sqlite
      # Note: When doing this with PostgreSQL, you would replace the `1` with `true`
      
    • Then use the generated key to visit an invite link, e.g.: http://localhost:3000/invite/abc. This should redirect you to the login screen. Use the "Sign Up" option to create your account.
  10. You should then be prompted to create an organization. Create it.

  11. See the Admin and Texter demos to learn about how Spoke works.

  12. See Getting Started with Development below.

SMS

For development, you can set DEFAULT_SERVICE=fakeservice to skip using an SMS provider (Twilio or Nexmo) and insert the message directly into the database.

To simulate receiving a reply from a contact you can use the Send Replies utility: http://localhost:3000/admin/1/campaigns/1/send-replies, updating the app and campaign IDs as necessary. You can also include "autorespond" in the script message text, and an automatic reply will be generated (just for fakeservice!)

Twilio

Twilio provides test credentials that will not charge your account as described in their documentation. To setup Twilio follow our Twilio setup guide.

Getting started with Docker

Docker is optional, but can help with a consistent development environment using postgres.

  1. cp .env.example .env and see step 6 above for some possible tweaks
  2. Build and run Spoke with docker-compose up --build
    • You can stop docker compose at any time with CTRL+C, and data will persist next time you run docker-compose up.
  3. Go to localhost:3000 to load the app.
    • But if you need to generate an invite, run:
      docker-compose exec postgres psql -U spoke -d spokedev -c "INSERT INTO invite (hash,is_valid) VALUES ('<your-hash>', true);"
    • Then use the generated key to visit an invite link, e.g.: http://localhost:3000/invite/<your-hash>. This should redirect you to the login screen. Use the "Sign Up" option to create your account.
  4. You should then be prompted to create an organization. Create it.
  5. When done testing, clean up resources with docker-compose down, or docker-compose down -v to completely destroy your Postgres database & Redis datastore volumes.

More Documentation

Deploying Minimally

There are several ways to deploy documented below. This is the 'most minimal' approach:

  1. Run OUTPUT_DIR=./build yarn run prod-build-server This will generate something you can deploy to production in ./build and run nodejs server/server/index.js
  2. Run yarn run prod-build-client
  3. Make a copy of deploy/spoke-pm2.config.js.template, e.g. spoke-pm2.config.js, add missing environment variables, and run it with pm2, e.g. pm2 start spoke-pm2.config.js --env production
  4. Install PostgreSQL
  5. Start PostgreSQL (e.g. sudo /etc/init.d/postgresql start), connect (e.g. sudo -u postgres psql), create a user and database (e.g. create user spoke password 'spoke'; create database spoke owner spoke;), disconnect (e.g. \q) and add credentials to DB_ variables in spoke-pm2.config.js

Big Thanks

Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs.

License

Spoke is licensed under the MIT license.

spoke's People

Contributors

schuyler1d avatar shakalee14 avatar spakanati avatar lperson avatar sandramchung avatar azuzunaga avatar bchrobot avatar cp4r3z avatar sreynen avatar jamesr2323 avatar mathemagica avatar joemcl avatar jparkrr avatar benmort avatar hiemanshu avatar jmcarp avatar jlegrone avatar codygordon avatar saikat avatar ben-pr-p avatar harpojaeger avatar bdatkins avatar millsoper avatar etothepiipower avatar lady3bean avatar zluo16 avatar benhiller avatar jeremyparker avatar anasauce avatar dzeez avatar

Watchers

James Cloos 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.