Menu

Routing Part 2: Set Up Queues and Skills-based Routing

In part 1 of this tutorial series, you learned how to set up skills in the Flex UI and assign them to your agents. In this tutorial, we will cover how to create Task Queues, Workflows, and Studio Flows to enable skills-based routing for your contact center.

Create a Task Queue

You can create Task Queues via the Twilio Console or the API. This tutorial will focus on using the Console for queue creation:

    1. In the Twilio Console, navigate to TaskRouter. Select TaskRouter from the left nav or use the “Go to” search box in the upper right corner of the screen.
    2. From the TaskRouter dashboard, navigate to Workspaces > Flex Task Assignment. This is where your Flex routing configuration is managed.
    3. Next, we will create two new Task Queues. These will be the queues used to separate Customer Service, HR and IT. By default, Flex comes with a single queue: the "Everyone" queue.
    4. To create our additional queues, select TaskQueues from the Flex Task Assignment menu:
      1. Create new Task Queues for each Queue by pressing plus (‘+’) at the top of the page:
      2. Enter a TaskQueue Name, set Max Reserved Workers to 1, and provide the appropriate Queue Expression.
      3. Create two queues: one for Customer Service and one for Employee Service.
        customer-service-queue.png
        • First TaskQueue Name: Customer Service
          Queue Expression: routing.skills HAS "Customer Service"
        • Second TaskQueue Name: Employee Service
          Queue Expression: routing.skills HAS "HR" OR routing.skills HAS "IT"

        You should then see two additional queues on your account's TaskQueues page.

Create your Workflows

Workflows are used to deliver Tasks to the appropriate Task Queue. The TaskRouter Workflow is where you can use powerful expressions to create skills and attribute-based routing strategies. For this example, we will create a simple queue strategy for Customer Service and a skills-based routing strategy for Employee Service.

Check out the TaskRouter Workflow Docs to learn more about Workflow Expressions.

  1. Select Workflows from the Flex Task Assignment menu:
  2. Create a new Workflow for the Customer Service queue. Click plus (‘+’) at the top of the page to add a new Workflow.
  3. Enter "Transfer to Customer Service" as the Workflow Name and set the Task Reservation Timeout to 20 seconds. Task Reservation Timeout is the amount of wait time in seconds for TaskRouter to wait for a specific worker (or agent) to accept an incoming task, before moving on to the next qualified agents. By default, it is set to 120 seconds.
  4. Now add a Filter to the Workflow. Set the filter name to ‘Customer Service’, and select ‘Customer Service’ as the Queue.

  5. Next, we will create another Workflow for Employee Service. Name the workflow Transfer to Employee Service and set the Task Reservation Timeout to 20 seconds. For this Workflow, we will create two filters: one for HR and one for IT.
    • First Filter
      • Name: HR
      • Matching Tasks: "HR" IN task.skillsNeeded
      • Task Queue: Employee Service
      • Expression: routing.skills HAS "HR"
      • Priority: 100 (This optional field can be used to prioritize calls. We will set a priority to ensure HR tasks are answered before IT tasks.)
    • Second Filter
      • Name: IT
      • Matching Tasks: "IT" IN task.skillsNeeded
      • Task Queue: Employee Service
      • Expression: routing.skills HAS "IT"
    • Default Queue: Employee Service

Set up Studio Flows

With our Task Queues defined, we will now build out two simple Studio Flows for voice routing. In this tutorial, we’ll only cover Voice Studio Flows but these same concepts apply for other channels such as SMS.

Navigate to Studio in the Console. On this page, you will see three default Studio Flows. Locate the Voice IVR flow and click Duplicate Flow.

The new flow “Copy of Voice IVR” will open.

Customer Service Voice IVR

Let’s change this name by clicking on the Trigger widget. On the widget configuration, change the Flow Name to "Customer Service Voice IVR".

customerserviceflow1.png

Select the SendCallToAgent Widget and configure the widget to use the Transfer to Customer Service Workflow.

customerserviceflow2.png

Click Save on the Widget Config and Publish the Studio Flow.

This basic flow delivers all incoming calls directly to the Customer Service queue.

To properly route incoming calls, remember to associate your Flex phone number with your desired Studio Flow.

You can use the various tools in the widget library to build out a more personalized inbound call flow. You could explore the HTTP Request widget for doing REST API calls, try the Say/Play widget to play audio files, or recreate text-to-speech prompts.

Employee Service Voice IVR

For now, let’s return to the main Studio screen and repeat the steps to create a Studio Flow for Employee Service. This time, we will add a basic menu to determine if the caller needs to speak to HR or IT.

employeeserviceflow.png

  • Trigger: Set the Flow Name to "Employee Service Voice IVR".
  • Gather_EmployeeMenu: Add a Gather widget prompting the caller to “enter 1 for HR or 2 for IT”.
  • Split_EmployeeMenu: Add a Split widget to evaluate the digits. This widget should evaluate the digits output from the Gather_EmployeeMenu widget. Add a transition for both “equals to 1” and “equals to 2” conditions.
  • Duplicate the SendCallToAgent Widget; name one of them HR_SendCallToAgent and the other IT_SendCallToAgent.
  • HR_SendCalltoAgent: Set the Workflow to Transfer to Employee Service. In the attributes section, add a new property to the JSON object: “skillsNeeded”:”HR”
      • Attributes:
        {
         "type": "inbound",
        "name": "{{trigger.call.From}}",
         "skillsNeeded": "HR"
        }
        

    IT_SendCalltoAgent: Set the Workflow to Transfer to Employee Service. In the attributes section, add a new property to the JSON object. “skillsNeeded”:”IT”

      • Attributes:
        { "type": "inbound", "name": "{{trigger.call.From}}", "skillsNeeded": "IT" }
  • Click Save and Publish to save and publish your changes.

In this section, we’ve built a simple Voice IVR with Twilio Studio to get you started. At this point, callers will be able to dial in and use ‘1’ and ‘2’ to route into the HR and IT queues, respectively. However, we’re barely scraping the surface with Studio to highlight the queues and routing. We encourage you to play with Studio and add additional functionality.

Check out these great resources for building more with Studio:

Test Your Queues and Skills Routing

Now that everything is configured, you can start testing.

Step 1: Navigate to the Phone Numbers page in the Console and click on the number associated with your Flex instance.

Step 2: Scroll down to the "Voice" section and update the incoming call trigger with the Studio Flow that you created. Select "Customer Service Voice IVR" to test the "Customer Service Voice IVR" Studio Flow. Otherwise, select "Employee Service Voice IVR".

Step 3: Click Save.

Step 4: Place a few test calls into your new Flex phone numbers. You can verify that the call was routed correctly by viewing the Real-Time Queues View or by clicking the Info tab on the Agent Desktop.

info-tab.png

If you are not seeing the calls route to the correct queues, review your Queue Expression and Workflow expressions. Make sure these match up with what was displayed when you set up the skills. Also ensure that your Flex number is associated with the right Studio Flow.

Summary

You have now enhanced your basic call center with two queues, and have added skills-based routing to route inbound calls to qualified agents. We hope this got your creative juices flowing for ways you can implement your contact center business processes with the combination of Studio and TaskRouter.

Maria Bermudez
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more