twiliotwilio-taskrouter

Twilio TaskRouter: How to match worker based on activity


In a routing step I would like to only match a task to a worker if that worker is in a specific activity; I've created a custom activity called 'outbound'. I've tried the following in the expressions

worker.activity == "outbound" 

and

worker.activity_name == "outbound"

both of these did not work; is this possible to do


Solution

  • Twilio developer evangelist here.

    When matching against worker attributes within a TaskRouter expression you can only match against keys in the worker's attributes JSON object.

    If you have a set of workers that is meant for outbound work and a different set that work on inbound work then I would keep the standard activities and add attributes to each worker to define their work. You can then direct calls in expressions using that attribute.