The Flex Supervisor Barge-In and Coach solution allows contact center supervisors to barge in and coach agents while they are on a live call. When the supervisor barges in, he/she will now join the call between the agent and the customer. When the supervisor coaches the agent, he/she can listen to the call between the customer and the agent, and can provide feedback to the agent without the customer hearing it. The supervisor can also listen to the call in incognito mode.
This solution enhances the supervisor’s UI with three buttons for barging in and coaching, and a coaching mode. Within Teams View, you can click on the agent you wish to coach and the buttons will be available once you begin to observe the live call.
First, select the call you wish to observe.
This brings up the Call Canvas where you can click on the Monitor button to enable the Barge-In and Coach buttons.
The Barge-In button in the middle allows you to join the call between an agent and a customer. You can toggle the button to mute and unmute yourself. The Coach button on the right allows you to only talk to the agent you are observing, leaving the customer out of the coaching segment of the call. Toggling this button enables Coach mode and the left button converts to a Mute/Unmute button for the coaching mode.
When monitoring is enabled, you can click on the eye icon to toggle between Normal and Private mode. Normal Mode displays the coaching supervisor's name to the agent while Private Mode keeps the coaching information hidden.
To deploy this solution, you will need:
- An active Twilio account with Flex provisioned. Refer to the Flex Quickstart to create one.
- npm version 5.0.0 or higher (type
npm -vin your terminal to check)
- Node.js version 12 or higher (type
node -vin your terminal to check)
- Twilio CLI along with the Flex Plugins CLI and the Serverless Toolkit. Run the following commands to install them:
# Install the Twilio CLI npm install twilio-cli@latest -g # Install the Serverless and Flex as Plugins twilio plugins:install @twilio-labs/plugin-serverless twilio plugins:install @twilio-labs/plugin-flex
If you're running Linux, click on the Linux tab for the Twilio CLI installation instructions. If you're running Windows, make sure to run the Windows command prompt as an administrator to install the Serverless and Flex plugins for the Twilio CLI. The Windows commands in this guide use PowerShell (for Node.js/npm installation) and the Node.js command prompt for all subsequent steps.
- Flex v1.125.4-1.26.3
- macOS / Unix
- Windows 10
In order to use the solution, you need to prepare your Flex Task Assignment workspace.
Navigate to your Flex project in the Twilio Console. Copy your ACCOUNT SID and AUTH TOKEN, and create a new Twilio CLI profile using those credentials:
You will be prompted to enter your Twilio Account SID, Auth Token, and a shorthand identifier for your profile. When choosing a shorthand identifier, pick one that is meaningful and easy to remember. Once your profile has been created, activate it by running:
twilio profiles:use <profile_name>
Keep in mind that this account will be used for the rest of the deployment. In order to switch accounts, use the following command:
twilio profiles:use <different_profile>
Retrieve your Flex Task Assignment workspace ID:
Example Workspace SID
SID Friendly Name Prioritize Queue Order WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Flex Task Assignment FIFO
To retrieve your Flex workspace SID from the Twilio Console, navigate to the TaskRouter Dashboard.
Download the plugin source code here and unzip the files in a local directory.
You can view the source code on GitHub: https://github.com/twilio-professional-services/plugin-supervisor-barge-coach
We will deploy the Barge-in and Coach functions to your Flex application. The functions are called from the plugin you will deploy in the next step and integrates with TaskRouter, passing in required attributes to perform the chat transfer.
Step 1: Change into the
functions directory and rename .env.example.
plugin-supervisor-barge-coach $ cd functions && mv .env.example .env
C:\Users\username\plugin-supervisor-barge-coach> cd functions && move .env.example .env
1 file(s) moved.
Step 2: Open
.env and set the environment variables mentioned in the file.
TWILIO_ACCOUNT_SID = your Account SID from twil.io/console TWILIO_AUTH_TOKEN = your Auth Token from twil.io/console
TWILIO_WORKSPACE_SID = your Flex Task Assignment workspace ID
Step 3: Run
npm install in the
Step 4: Deploy the Twilio functions to your account using the Twilio CLI:
When running on Windows, you may see an error with the Twilio Serverless deployment command. To work around the issue, set your
TWILO_AUTH_TOKEN as environment variables. Refer to the previous section for examples on how to set an environment variable in Windows.
⠇ Creating 1 Functions ✔ Serverless project successfully deployed Deployment Details Domain: https://barge-coach-XXXX.twil.io Service: barge-coach (ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX) ...
Step 4: Copy and save the domain returned when you deploy a function. You will need it in the next step.
If you forget to copy the domain, you can also refer to it by navigating to Functions > API.
Debugging Tip: Pass the
-l or logging flag to review deployment logs. For example, you can pass
-l debug to turn on debugging logs.
Once you have deployed the function, it is time to deploy the plugin to your Flex instance.
Run the following commands in the plugin directory. We will leverage the Twilio CLI to build and deploy the Plugin.
plugin-supervisor-barge-coach $ npm install
From the plugin directory, rename the
.env.example file to
.env and update the variables with the appropriate values:
var REACT_APP_SERVICE_BASE_URL = https://barge-coach-XXXX-dev.twil.io
Paste the domain from Step 4 into the
REACT_APP_SERVICE_BASE_URL variable. The function deployed in the previous step is called by the plugin source code.
To update the
REACT_APP_TASK_CHANNEL_SID variable, run the following:
twilio api:taskrouter:v1:workspaces:task-channels:list --workspace-sid WSxxxxxxxxxxxxxxxxxx
When you are ready to deploy the plugin, run the following in a command shell:
twilio flex:plugins:deploy --major --changelog "Deploying major version of Barge-in and Coach plugin" --description "Supervisor Barge-in and Coach plugin"
√ Validating deployment of plugin plugin-supervisor-barge-coach | Compiling a production build of plugin-supervisor-barge-coachPlugin plugin-supervisor-barge-coach was successfully compiled with some warnings. √ Compiling a production build of plugin-supervisor-barge-coach √ Uploading plugin-supervisor-barge-coach √ Registering plugin plugin-supervisor-barge-coach with Plugins API √ Registering version v1.0.0 with Plugins API 🚀 Plugin (private) email@example.com was successfully deployed using Plugins API Next Steps: Run $ twilio flex:plugins:release --plugin firstname.lastname@example.org --name "Autogenerated Release 1624517195294" --description "The description of this Flex Plugin Configuration." to enable this plugin on your Flex application
The previous step only deploys your plugin. You still need to enable the Plugin on your Flex application. To enable, run the following:
twilio flex:plugins:release --plugin email@example.com --name "Autogenerated Release 1624570680076" --description "Enabling Barge-in and Coach for supervisors."
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.
You are all set to test the Barge-in and Coach functionalities on your Flex application!
Keep in mind that your agents need to refresh their browsers in order to get the latest changes.
Testing will require two users on your Flex account with admin privileges. Logging in as an administrator enables you to access both the supervisor and the agent views. If you are testing it by yourself, log in to your Flex application with the two user credentials. Ensure that you are using two separate browser windows, one in incognito mode. In one window, you should be logged in as an agent accepting a call, while in the other as a supervisor observing/coaching the agent.
Step 1: Change your agent status to Available on the upper right corner of the Flex UI. This enables you to receive incoming calls.
Step 2: Call the number associated with your Flex instance (you can find the Twilio-provisioned number for your Flex instance on the Admin panel under "Test Drive").
Step 3: Switch to the supervisor session and navigate to the Teams View Tab. Click the phone icon to observe an ongoing agent call.
Step 4: From the supervisor session, click the Monitor button. This enables the Barge-In and Coach buttons.
Clicking Barge-In unmutes the supervisor and allows all parties (agent and customer) to hear the supervisor. Toggle this on/off to test.
Clicking Coach unmutes you only to the agent/worker you are observing. No other participant on the call will hear you.
Clicking on the Normal Mode button toggles you between normal and incognito mode.