Giter Club home page Giter Club logo

task-router-laravel's Introduction

Twilio

TaskRouter on Laravel

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 SQLite database to log phone calls which were not assisted.

Read the full tutorial here

Local Development

This project is build using Laravel web framework;

  1. First clone this repository and cd into it.

    $ git clone [email protected]:TwilioDevEd/task-router-laravel.git
    $ cd task-router-laravel
  2. Run the Setup script to configure your project.

    $ php Setup.php

    This will:

    • Create your SQLite database file.
    • Create your .env file for you to add your private credentials.
  3. Edit your .env file to match your configuration.

  4. Install the dependencies with Composer.

    $ composer install
  5. Generate an APP_KEY.

    $ php artisan key:generate
  6. Run the migrations.

    $ php artisan migrate
  7. Expose your application to the wider internet using ngrok.

    This step is important because the application won't work as expected if you run it through 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

  8. Configure a Task Router workflow.

    This application ships with an Artisan command to create and configure the workflow necessary for this application to work. You need to execute this command before running this app.

    $ php artisan workspace:create http://<sub-domain>.ngrok.io <bob_phone> <alice_phone>
    

    The command will modify your .env file with some additional environment variables.

  9. Configure Twilio to call your webhooks

    You will also need to configure Twilio to call your application when calls or SMSs are received on your TWILIO_NUMBER. Your urls should look something like this:

    voice: http://<sub-domain>.ngrok.io/call/incoming (POST)
    
    sms:   http://<sub-domain>.ngrok.io/message/incoming (POST)
    

    Configure webhooks

  10. Make sure the tests succeed.

    $ ./vendor/bin/phpunit
  11. Start the server.

    $ php artisan serve
  12. Check it out at http://localhost:8000.

How To Demo?

  1. Call your Twilio Phone Number. You will get a voice response:

For Programmable SMS, press one. For Voice, press any other key.

  1. Select and 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.

  2. Alternatively, if you don't answer the call for 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.

  3. Each time a worker misses a call, their activity is changed to offline. You should receive an SMS notification to the number that missed the call. You can reply with On or Off to this SMS in order to change a worker's status.

  4. 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.

  5. 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-laravel's People

Contributors

kathyguerron avatar well1791 avatar

Watchers

 avatar  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.