Giter Club home page Giter Club logo

outbound-callerid's Introduction

Outbound Caller ID Plugin

Twilio Flex Plugins allow you to customize the appearance and behavior of Twilio Flex. If you want to learn more about the capabilities and how to use the API, check out our Flex documentation.

How it works

This Flex plugin add a Caller Id selection menu to the Dialpad to allow agents making outbound calls to pick the appropriate Outbound Caller Id for each call.

This plugin leverages a Twilio Function to read the list of caller Ids from an Json config file asset upon initialization. The array is stored in the application's Redux store. This config file should be updated with the Phone Numbers you have provisioned in your Twilio account. Since customers could call you back on these numbers, they should route back into your Flex application through Studio Flows & TaskRouter.

A beforeStarOutboundCall action listener is added to override the payload.callerId attribute with the selected caller Id.

Additionally this plugin includes functionality to play an announcement to both the customer and agent/worker that the Call May Be Recorded for Quality Purposes. After the outbound call task reservation has been accepted by the worker, the plugin waits for the customer to join the conference before updating the conference with the announceUrl

Create a new Twiml Bin with this Twiml:

<Response>
    <Say>This call will be recorded for training and monitoring purposes</Say>
</Response>

Next update the FLEX_APP_ANNOUNCE_URL environment variable with your Twiml Bin URL (or link to mp3/wav file)

Configuration

Requirements

To deploy this plugin, you will need:

  • An active Twilio account with Flex provisioned. Refer to the Flex Quickstart to create one.
  • npm version 5.0.0 or later installed (type npm -v in your terminal to check)
  • Node.js version 12 or later installed (type node -v in your terminal to check). We recommend the even versions of Node.
  • Twilio CLI along with the Flex CLI Plugin and the Serverless Plugin. Run the following commands to install them:
# Install the Twilio CLI
npm install twilio-cli -g
# Install the Serverless and Flex as Plugins
twilio plugins:install @twilio-labs/plugin-serverless
twilio plugins:install @twilio-labs/plugin-flex

Setup

Install the dependencies by running npm install:

cd plugin-outbound-callerid
npm install
cd ../serverless
npm install

From the root directory, rename public/appConfig.example.js to public/appConfig.js.

mv public/appConfig.example.js public/appConfig.js

Serverless Function and Asset

This plugin includes a Twilio function that reads a config file (Twilio Asset). The config file (config.private.json) contains the list of Twilio phone numbers that the agent can select from. Update this file to match your list of allowed (and provisioned) Twilio phone numbers associated with Flex (Inbound Studio IVR flows).

Deployment

cd serverless
twilio serverless:deploy

After successfully deploying your function and asset (config file), you should see at least the following:

✔ Serverless project successfully deployed

Functions:
   https://config-functions-xxxx-dev.twil.io/get-asset-file
Assets:
   [private] Runtime.getAssets()['/config.json']

Your function will now be present in the Twilio Functions Console and be part of the "config-functions" service. Copy the base URL from the function.

Flex Plugin

Development

Create the plugin config file by copying .env.example to .env.

cd plugin-outbound-callerid
cp .env.example .env

Edit .env and set the FLEX_APP_FUNCTIONS_BASE variable to your Twilio Functions base URL (like https://config-functions-xxxx-dev.twil.io).

To run the plugin locally, you can use the Twilio Flex CLI plugin. Using your command line, run the following from the root directory of the plugin.

cd plugin-outbound-callerid
twilio flex:plugins:start

This will automatically start up the webpack dev server and open the browser for you. Your app will run on http://localhost:3000.

When you make changes to your code, the browser window will be automatically refreshed.

Deploy your Flex Plugin

Once you are happy with your Flex plugin, you have to deploy then release it on your Flex application.

Run the following command to start the deployment:

twilio flex:plugins:deploy --major --changelog "Releasing Outbound Caller Id plugin" --description "Outbound Caller Id plugin"

After running the suggested next step, navigate to the Plugins Dashboard to review your recently deployed plugin and confirm that it’s enabled for your contact center.

Note: Common packages like React, ReactDOM, Redux and ReactRedux are not bundled with the build because they are treated as external dependencies so the plugin will depend on Flex to provide them globally.

You are all set to test this plugin on your Flex application!

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

outbound-callerid's People

Contributors

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