In a modern contact center that serves customers over multiple channels, realtime monitoring of the tasks and their progress becomes an operational imperative. Twilio provides all the necessary building blocks to build a contact center (https://github.com/nash-md/twilio-contact-center) and the ability to build a realtime task monitoring dashboard using Twilio Sync (https://www.twilio.com/sync).
This demo shows how an operational monitoring dashboard could be built. I've used the following technologies to built this dashboard:
- Twilio TaskRouter (https://www.twilio.com/taskrouter)
- Twilio Sync (https://www.twilio.com/sync)
- Server side app using Python and Twilio REST APIs (TaskRouter, Sync)
- Dashboard app components: 4.1) Javascript framework Vue.js (https://vuejs.org) 4.2) UI framework Semantic-ui (https://semantic-ui.com) 4.3) Twilio Sync JS SDK (https://www.twilio.com/docs/api/sync/quickstart-js)
- TaskRouter generates the event and calls the Event Callback URL associated with the workspace
- This invokes the server side python app to consume the event and call the additional Twilio TaskRouter Statistics APIs to get aggregated statistics
- Next, the Sync documents are updated with changes using the Sync REST APIs
- The frontend web app subscribes to the same Sync documents for changes vis the Sync JS SDK
- When changes are detected by the frontend, the UI is updated
Note: Please keep in mind the source code shared here (JS and Python) is pretty much demo quality. For production use, I am sure the code can be optimized significantly.
This will install the web application and all the dependencies on Heroku (login required) for you. As part of the installation, the Heroku app will walk you through configuration of environment variables. Please click on the following button to deploy the application.
Make a note of the URL that Heroku created for your app as you'll need it for the next Step
- In your Twilio console (login required), go to your TaskRouter workspaces (https://www.twilio.com/console/taskrouter/workspaces/)
- Select the correct workspace and click on "Settings" (https://www.twilio.com/console/taskrouter/workspaces/<WORKSPACE_SID/settings)
- Select the "Callback Events" as selected below
- Specify the "Event Callback URL" as https://<YOUR_HEROKU_APP_URL>/taskrouter_event
- Save the changes
Now, Navigate to https://<YOUR_HEROKU_APP_URL>/taskrouter_dashboard.html
As events are generated in your TaskRouter workspace the dashboard will display key metrics.