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

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
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

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

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

date_updatedstring<date-time>

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


sidSID<FO>

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

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

friendly_namestring
PII MTL: 30 days

The string that you assigned to describe the resource.


chat_service_sidSID<IS>

The SID of the chat service.

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

channel_typeenum<string>

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_identitystring

The channel contact's Identity.


enabledboolean

Whether the Flex Flow is enabled.


integration_typeenum<string>

The software that will handle inbound messages. Integration Type can be: studio, external, or task.

Possible values:
studioexternaltask

integrationobject

An object that contains specific parameters for the integration.


long_livedboolean

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_enabledboolean

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.


urlstring<uri>

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

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
FriendlyNamestringrequired

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


ChatServiceSidSID<IS>required

The SID of the chat service.

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

ChannelTypeenum<string>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

ContactIdentitystringOptional

The channel contact's Identity.


EnabledbooleanOptional

Whether the new Flex Flow is enabled.


IntegrationTypeenum<string>Optional

The software that will handle inbound messages. Integration Type can be: studio, external, or task.

Possible values:
studioexternaltask

Integration.FlowSidSID<FW>Optional

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

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

Integration.Urlstring<uri>Optional

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


Integration.WorkspaceSidSID<WS>Optional

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

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

Integration.WorkflowSidSID<WW>Optional

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

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

Integration.ChannelstringOptional

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.TimeoutintegerOptional

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.PriorityintegerOptional

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


Integration.CreationOnMessagebooleanOptional

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.


LongLivedbooleanOptional

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.


JanitorEnabledbooleanOptional

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.RetryCountintegerOptional

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}

Property nameTypeRequiredPIIDescription
SidSID<FO>required

The SID of the Flex Flow resource to fetch.

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

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

Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

The friendly_name of the Flex Flow resources to read.


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.

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}

Property nameTypeRequiredPIIDescription
SidSID<FO>required

The SID of the Flex Flow resource to update.

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

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


ChatServiceSidSID<IS>Optional

The SID of the chat service.

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

ChannelTypeenum<string>Optional

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

ContactIdentitystringOptional

The channel contact's Identity.


EnabledbooleanOptional

Whether the new Flex Flow is enabled.


IntegrationTypeenum<string>Optional

The software that will handle inbound messages. Integration Type can be: studio, external, or task.

Possible values:
studioexternaltask

Integration.FlowSidSID<FW>Optional

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

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

Integration.Urlstring<uri>Optional

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


Integration.WorkspaceSidSID<WS>Optional

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

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

Integration.WorkflowSidSID<WW>Optional

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

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

Integration.ChannelstringOptional

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.TimeoutintegerOptional

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.PriorityintegerOptional

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


Integration.CreationOnMessagebooleanOptional

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.


LongLivedbooleanOptional

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.


JanitorEnabledbooleanOptional

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.RetryCountintegerOptional

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: false})
_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": false,
_19
"janitor_enabled": true,
_19
"url": "https://flex-api.twilio.com/v1/FlexFlows/FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}


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

Property nameTypeRequiredPIIDescription
SidSID<FO>required

The SID of the Flex Flow resource to delete.

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

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: