IVR Reporting using Studio and Flex Insights

December 10, 2019
Written by

figure-insights-reports.bdf8b667c.png

Flex Insights reports rely on interactions for which a Task gets created. If you have a call that abandons in the IVR or gets resolved in the IVR, the default reporting solution will not report on it. This can be frustrating, especially if your contact center relies on these metrics. In this guide, you'll learn how to track these calls in Flex Insights and create IVR Reports from Studio. Let's get started!

As a pre-requisite, you will need a Twilio Account that already has Flex Insights enabled. In order to enable Flex Insights, you will need to select a Flex Billing Plan.

Overview of the Solution

Calls resolved or abandoned in the IVR do not hit the "Send to Flex" widget, and do not have a task created for them. So how do we get these calls into Flex Insights? We'll create a dummy task for them, route it through TaskRouter, and use the attributes of the task to pass data into Flex Insights.

Creating the Studio Flow

I have created a very simple Studio Flow that we will use for this example. Take a look:

IVR Reporting Studio Flow

When the Studio flow executes, the first step will call a function, which will create the dummy task for the reporting. The updateIVRReporting step calls a function that updates the attributes on the dummy task. The deleteIVRReporting step will delete the dummy task. This step is optional. If you do not want to store the IVR data for calls that get answered, then use this function to delete the dummy task.

To each of these functions, you will need to pass the Call Sid as a parameter. The Call Sid can be found here: {{trigger.call.CallSid}}. You are welcome to pass in other variables too.

Creating the TaskRouter Workflow

The dummy task will get routed to a workflow that will ensure that nobody can pick up this Task. I have created a new Workflow called "Assign to Nobody" which sends all Interactions to a queue called Nobody:

IVR Reporting TaskRouter Workflow

Be sure to take a note of the Sid of the Workflow, you will need it for the next step.

Creating the Functions

Here is the source code for the three functions mentioned above:

exports.handler = function(context, event, callback) {

  let client = context.getTwilioClient();

  let conversations = {};
  conversations.conversation_attribute_1 = event.callSid;
  conversations.virtual = "Yes";
  conversations.abandoned = "Yes";
  conversations.kind = "IVR";

  client.taskrouter
    .workspaces(context.TWILIO_WORKSPACE_SID)
    .tasks.create({
      attributes: JSON.stringify({ conversations }),
      workflowSid: context.TWILIO_NOBODY_WORKFLOW_SID,
      timeout: 300
    });

    callback();
}

If you're using Functions v2, in your .env file add a variable called TWILIO_NOBODY_WORKFLOW_SID and set it to the Sid of the workflow you created in the previous step. If you're using Functions v1, simply add this key-value pair to your environmental variables.

Creating the Reports

The last step is to create reports in Flex Insights. I have created a sample report with the following details:

  • Attributes: Segment, Date, Time, Conversation Attribute 1, Abandoned Phase and Kind
  • Filters: "Kind is IVR"

And here's what my report looks like:

IVR Reporting

To get the full value of this solution, you will need to log additional attributes that you will present in the report. However, this should give you an idea as to how to do it. As always, we can't wait to see what you build!

Please check the Fair Usage Policy. Additional tasks created by this solution may lead to additional charges. If you create more tasks (including non-IVR traffic) than covered by Flex Fair Usage Policy you will be charged on per task basis (https://www.twilio.com/taskrouter/pricing).

Want to try Studio, Flex or Flex Insights? Sign up and get started here.

Lehel Gyeresi is a part of the Expert Services team and works as a Contact Center Solutions Consultant. You can reach him at lgyeresi [at] twilio.com.