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

Flex Flow 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.

A Flex Flow is the logic linking a contact identity (e.g. SMS-enabled phone number or WhatsApp number) to Flex.

This page details the Flex Flow API Resource. Check out the additional documentation to learn more about working with Flex Flows.


FlexFlow Properties

flexflow-properties page anchor
Resource properties
account_sidtype: SID<AC>Not PII

date_createdtype: string<DATE TIME>Not PII

The date and time in GMT when the resource 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 resource was last updated specified in ISO 8601(link takes you to an external page) format.


sidtype: SID<FO>Not PII

The unique string that we created to identify the Flex Flow resource.


friendly_nametype: stringPII MTL: 30 days

The string that you assigned to describe the resource.


chat_service_sidtype: SID<IS>Not PII

The SID of the chat service.


channel_typetype: enum<STRING>Not PII

The channel type. One of web, facebook, sms, whatsapp, line or custom. By default, Studio’s Send to Flex widget passes it on to the Task attributes for Tasks created based on this Flex Flow. The Task attributes will be used by the Flex UI to render the respective Task as appropriate (applying channel-specific design and length limits). If channelType is facebook, whatsapp or line, the Send to Flex widget should set the Task Channel to Programmable Chat.

Possible values:
websmsfacebookwhatsapplinecustom

contact_identitytype: stringNot PII

The channel contact's Identity.


enabledtype: booleanNot PII

Whether the Flex Flow is enabled.


integration_typetype: enum<STRING>Not PII

The software that will handle inbound messages. Integration Type(link takes you to an external page) can be: studio, external, or task.

Possible values:
studioexternaltask

integrationtype: objectNot PII

An object that contains specific parameters for the integration.


long_livedtype: booleanNot PII

When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to false.


janitor_enabledtype: booleanNot PII

When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to false.


urltype: string<URI>Not PII

The absolute URL of the Flex Flow resource.


Create a FlexFlow resource

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

Parameters

create-parameters page anchor
Request body parameters
FriendlyNametype: stringPII MTL: 30 days
Required

A descriptive string that you create to describe the Flex Flow resource.


ChatServiceSidtype: SID<IS>Not PII
Required

The SID of the chat service.


ChannelTypetype: enum<STRING>Not PII
Required

The channel type. One of web, facebook, sms, whatsapp, line or custom. By default, Studio’s Send to Flex widget passes it on to the Task attributes for Tasks created based on this Flex Flow. The Task attributes will be used by the Flex UI to render the respective Task as appropriate (applying channel-specific design and length limits). If channelType is facebook, whatsapp or line, the Send to Flex widget should set the Task Channel to Programmable Chat.

Possible values:
websmsfacebookwhatsapplinecustom

ContactIdentitytype: stringNot PII

The channel contact's Identity.


Enabledtype: booleanNot PII

Whether the new Flex Flow is enabled.


IntegrationTypetype: enum<STRING>Not PII

The software that will handle inbound messages. Integration Type(link takes you to an external page) can be: studio, external, or task.

Possible values:
studioexternaltask

Integration.FlowSidtype: SID<FW>Not PII

The SID of the Studio Flow. Required when integrationType is studio.


Integration.Urltype: string<URI>Not PII

The URL of the external webhook. Required when integrationType is external.


Integration.WorkspaceSidtype: SID<WS>Not PII

The Workspace SID for a new Task. Required when integrationType is task.


Integration.WorkflowSidtype: SID<WW>Not PII

The Workflow SID for a new Task. Required when integrationType is task.


Integration.Channeltype: stringNot PII

The Task Channel SID (TCXXXX) or unique name (e.g., sms) to use for the Task that will be created. Applicable and required when integrationType is task. The default value is default.


Integration.Timeouttype: integerNot PII

The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when integrationType is task, not applicable otherwise.


Integration.Prioritytype: integerNot PII

The Task priority of a new Task. The default priority is 0. Optional when integrationType is task, not applicable otherwise.


Integration.CreationOnMessagetype: booleanNot PII

In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging.


LongLivedtype: booleanNot PII

When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to false.


JanitorEnabledtype: booleanNot PII

When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to false.


Integration.RetryCounttype: integerNot PII

The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when integrationType is studio or external, not applicable otherwise.

Create a Flex Flow with Studio

create-a-flex-flow-with-studio page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = require('twilio')(accountSid, authToken);
_18
_18
client.flexApi.v1.flexFlow
_18
.create({
_18
integrationType: 'studio',
_18
enabled: true,
_18
'integration.flowSid': 'FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_18
contactIdentity: '+14155551234',
_18
friendlyName: 'My New Flex Flow',
_18
channelType: 'web',
_18
chatServiceSid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
_18
})
_18
.then(flex_flow => console.log(flex_flow.sid));

Output

_19
{
_19
"sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"date_created": "2016-08-01T22:10:40Z",
_19
"date_updated": "2016-08-01T22:10:40Z",
_19
"friendly_name": "My New Flex Flow",
_19
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_type": "web",
_19
"contact_identity": "+14155551234",
_19
"enabled": true,
_19
"integration_type": "studio",
_19
"integration": {
_19
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"retry_count": 1
_19
},
_19
"long_lived": true,
_19
"janitor_enabled": true,
_19
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}

Create a Flex Flow with an External Webhook

create-a-flex-flow-with-an-external-webhook 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.flexFlow
_15
.create({
_15
'integration.url': 'https://link-to-your-webhook.com/flex-message-endpoint',
_15
friendlyName: 'friendly_name',
_15
chatServiceSid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
_15
channelType: 'web'
_15
})
_15
.then(flex_flow => console.log(flex_flow.sid));

Output

_19
{
_19
"sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"date_created": "2016-08-01T22:10:40Z",
_19
"date_updated": "2016-08-01T22:10:40Z",
_19
"friendly_name": "friendly_name",
_19
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_type": "sms",
_19
"contact_identity": "12345",
_19
"enabled": true,
_19
"integration_type": "studio",
_19
"integration": {
_19
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"retry_count": 1
_19
},
_19
"long_lived": true,
_19
"janitor_enabled": true,
_19
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}

(information)

Info

The Studio Usage Guide is a helpful introduction to Studio Flows and the general idea of how Studio works. If you're looking for a simple way to power your Flex Flow, an underlying Studio Flow might be the right way to go!

When you receive an inbound message, the Flex Flow will make a POST request containing the message body and some metadata to your chosen webhook.

Flex Flow External Webhook

flex-flow-external-webhook page anchor
json

_16
{
_16
"EventType": "onMessageSent",
_16
"InstanceSid": "ISxxxxx",
_16
"Attributes": "{\"proxied\":true}",
_16
"DateCreated": "2019-06-01T01:01:01.000Z",
_16
"Index": "1",
_16
"From": "sms_xxxxxxxxxxxxx",
_16
"MessageSid": "IMxxxxx",
_16
"AccountSid": "ACxxxxx",
_16
"Source": "API",
_16
"ChannelSid": "CHxxxxx",
_16
"RetryCount": "0",
_16
"WebhookType": "webhook",
_16
"Body": "message goes here",
_16
"WebhookSid": "WHxxxxx"
_16
}


Fetch a FlexFlow resource

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

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

The SID of the Flex Flow resource to fetch.

Fetch a Flex Flow resource

fetch-a-flex-flow-resource page anchor
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.flexFlow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(flex_flow => console.log(flex_flow.friendlyName));

Output

_19
{
_19
"sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"date_created": "2016-08-01T22:10:40Z",
_19
"date_updated": "2016-08-01T22:10:40Z",
_19
"friendly_name": "friendly_name",
_19
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_type": "sms",
_19
"contact_identity": "12345",
_19
"enabled": true,
_19
"integration_type": "studio",
_19
"integration": {
_19
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"retry_count": 1
_19
},
_19
"long_lived": true,
_19
"janitor_enabled": true,
_19
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}


Read multiple FlexFlow resources

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

URI parameters
FriendlyNametype: stringPII MTL: 30 days
Query Parameter

The friendly_name of the Flex Flow resources to read.


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.

Read multiple Flex Flow resources

read-multiple-flex-flow-resources page anchor
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.flexFlow
_10
.list({limit: 20})
_10
.then(flexFlow => flexFlow.forEach(f => console.log(f.sid)));

Output

_32
{
_32
"meta": {
_32
"page": 0,
_32
"page_size": 50,
_32
"first_page_url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
_32
"previous_page_url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
_32
"url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=0",
_32
"next_page_url": "https://flex-api.twilio.com/v1/FlexFlows?PageSize=50&Page=1",
_32
"key": "flex_flows"
_32
},
_32
"flex_flows": [
_32
{
_32
"sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"date_created": "2016-08-01T22:10:40Z",
_32
"date_updated": "2016-08-01T22:10:40Z",
_32
"friendly_name": "friendly_name",
_32
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"channel_type": "sms",
_32
"contact_identity": "12345",
_32
"enabled": true,
_32
"integration_type": "studio",
_32
"integration": {
_32
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"retry_count": 1
_32
},
_32
"long_lived": true,
_32
"janitor_enabled": true,
_32
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_32
}
_32
]
_32
}


Update a FlexFlow resource

update-a-flexflow-resource page anchor
POST https://flex-api.twilio.com/v1/FlexFlows/{Sid}

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

The SID of the Flex Flow resource to update.


Request body parameters
FriendlyNametype: stringPII MTL: 30 days

A descriptive string that you create to describe the Flex Flow resource.


ChatServiceSidtype: SID<IS>Not PII

The SID of the chat service.


ChannelTypetype: enum<STRING>Not PII

The channel type. One of web, facebook, sms, whatsapp, line or custom. By default, Studio’s Send to Flex widget passes it on to the Task attributes for Tasks created based on this Flex Flow. The Task attributes will be used by the Flex UI to render the respective Task as appropriate (applying channel-specific design and length limits). If channelType is facebook, whatsapp or line, the Send to Flex widget should set the Task Channel to Programmable Chat.

Possible values:
websmsfacebookwhatsapplinecustom

ContactIdentitytype: stringNot PII

The channel contact's Identity.


Enabledtype: booleanNot PII

Whether the new Flex Flow is enabled.


IntegrationTypetype: enum<STRING>Not PII

The software that will handle inbound messages. Integration Type(link takes you to an external page) can be: studio, external, or task.

Possible values:
studioexternaltask

Integration.FlowSidtype: SID<FW>Not PII

The SID of the Studio Flow. Required when integrationType is studio.


Integration.Urltype: string<URI>Not PII

The URL of the external webhook. Required when integrationType is external.


Integration.WorkspaceSidtype: SID<WS>Not PII

The Workspace SID for a new Task. Required when integrationType is task.


Integration.WorkflowSidtype: SID<WW>Not PII

The Workflow SID for a new Task. Required when integrationType is task.


Integration.Channeltype: stringNot PII

The Task Channel SID (TCXXXX) or unique name (e.g., sms) to use for the Task that will be created. Applicable and required when integrationType is task. The default value is default.


Integration.Timeouttype: integerNot PII

The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when integrationType is task, not applicable otherwise.


Integration.Prioritytype: integerNot PII

The Task priority of a new Task. The default priority is 0. Optional when integrationType is task, not applicable otherwise.


Integration.CreationOnMessagetype: booleanNot PII

In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging.


LongLivedtype: booleanNot PII

When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to false.


JanitorEnabledtype: booleanNot PII

When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to false.


Integration.RetryCounttype: integerNot PII

The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when integrationType is studio or external, not applicable otherwise.

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.flexFlow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({longLived: })
_10
.then(flex_flow => console.log(flex_flow.friendlyName));

Output

_19
{
_19
"sid": "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"date_created": "2016-08-01T22:10:40Z",
_19
"date_updated": "2016-08-01T22:10:40Z",
_19
"friendly_name": "friendly_name",
_19
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"channel_type": "sms",
_19
"contact_identity": "12345",
_19
"enabled": true,
_19
"integration_type": "studio",
_19
"integration": {
_19
"flow_sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"retry_count": 1
_19
},
_19
"long_lived": ,
_19
"janitor_enabled": true,
_19
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}


DELETE https://flex-api.twilio.com/v1/FlexFlows/{Sid}

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

The SID of the Flex Flow resource to delete.

Delete a Flex Flow resource

delete-a-flex-flow-resource page anchor
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.flexFlow('FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: