Gambit is the DoSomething.org API for SMS conversations:
Sends outbound broadcast messages
Sends outbound confirmation messages for web subscriptions and/or campaign signups
Updates user subscription status when outbound message delivery fails
Sends outbound support messages from agents
Gambit forwards support requests from users into a Front inbox, where agents are able to send messages back to provide support.
Gambit is built with:
Local Node, redis, and MongoDB installations are required to run this application. (More detailed installation instructions here).
- Install Node, Redis and MongoDB.
- Clone this repo and navigate to it.
- Create a
.envfile with required variables. See
.env.examplefor guidance. (Some detailed instruction here).
- Your local Node.js and NPM versions should match the ones in
- Install dependencies:
- All tests should pass:
npm run test:full.
- Run Gambit Conversations locally:
npm start(uses nodemon).
With Gambit running locally, test Gambit replies by opening a new terminal window and running:
nvm use && node shell.
PuppetSloth-MacBook-Pro-2:gambit puppetsloth$ node shell ██████╗ █████╗ ███╗ ███╗██████╗ ██╗████████╗ ██╔════╝ ██╔══██╗████╗ ████║██╔══██╗██║╚══██╔══╝ ██║ ███╗███████║██╔████╔██║██████╔╝██║ ██║ ██║ ██║██╔══██║██║╚██╔╝██║██╔══██╗██║ ██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║██████╔╝██║ ██║ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ =============================================================== * To send a photo, type 'photo'. * To retry last message, type 'retry'. =============================================================== You>
Input is posted to your localhost
api/v2/messages?origin=twilio endpoint on behalf of the Northstar User with mobile number matching your
DS_CONSOLEBOT_USER_MOBILE config variable. A new Northstar User is created for the mobile number if it doesn't exist.
npm test:fullto lint code and run automated tests.
- Pull Requests are expected to contain reasonable test coverage.
Note: Git tags exist from when we used Wunderflow for branching. We now adhere to a Github flow, keeping consistent with workflow for other current DoSomething repositories, and no longer create tags for each deployment.
I get an
ERR! cb() never called! error when running
I ran into this error when upgrading npm from 5.x to 6.x. There seems to be a bug that affects apps w/ a lot of dependencies. Here's the Link
Steps I took to fix it:
- Raised the
maxprocsystem limits, Link.
- Exit out of all terminals and re-open.