Git Product home page Git Product logo

twilio-flex-sample-backend's Introduction

twilio-flex-sample-backend

This project is a demo backend service that supports various sample front end plugins to twilio flex

Services

To support outbound dialing with conference

It exposes a secure websocket with authentication that can be used to:

  • trigger a call from a client
  • push updates of the call status back to that client
  • hang up a call for a given client

It also exposes two end points that are called by twilio when:

  • providing updates to the status of calls generated by this server
  • twilio retrieves a twiml document to describe how to handle a call when it is answered

Dependencies

Before setting up this server you must first created a dedicated TaskRouter workflow for outbound calls. You can do this here. Make sure it is part of your Flex Task Assignment workspace.

  • ensure there is the following matching workers expression for the only filter on the workspace
    • task.targetWorker==worker.contact_uri
  • ensure the priorty of the filter is set to 1000 (or at least the highest in the system)
  • make sure the filter matches to a queue with Everyone on it. The default Everyone queue will work but if you want to seperate real time reporting for outbound calls, you should make a dedicated queue for it with a queue expression
    • 1==1

alt text

Setup

You can now setup the server, you can either deploy to heroku (which is free, you just need a login) or you can setup locally and expose via ngrok

Deploying to heroku

  1. Use this link to begin Deploy

  2. Populate the given variables when prompted

    • TWILIO_OUTBOUND_WORKFLOW_SID - the SID of the workflow you just created - used for creating tasks
    • TWILIO_ACCOUNT_SID - the account sid of your twilio account - used for calling Twilio APIs
    • TWILIO_AUTH_TOKEN - the auth token of your twilio account - used for calling Twilio APIs
    • EXTERNAL_HOST - the host that exposes this service - used for telling Twilio where to make callbacks when calling the Twilio APIs. Should be of the form <HEROKU_APP_NAME>.herokuapp.com
  3. You're all set, the backend is ready. You can access it on https://<HEROKU_APP_NAME>.herokuapp.com

Deploying locally

  1. Clone repository using git clone
  2. run npm install
  3. clone the .env.sample
  4. update .env.sample as approproate, descriptions above
  5. run ngrok http 3000
  6. start server using npm start

change log

v1.3 - added authentication provider for websocket using api token provided by twilio via flex

v1.2 - migrated repository over to "twilio-flex-sample-backend" to be used with other plugins other than outbound dial, inroduced dotenv

v1.1 - updated websocket endpoint to reflect its dedicated to outbound calling

v1.0 - initial release

TODOs

twilio-flex-sample-backend's People

Contributors

jared-hunter 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.