The skills listed on our volunteer worker allow TaskRouter to determine who’s available to help with which tasks.
Grouping Our Disaster Dispatchers with TaskQueues
Now that we’ve added attributes to our user, we need to tell Flex how to group our users. We can do this using TaskQueues. You can think of TaskQueues as groups of volunteers with different skills that are lining up to help our inbound callers. To define a TaskQueue, go to your Flex TaskRouter Workspace and then click on “TaskQueues” in the sub menu.
TaskRouter with three TaskQueues configured.
Click on the red “+” button on the top-left to create a new TaskQueue. We can name the first TaskQueue “Dispatchers”. Next, we have to tell the TaskQueue which workers can function as dispatchers. We can do this by setting the queue expression to check if our worker has the dispatch skill. This routing expression should do the trick:
routing.skills HAS "dispatch"
You should see a worker (yourself) appear in the list of matching workers. If you don’t, click on the “Workers” tab in the side menu and make sure the JSON that defines your worker includes the dispatch skill. Another easy mistake to make is forgetting the quotes around “dispatch”. We need those to tell our routing expression that “dispatch” is a string.
Click the red “Save” button and you’ve just created your first TaskQueue! Next, go through the same process except for Donation Managers.
Routing Tasks to Groups with TaskQueues
Now that TaskRouter knows which workers should go into which line, we need to define how these lines (queues) work. This could include which tasks go to which lines, how lines are ordered, how long to wait before passing a call down the line, and how to pass tasks between lines. Follow these steps to configure your Workflow:
- In the sidebar, click on “Workflows” and then click on the red “+” button to make a new Workflow.
- Name your workflow “Assign to Dispatch”.
- Click “Add a Filter”.
- In “Matching Tasks” enter
skill == "dispatch”
so that this group of workers only get tasks that require assistance from a dispatcher. - Next to Queue, select “Dispatchers”.
- At the bottom of the page, click “Save”.
Now all tasks that have the skill attribute “dispatch” will be routed to our group of dispatchers. Go ahead and create a workflow for Donation Managers as well.
Setting Task Attributes in Studio
But wait, how do we set the skill attribute on an incoming call task? To configure that we need to go back to Studio. We started with only one “Send to Flex” widget in our Studio Flow, but now we can add another. Connect one widget to the “Dispatch” option that we set in the split block and configure the other widget to “Donations” and “Match”.
If we click on one of the Send to Flex widgets, we’ll see an input box titled attributes. This can be a JSON blob of data that describes our task. For example, it might look something like: