Skip to content
A hackpack example using Twilio's new Queue verb.

Twilio Queue Example

A hackpack example using Twilio's new Queue verb to create a call-in queue. Not into Python? Check out examples in other languages in the Twilio Howto.



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 --account_sid ACxxxx --auth_token yyyyy and 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.

Getting Started

0) Get the requirements:

1) Grab latest source

git clone git:// 

2) Navigate to folder and create new Heroku Cedar app

heroku create

3) Deploy to Heroku

git push heroku master

4) Scale your dynos

heroku scale web=1

5) Visit the home page of your new Heroku app to see your newly configured app!

heroku open


Configure your hackpack with three easy options.

Automagic Configuration

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:

1) Make sure you have all dependencies installed

make init

2) Run configure script and follow instructions.

python --account_sid ACxxxxxx --auth_token yyyyyyy

3) For local development, copy/paste the environment variable commands the configurator provides to your shell.

export TWILIO_AUTH_TOKEN=yyyyyyyyy
export TWILIO_APP_SID=APzzzzzzzzzz
export TWILIO_CALLER_ID=+15556667777

Automagic configuration comes with a number of features.
python --help to see them all. 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.

1) Set environment variables locally.

export TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxx
export TWILIO_AUTH_TOKEN=yyyyyyyyyyyyyyyyy
export TWILIO_APP_SID=APzzzzzzzzzzzzzzzzzz
export TWILIO_CALLER_ID=+15556667777

2) 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:

1) Install the dependencies.

make init

2) Launch local development webserver

foreman start

3) Open browser to http://localhost:5000.

4) Tweak away on


This hackpack comes with a full testing suite ready for nose.

make test


Something went wrong with that request. Please try again.