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 5.5 (see release notes)
Use the Heroku Button to deploy a version of Spoke suitable for testing. This won't cost any money and will not support production usage. It's a great way to practice deploying Spoke or see it in action.
Or click this link to deploy with a prod infrastructure set up to get up and running! NOTE: Deploying with prod infrastructure will cost $75 ($25 dyno + $50 postgres) a month and should be suitable for production level usage for most organizations.
Follow up instructions located here.
Please let us know if you deployed by filling out this form here
- Install either sqlite, postgres, or another knex-supported database.
- Install the Node version listed in
.nvmrc
. NVM is one way to do this (from the spoke directory):nvm install nvm use
- Install yarn.
- Yarn is a package manager that will download all required packages to run Spoke.
- Install using the directions provided by Yarn.
- Install the packages.
yarn install
- Create a real environment file:
cp .env.example .env
- This creates a copy of
.env.example
, but renames it.env
so the system will use it. Make sure you use this new file.
You now have a .env
file to fill out. For more details on environment variables you can change, see the environment variable reference.
There are some common environment variables you will want to adjust:
- To skip using the SMS provider (useful for development), set
DEFAULT_SERVICE=fakeservice
. - Determine which database to use and set the necessary variables, listed in the reference.
- To use Postgres, follow these instructions.
- Determine which authentication system you want to use. For development, there are a few ways authenticate.
- To use the local strategy for authentication, use
PASSPORT_STRATEGY=local
. - To use Auth0 by default, follow these instructions.
At this point, you should be ready to start your app in development mode.
- Run
yarn dev
to create and populate the tables.- 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
)
- Wait until you see both "Node app is running ..." and "webpack: Compiled successfully." before attempting to connect. (make sure environment variable
- Go to
http://localhost:3000
to load the app. (Note: the terminal will say it's running on port 8090 -- don't believe it :-) - As long as you leave
SUPPRESS_SELF_INVITE=
blank 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 ('E4502B28-301E-4E63-9A97-ACA14E8160C8', 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/E4502B28-301E-4E63-9A97-ACA14E8160C8. This should redirect you to the login screen. Use the "Sign Up" option to create your account.
- If you DO set that variable, then spoke will be invite-only and you'll need to generate an invite. Run:
- You should then be prompted to create an organization. Create it.
- See the Admin and Texter demos to learn about how Spoke works.
- See Getting Started with Development below.
- See How to Run Tests
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.
Docker is optional, but can help with a consistent development environment using postgres.
cp .env.example .env
and see the "Filling out your.env
file" section above for some possible tweaks- 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 rundocker-compose up
.
- You can stop docker compose at any time with
- 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.
- But if you need to generate an invite, run:
- You should then be prompted to create an organization. Create it.
- When done testing, clean up resources with
docker-compose down
, ordocker-compose down -v
to completely destroy your Postgres database & Redis datastore volumes.
-
Getting Started with Development:
- Welcome! Start with CONTRIBUTING.md for community participation and engagement details.
- Development Guidelines and Tips
- Running Tests
-
More Development documentation
- A request example pointing to different code points that all connect to it.
- GraphQL Debugging
- Environment Variable Reference
- QA Guide
-
Deploying
- Deploying with Heroku (and see Heroku deploy button above)
- Deploying on AWS Lambda
- We recommend using Auth0 for authentication in deployed environments (Heroku docs have their own instructions)
- How to setup Twilio
- Configuring Email
- Configuring Data Exports works
- Using Redis for Caching to improve server performance
- Configuration for Enforcing Texting Hours
-
Integrations
-
Administration
- Description of the different Roles and Their Permissions
- Some DB queries for Texter Activity
There are several ways to deploy documented below. This is the 'most minimal' approach:
- 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 - Run
yarn run prod-build-client
- 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
- Install PostgreSQL
- 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 toDB_
variables in spoke-pm2.config.js
Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs.
Spoke is licensed under the MIT license.