Skip to content

Brettsenna/Twilio-Queue-Example

 
 

Repository files navigation

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.

[Build Status] (http://travis-ci.org/RobSpectre/Twilio-Queue-Example)

Features

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 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!

Usage

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.

Success page

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.

Installation

Step-by-step on how to deploy, configure and develop on this hackpack.

Getting Started

  1. Get the requirements:
  1. Grab latest source
git clone git://github.com/RobSpectre/Twilio-Queue-Example.git 
  1. Navigate to folder and create new Heroku Cedar app
heroku create
  1. Deploy to Heroku
git push heroku master
  1. Scale your dynos
heroku scale web=1
  1. Visit the home page of your new Heroku app to see your newly configured app!
heroku open

Configuration

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
  1. Run configure script and follow instructions.
python configure.py --account_sid ACxxxxxx --auth_token yyyyyyy
  1. 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

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.

  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
  1. Run configurator
python configure.py

Development

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
  1. Launch local development webserver
foreman start
  1. Open browser to http://localhost:5000.

  2. Tweak away on app.py.

Testing

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

make test

Meta

About

A hackpack example using Twilio's new Queue verb.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 84.4%
  • HTML 9.1%
  • CSS 6.2%
  • Makefile 0.3%