SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Managing TaskRouter Workflows and Using the Latest Logic

Overview

When modifying Twilio TaskRouter Workflows, it’s important to understand how changes to your Workflows can impact Tasks that are already in-progress.

This article highlights how Workflow updates are handled, introduces the ReEvaluateTasks property, and provides guidance to ensure your Tasks always benefit from the most recent workflow logic.

 

What You Need To Know

Understanding Workflow Updates and Task Evaluation

When you modify a Workflow (the set of routing instructions for Tasks) from the Twilio Console UI, in-progress Tasks will continue with the routing instructions that were active at the time they entered the Workflow.

This is because the ReEvaluateTasks property is set to false in these requests from the Console. This means any Tasks currently inside the Workflow will continue processing with the old logic, even though the Workflow itself has changed.

This behavior can lead to unexpected routing or errors when attempting to delete Queues still being referenced in previous Workflow logic.

 

Problem Example

Scenario: You need to remove Queue A from your contact center. You remove the Queue from your Workflow and try to delete the Queue. 

Original Workflow:

  1. Try Queue A for 30 seconds
  2. Then go to Queue B indefinitely

Updated Workflow:

  1. Try Queue B for 30 seconds
  2. Then go to Queue C indefinitely

Impact:
You will be unable to delete Queue A, even though your Workflow appears to no longer require it.

This is because in-progress tasks may still route to Queue A, causing errors if you attempt to delete that Queue.

 

 

Applying Updated Logic to All Tasks

If you want all current and future Tasks to be evaluated with the latest Workflow logic, you can update your Workflow using the API or CLI, setting ReEvaluateTasks to true.

Example API Command:

twilio api:taskrouter:v1:workspaces:workflows:update \
--workspace-sid <workspace sid> \
--sid <workflow sid> \
--re-evaluate-tasks true

 

Considerations

  • Tasks in the reserved state cannot receive a Workflow update. For these Tasks, you will need to wait until they return back to the pending state to re-trigger the above request successfully.
    • In most implementations, Tasks move quickly to the reserved state, so timing your update can be difficult. It may be beneficial to repeat this request every second until all Tasks are captured.
  • ReEvaluateTasks cannot be set to true from the Twilio Console.

 

Best Practices for Workflow Management

  • Leverage the API for Significant Changes: Use the API or CLI with ReEvaluateTasks=true when making Workflow updates that should immediately apply to all tasks.
  • Monitor Task Statuses: Keep an eye on current Task states to verify updates propagate as intended.

 

Conclusion

By understanding and taking advantage of the Workflow ReEvaluateTasks property, you can ensure Tasks are always routed according to your latest business logic.

For more information, please see the TaskRouter Workflow API Documentation or contact Twilio Support.

Have more questions? Submit a request
Powered by Zendesk