Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Invites Subresource


(information)

Info

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

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


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

Use this endpoint to:

  • add an agent to an ongoing interaction,
  • to find an agent that should be added by evaluating a TaskRouter workflow , or
  • to send an interaction to a queue .

The invite creates a new task for the existing interaction which will result in reservations offered to the agent(s). Note the example JSON response on this page is not representative of the actual API response. See example response on "Park an Interaction".

(warning)

Warning

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

See Conversations Best Practices for details.


Interaction Channel Invite properties

interaction-channel-invite-properties page anchor
ParameterSub-fieldDescription
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.
Property nameTypePIIDescription
sidSID<KG>
Not PII

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

Pattern: ^KG[0-9a-fA-F]{32}$Min length: 34Max length: 34

interaction_sidSID<KD>

The Interaction SID for this Channel.

Pattern: ^KD[0-9a-fA-F]{32}$Min length: 34Max length: 34

channel_sidSID<UO>

The Channel SID for this Invite.

Pattern: ^UO[0-9a-fA-F]{32}$Min length: 34Max length: 34

routingobject

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.


urlstring<uri>

Create an Interaction Channel Invite

create-an-interaction-channel-invite page anchor
POST https://flex.twilio.com/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Invites

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
InteractionSidSID<KD>required

The Interaction SID for this Channel.

Pattern: ^KD[0-9a-fA-F]{32}$Min length: 34Max length: 34

ChannelSidSID<UO>required

The Channel SID for this Invite.

Pattern: ^UO[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
Routingobjectrequired

The Interaction's routing logic.

Invite an Agent

invite-an-agent page anchor

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

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_26
// Download the helper library from https://www.twilio.com/docs/node/install
_26
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_26
_26
// Find your Account SID and Auth Token at twilio.com/console
_26
// and set the environment variables. See http://twil.io/secure
_26
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_26
const authToken = process.env.TWILIO_AUTH_TOKEN;
_26
const client = twilio(accountSid, authToken);
_26
_26
async function createInteractionChannelInvite() {
_26
const invite = await client.flexApi.v1
_26
.interaction("KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_26
.channels("UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_26
.invites.create({
_26
routing: {
_26
properties: {
_26
workspace_sid: "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
workflow_sid: "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
},
_26
},
_26
});
_26
_26
console.log(invite.sid);
_26
}
_26
_26
createInteractionChannelInvite();

Output

_33
{
_33
"sid": "KGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"channel_sid": "UOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"interaction_sid": "KDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_33
"routing": {
_33
"reservation": null,
_33
"properties": {
_33
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"date_created": 1634845217,
_33
"date_updated": 1634845217,
_33
"attributes": "{\"customerAddress\":\"customer phone address\",\"flexChannelInviteSid\":\"KGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversationSid\":\"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channelType\":\"sms\",\"customers\":{\"phone\":\"customer phone address\",\"name\":\"customer name\"},\"conversations\":{\"conversation_id\":\"KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"media\":[{\"type\":\"ChatTranscript\",\"sid\":\"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}]},\"customerName\":\"customer name\",\"flexInteractionChannelSid\":\"UOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"flexInteractionSid\":\"KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}",
_33
"assignment_status": "pending",
_33
"workflow_sid": "WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"workflow_name": "Default Fifo Workflow",
_33
"queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"queue_name": "Sample Queue",
_33
"priority": 0,
_33
"age": 0,
_33
"reason": "",
_33
"timeout": 86400,
_33
"assignmentCounter": 0,
_33
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"task_channel_unique_name": "default",
_33
"routing_target": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"task_queue_entered_date": 1634845217,
_33
"age_in_queue": 0,
_33
"addons": "{}"
_33
}
_33
},
_33
"url": "https://flex-api.twilio.com/v1/Interactions/KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/UOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites/KGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_33
}


Rate this page: