Rate this page:

Send to Flex



For Flex-enabled accounts, Send To Flex transfers an incoming call or message to Flex by creating a TaskRouter Task. Voice calls are enqueued and the caller will hear hold music while waiting for a matched Flex Worker to accept the voice task. Messages are transferred to Flex as new tasks for assignment to a Worker. Twilio Flex accounts come enabled with three flows that use the Send to Flex widget with the following default attributes:

Voice IVR Flow

{ "type": "inbound", "name": "{{}}" }

Messaging Flow/Webchat Flow:

  "name": "{{trigger.message.ChannelAttributes.from}}",
  "channelType": "{{trigger.message.ChannelAttributes.channel_type}}",
  "channelSid": "{{trigger.message.ChannelSid}}"

Required Configuration:

You must select a Workflow and a Channel when configuring this Widget.




The name of the TaskRouter Workflow you want to assign to your Studio Flow. The SID of your selected Workflow is reflected on the widget itself.


The TaskRouter Task Channel used by your Studio Flow. Only Voice and Programmable Chat are currently supported (select Programmable Chat for SMS, WhatsApp or Facebook).

Optional Configuration:

You may optionally declare Task attributes, priority, timeout, hold music TwiML URL and associated URL method for the request initiated by this Widget.




The priority of this task in the TaskQueue. Tasks with a higher priority are assigned before older tasks with a lower priority. If not specified, this will be treated as 0 during evaluation.


The amount of time in seconds that the task is allowed to live. Defaults to 24 hours (or 86400 seconds) if not supplied with allowed max value of up to two weeks.


JSON representing the Task attributes (max. 1024 characters). Default values shown above.

When building this JSON make sure to consider the Flex Insights Data Model. Flex Insights is opinionated on where you put metadata about the Task (conversation) and customer.

URL Method

HTTP method to be used when requesting the Hold Music TwiML URL (GET or POST).

Hold Music TwiML URL

The URL for custom hold music while the customer waits in the queue. If not specified, the default hold music will play upon transfer. Related to the Enqueue TwiML Verb.

If you want to pass an object — for instance, data that you retrieved via a function — as an attribute value in your Task Attributes, you can use the to_json Liquid Template Filter like this:

"customer_attributes": {{widgets.CustomerFunction.parsed | to_json}}




Task Created

For Voice calls, transition is triggered when the Enqueue action URL is requested. For Messages, transition is triggered as soon as the TaskRouter Task is created.

Failed to Create Task

For Voice calls, transition is triggered if enqueuing of the call fails. For Messages, transition is triggered immediately when TaskRouter returns an error for Task creation.

Call Failed

Only applies to Voice calls. Transition is triggered if QueueResult is "system-error".

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. Please select the reason(s) for your feedback or provide additional information about how we can improve:

        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