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

Flex Chat Channel Resource


(information)

Info

This guide is for Flex UI 1.x.x and channels that use Programmable Chat and Proxy. If you are using Flex UI 2.x.x or you are starting out, we recommend that you build with Flex Conversations.

Flex Chat Channels allow agents to communicate with your customers across multiple channels like Webchat, SMS, and WhatsApp through a single chat interface. You can create a chat channel in Flex whenever you want to initiate a new communication flow between an agent and a customer. The Flex Chat Channel is an implementation of the Chat Channel Resource orchestrated for Flex.


Channel Properties

channel-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that created the Channel resource and owns this Workflow.

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

flex_flow_sidSID<FO>

The SID of the Flex Flow.

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

sidSID<CH>

The unique string that we created to identify the Channel resource.

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

user_sidSID<US>

The SID of the chat user.

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

task_sidSID<WT>

The SID of the TaskRouter Task. Only valid when integration type is task. null for integration types studio & external

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

urlstring<uri>

The absolute URL of the Flex chat channel resource.


date_updatedstring<date-time>

The date and time in GMT when the Flex chat channel was last updated specified in ISO 8601(link takes you to an external page) format.


Create a Channel resource

create-a-channel-resource page anchor
POST https://flex-api.twilio.com/v1/Channels

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
FlexFlowSidSID<FO>required

The SID of the Flex Flow.

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

Identitystringrequired

The identity value that uniquely identifies the new resource's chat User.


ChatUserFriendlyNamestringrequired

The chat participant's friendly name.


ChatFriendlyNamestringrequired

The chat channel's friendly name.


TargetstringOptional

The Target Contact Identity, for example the phone number of an SMS.


ChatUniqueNamestringOptional

The chat channel's unique name.


PreEngagementDatastringOptional

The pre-engagement data.


TaskSidSID<WT>Optional

The SID of the TaskRouter Task. Only valid when integration type is task. null for integration types studio & external

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

TaskAttributesstringOptional

The Task attributes to be added for the TaskRouter Task.


LongLivedbooleanOptional

Whether to create the channel as long-lived.

Create a Channel

create-a-channel page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = require('twilio')(accountSid, authToken);
_15
_15
client.flexApi.v1.channel
_15
.create({
_15
flexFlowSid: 'FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_15
identity: 'identity',
_15
chatUserFriendlyName: 'chat_user_friendly_name',
_15
chatFriendlyName: 'chat_friendly_name'
_15
})
_15
.then(channel => console.log(channel.sid));

Output

_10
{
_10
"flex_flow_sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"user_sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"date_created": "2016-08-01T22:10:40Z",
_10
"date_updated": "2016-08-01T22:10:40Z",
_10
"url": "https://flex-api.twilio.com/v1/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_10
}


Fetch a Channel resource

fetch-a-channel-resource page anchor
GET https://flex-api.twilio.com/v1/Channels/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<CH>required

The SID of the Flex chat channel resource to fetch.

Pattern: ^CH[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.flexApi.v1.channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(channel => console.log(channel.flexFlowSid));

Output

_10
{
_10
"flex_flow_sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"user_sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"date_created": "2016-08-01T22:10:40Z",
_10
"date_updated": "2016-08-01T22:10:40Z",
_10
"url": "https://flex-api.twilio.com/v1/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_10
}


Read multiple Channel resources

read-multiple-channel-resources page anchor
GET https://flex-api.twilio.com/v1/Channels

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.flexApi.v1.channel
_10
.list({limit: 20})
_10
.then(channel => channel.forEach(c => console.log(c.sid)));

Output

_23
{
_23
"meta": {
_23
"page": 0,
_23
"page_size": 50,
_23
"first_page_url": "https://flex-api.twilio.com/v1/Channels?PageSize=50&Page=0",
_23
"previous_page_url": "https://flex-api.twilio.com/v1/Channels?PageSize=50&Page=0",
_23
"url": "https://flex-api.twilio.com/v1/Channels?PageSize=50&Page=0",
_23
"next_page_url": "https://flex-api.twilio.com/v1/Channels?PageSize=50&Page=1",
_23
"key": "flex_chat_channels"
_23
},
_23
"flex_chat_channels": [
_23
{
_23
"flex_flow_sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"task_sid": "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"user_sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"date_created": "2016-08-01T22:10:40Z",
_23
"date_updated": "2016-08-01T22:10:40Z",
_23
"url": "https://flex-api.twilio.com/v1/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_23
}
_23
]
_23
}


Delete a Channel resource

delete-a-channel-resource page anchor
DELETE https://flex-api.twilio.com/v1/Channels/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<CH>required

The SID of the Flex chat channel resource to delete.

Pattern: ^CH[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.flexApi.v1.channel('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: