Giter Club home page Giter Club logo

task-router-django's Introduction

Twilio

Task Router - Python/Django

Build Status

Use Twilio to provide your user with multiple options through phone calls, so they can be assisted by an agent specialized in the chosen topic. This is basically a call center created with the Task Router API of Twilio. This example uses a PostgreSQL database to log phone calls which were not assisted.

Read the full tutorial here

Prerequisites

  1. Python [2.7, 3.4] installed in your operative system.
  2. A Twilio account with a verified phone number. (Get a free account here.) If you are using a Twilio Trial Account, you can learn all about it here.

Local Development

  1. First clone this repository and cd into it.

    $ git clone [email protected]:TwilioDevEd/task-router-django.git
    $ cd task-router-django
    
  2. Create a new virtual environment.

  3. Setup your configuration in your local environment.

    You can use the .env.example in a Unix based operative system with the source command to load the variables into your environment:

    $ source .env.example

    Otherwise load them manually.

  4. Install the required dependencies, contained in requirements.txt.

    $ pip install -r requirements.txt
  5. Run the migrations.

    python manage.py migrate
  6. Make sure the tests succeed.

    $ python manage.py test --settings=twilio_sample_project.settings.test
  7. Start the server.

    $ python manage.py runserver
  8. Expose your local web server to the internet using ngrok.

    You can click here for more details. This step is important because the application won't work as expected if you run it using localhost.

    $ ngrok http 8000

    Once ngrok is running open up your browser and go to your ngrok URL. It will look something like this:

    http://<sub-domain>.ngrok.io/

  9. Configure Twilio to call your webhooks.

    You will also need to configure Twilio to call your application via POST when phone calls are received on your Twilio Number. The configuration of Voice should look something like this:

    http://<sub-domain>.ngrok.io/call/incoming
    

    Configure SMS

How to Demo

  1. First make sure you have exported all the required environment variables from the .env.example file. Bob and Alice's number should be two different numbers where you can receive calls and SMSs.

  2. When you run the app, a new workspace will be configured. Once that is done, you are ready to call your Twilio Number where you'll be asked to select a product using your key pad.

  3. Select an option and the phone assigned to the product you selected (Bob or Alice's) will start ringing. You can answer the call and have a conversation.

  4. Alternatively, if you don't answer the call within 15 seconds, the call should be redirected to the next worker. If the call isn't answered by the second worker, you should be redirected to voice mail and leave a message. The transcription of that message should be sent to the email you specified in your environment variables.

  5. Each time a worker misses a call, their activity is changed to offline. Right after they should receive a notification, via SMS, saying that they missed the call. In order to go back online they can reply with On. They can as well reply with Off in order to go back to offline status.

  6. If both workers' activity changes to Offline and you call your Twilio Number again, you should be redirected to voice mail after a few seconds as the workflow timeouts when there are no available workers. Change your workers status with the On SMS command to be able to receive calls again.

  7. Navigate to https://<ngrok_subdomain>.ngrok.io to see a list of the missed calls.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

task-router-django's People

Contributors

shyba avatar mosampaio avatar eliux avatar acamino avatar kathyguerron avatar mcelicalderon avatar

Watchers

James Cloos avatar Malak Lopez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.