Menu

Expand
Rate this page:

Invites Subresource

This Twilio product is currently available as a Beta release. Some features are not yet implemented and others may be changed before the product is declared as Generally Available. Use of this Beta release is subject to the relevant terms of the applicable license agreement. Beta products are not covered by a Twilio SLA. Learn more about beta product support.

Flex Conversations requires Flex UI 2.0. If you are on Flex UI 1.x, please refer to Messaging in Flex pages.

The Interaction Channel Invite subresource allows you to add an agent as a new participant to an existing interaction channel.

/Interactions/<interaction_sid>/Channels/<channel_sid>/Invites

Use this endpoint to:

The invite creates a new task for the existing interaction which will result in reservations offered to the agent(s).

Remember to handle certain terminal TaskRouter events according to you application's needs, as conversations may stay orphaned with an open state.

See Conversations Best Practices for details.

Interaction Channel Invite properties

Parameter Sub-field Description

Routing [required]

A JSON Object representing the routing rules for the Interaction Channel. See Outbound SMS Example for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality.

properties [required]

Fields needed to create a task:

workspace_sid [required] The TaskRouter Workspace SID which starts with WS.

workflow_sid [optional] The Workflow SID prefixed by WW. Optional if there’s only one workflow defined otherwise it’s mandatory

queue_sid [required for agent-initiated], the Task router Queue SID prefixed by WQ.

worker_sid [required for agent-initiated]

task_channel_sid [optional]

task_channel_unique_name [optional]

attributes [optional] : The task attributes.

priority [optional]: The priority of the task in the queue.

timeout [optional]: The task/reservation timeout interval in seconds.


All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see Known Task Attributes.



Resource Properties in REST API format
sid
sid<KG> Not PII

The unique string created by Twilio to identify an Interaction Channel Invite resource.

interaction_sid
sid<KD> Not PII

The Interaction SID for this Channel.

channel_sid
sid<UO> Not PII

The Channel SID for this Invite.

routing
object Not PII

A JSON object representing the routing rules for the Interaction Channel. See Outbound SMS Example for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see Known Task Attributes.

url
url Not PII

Create an Interaction Channel Invite

post
https://flex-api.twilio.com/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Invites
Parameters
Parameters in REST API format
interaction_sid
Path
post sid<KD> Not PII

The Interaction SID for this Channel.

channel_sid
Path
post sid<UO> Not PII

The Channel SID for this Invite.

routing
Required
post object Not PII

The Interaction's routing logic.

Example 1
        
        
        
        This example request invites an agent to a channel in an interaction.

        Invite an Agent

        This example request invites an agent to a channel in an interaction.
        {
           "url": "https://flex-api.twilio.com/v1/Interactions/KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites/KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
           "interaction_sid": "KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
           "channel_sid": "UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
           "routing": {
               "reservation": null,
               "properties": {
                   "date_updated": 1636401979,
                   "age_in_queue": 0,
                   "task_channel_unique_name": "default",
                   "assignment_status": "pending",
                   "queue_name": "Sample Queue",
                   "assignmentCounter": 0,
                   "priority": 0,
                   "sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                   "task_queue_entered_date": 1636401979,
                   "workflow_name": "Default Fifo Workflow",
                   "workflow_sid": "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                   "routing_target": "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                   "reason": null,
                   "attributes": "{\"flexChannelInviteSid\":\"KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"conversationSid\":\"UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"channelType\":\"email\",\"conversations\":{\"communication_channel\":\"Email\",\"conversation_id\":\"KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"media\":[{\"conversation_sid\":\"UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"media\":[{\"type\":\"ChatTranscript\",\"sid\":\"CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}],\"customers\":{\"phone\":null,\"name\":null,\"email\":null}},\"flexInteractionChannelSid\":\"UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"flexInteractionSid\":\"KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}",
                   "task_channel_sid": "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                   "age": 0,
                   "workspace_sid": "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                   "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                   "timeout": 86400,
                   "date_created": 1636401979,
                   "addons": "{}",
                   "queue_sid": "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
               }
           },
           "sid": "KGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
        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 Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

              
              
              

              Thank you for your feedback!

              Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

              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