Twilio Queue Example
Holy biscuits! It's got features!
- Caller Handling - Take callers and put them in a call queue with TwiML's new Enqueue verb.
- Agent Handling - Answers callers in the order they dialed in using TwiML's new Queue noun.
- Automagic Configuration - Just run
python configure.py --account_sid ACxxxx --auth_token yyyyyand this hackpack will Twilio and Heroku for you.
- Plug-and-Play - Procfile, requirements.txt and Makefile make installation and usage a breeze.
- Testing - Totally tested with examples for you to use in your larger implementations.
- PEP8 - It's good for you!
Install using the Getting Started instructions below and configure a pair of Twilio Phone Numbers with the two links provided - one for callers and one for agents.
Callers are the people who are placed into the Queue, while Agents are the people who answer them. In most implementations, "callers" can be considered customers who need support and "agents" are the service representatives responsible for providing it.
To use this app, purchase two Twilio Phone Numbers and configure one number to use the Caller Voice Request URL and the other to use the Agent Voice Request URL.
For an example in action, be sure to check out Jon Gottfried's screencast.
Step-by-step on how to deploy, configure and develop on this hackpack.
- Get the requirements:
- Grab latest source
git clone git://github.com/RobSpectre/Twilio-Queue-Example.git
- Navigate to folder and create new Heroku Cedar app
- Deploy to Heroku
git push heroku master
- Scale your dynos
heroku scale web=1
- Visit the home page of your new Heroku app to see your newly configured app!
Configure your hackpack with three easy options.
This hackpack ships with an auto-configure script that will create a new TwiML app, purchase a new phone number, and set your Heroku app's environment variables to use your new settings. Here's a quick step-by-step:
- Make sure you have all dependencies installed
- Run configure script and follow instructions.
python configure.py --account_sid ACxxxxxx --auth_token yyyyyyy
- For local development, copy/paste the environment variable commands the configurator provides to your shell.
export TWILIO_ACCOUNT_SID=ACxxxxxx export TWILIO_AUTH_TOKEN=yyyyyyyyy export TWILIO_APP_SID=APzzzzzzzzzz export TWILIO_CALLER_ID=+15556667777
Automagic configuration comes with a number of features.
python configure.py --help to see them all.
local_settings.py is a file available in the hackpack route for you to configure your twilio account credentials manually. Be sure not to expose your Twilio account to a public repo though.
ACCOUNT_SID = "ACxxxxxxxxxxxxx" AUTH_TOKEN = "yyyyyyyyyyyyyyyy" TWILIO_APP_SID = "APzzzzzzzzz" TWILIO_CALLER_ID = "+17778889999"
Setting Your Own Environment Variables
The configurator will automatically use your environment variables if you already have a TwiML app and phone number you would prefer to use. When these environment variables are present, it will configure the Twilio and Heroku apps all to use the hackpack.
- Set environment variables locally.
export TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxx export TWILIO_AUTH_TOKEN=yyyyyyyyyyyyyyyyy export TWILIO_APP_SID=APzzzzzzzzzzzzzzzzzz export TWILIO_CALLER_ID=+15556667777
- Run configurator
Getting your local environment setup to work with this hackpack is similarly easy. After you configure your hackpack with the steps above, use this guide to get going locally:
- Install the dependencies.
- Launch local development webserver
Open browser to http://localhost:5000.
Tweak away on
This hackpack comes with a full testing suite ready for nose.