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.

Setting Up Alerts When Tasks Are Queued with No Workers Available in Twilio Flex

Overview

This article explains how to configure alerts in Twilio Flex (using TaskRouter) to notify you when a task is in a queue but no workers are available to handle it. This is a common requirement for contact centers that want to ensure no customer requests go unattended, especially when managing a large number of queues.

You want to be alerted when:

  • A task is placed in a queue (e.g., an incoming call or chat)
  • There are no available workers to handle the task (all are offline, busy, or otherwise unavailable)

 

Environment

legacy Twilio Console

 

What You Need To Know

Twilio Flex does not provide an out-of-the-box alert specifically for this scenario. However, you can achieve this using TaskRouter’s event callbacks and custom alerting logic.

1. Use TaskRouter Event Callbacks

TaskRouter emits events for all task and worker activities. The most relevant events for this use case are:

  • task.created: Triggers when a new task is created.
  • workflow.timeout: Triggers when a task reaches the end of a workflow without being accepted and is removed from the workspace

How to set up:

  • Configure a webhook endpoint to receive TaskRouter event callbacks.
    TaskRouter Event Reference
  • In your webhook handler, listen for task.created and workflow.timeout events.
  • When a workflow.timeout event occurs, check if the task is canceled due to workflow timeout.

 

2. Implement Custom Alerting Logic

Once your webhook receives the relevant event:

  • Trigger an alert (e.g., send an email, SMS, or push notification) to supervisors or monitoring systems.
  • Optionally, log these events for reporting and analytics.

Example Workflow:

  1. Task is created and enters a queue.
  2. TaskRouter attempts to assign the task.
  3. If no workers are available, a workflow.timeout event is sent to your webhook.
  4. Your webhook logic sends an alert to the appropriate team.

 

3. Monitoring at Scale

If you have many queues (e.g., 200+), ensure your webhook logic can handle events from all queues and aggregate alerts as needed to avoid alert fatigue.

 

Frequently Asked Questions

Can I set up this alert directly in the Twilio Console?

No, this specific alert requires custom logic using TaskRouter event callbacks.

 

What if I want to alert only for certain queues?

Filter the events in your webhook logic based on the queue SID or name.

 

Are there any pre-built plugins for this?

As of now, this requires custom development, but you can leverage Flex Plugins to enhance notification capabilities in the Flex UI.

 

Conclusion

While Twilio Flex does not offer a built-in alert for tasks queued with no available workers, you can implement this functionality using TaskRouter event callbacks and custom alerting logic. This approach provides flexibility and can be tailored to your organization’s needs, regardless of the number of queues you manage.

Below you will find references to useful documents:

If you need assistance implementing this solution or have questions about your specific setup, please consult the Twilio documentation or reach out to your Twilio representative.

Have more questions? Submit a request
Powered by Zendesk