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 and channels that use Programmable Chat and Proxy. If you are using Flex UI 2.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
Resource properties
account_sidtype: SID<AC>Not PII

flex_flow_sidtype: SID<FO>Not PII

The SID of the Flex Flow.


sidtype: SID<CH>Not PII

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


user_sidtype: SID<US>Not PII

The SID of the chat user.


task_sidtype: SID<WT>Not PII

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


urltype: string<URI>Not PII

The absolute URL of the Flex chat channel resource.


date_createdtype: string<DATE TIME>Not PII

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


date_updatedtype: string<DATE TIME>Not PII

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

Parameters

create-parameters page anchor
Request body parameters
FlexFlowSidtype: SID<FO>Not PII
Required

The SID of the Flex Flow.


Identitytype: stringNot PII
Required

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


ChatUserFriendlyNametype: stringNot PII
Required

The chat participant's friendly name.


ChatFriendlyNametype: stringNot PII
Required

The chat channel's friendly name.


Targettype: stringNot PII

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


ChatUniqueNametype: stringNot PII

The chat channel's unique name.


PreEngagementDatatype: stringNot PII

The pre-engagement data.


TaskSidtype: SID<WT>Not PII

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


TaskAttributestype: stringNot PII

The Task attributes to be added for the TaskRouter Task.


LongLivedtype: booleanNot PII

Whether to create the channel as long-lived.

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}

URI parameters
Sidtype: SID<CH>Not PII
Path Parameter

The SID of the Flex chat channel resource to fetch.

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

URI parameters
PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

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}

URI parameters
Sidtype: SID<CH>Not PII
Path Parameter

The SID of the Flex chat channel resource to delete.

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: