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

Flow


Flows are individual workflows that you create. Flow definitions are expressed as instances of a JSON schema.

(information)

Info

Note: Flow definitions are null in the Flows List Resource. To retrieve the Flow definition, use the Fetch method.


Flow Properties

flow-properties page anchor
sidSID<FW>
Not PII

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

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

friendly_namestring

The string that you assigned to describe the Flow.


definitionobject

JSON representation of flow definition.


statusenum<string>

The status of the Flow. Can be: draft or published.

Possible values:
draftpublished

revisioninteger

The latest revision number of the Flow's definition.


commit_messagestring

Description of change made in the revision.


validboolean

Boolean if the flow definition is valid.


errorsarray

List of error in the flow definition.


warningsarray

List of warnings in the flow definition.


date_createdstring<date-time>

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


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.


webhook_urlstring<uri>

urlstring<uri>

The absolute URL of the resource.


linksobject<uri-map>

The URLs of the Flow's nested resources.


POST https://studio.twilio.com/v2/Flows

Request body parameters

request-body-parameters page anchor
FriendlyNamestringrequired

The string that you assigned to describe the Flow.


Statusenum<string>required

The status of the Flow. Can be: draft or published.

Possible values:
draftpublished

Definitionobjectrequired

JSON representation of flow definition.


CommitMessagestring

Description of change made in the revision.

Create Flow

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

_35
// Download the helper library from https://www.twilio.com/docs/node/install
_35
// Find your Account SID and Auth Token at twilio.com/console
_35
// and set the environment variables. See http://twil.io/secure
_35
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_35
const authToken = process.env.TWILIO_AUTH_TOKEN;
_35
const client = require('twilio')(accountSid, authToken);
_35
_35
client.studio.v2.flows
_35
.create({
_35
commitMessage: 'First draft',
_35
friendlyName: 'Main IVR',
_35
status: 'draft',
_35
definition: {
_35
description: 'A New Flow',
_35
states: [
_35
{
_35
name: 'Trigger',
_35
type: 'trigger',
_35
transitions: [
_35
],
_35
properties: {
_35
offset: {
_35
x: 0,
_35
y: 0
_35
}
_35
}
_35
}
_35
],
_35
initial_state: 'Trigger',
_35
flags: {
_35
allow_concurrent_calls: true
_35
}
_35
}
_35
})
_35
.then(flow => console.log(flow.sid));

Output

_40
{
_40
"sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_40
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_40
"definition": {
_40
"description": "A New Flow",
_40
"states": [
_40
{
_40
"name": "Trigger",
_40
"type": "trigger",
_40
"transitions": [],
_40
"properties": {
_40
"offset": {
_40
"x": 0,
_40
"y": 0
_40
}
_40
}
_40
}
_40
],
_40
"initial_state": "Trigger",
_40
"flags": {
_40
"allow_concurrent_calls": true
_40
}
_40
},
_40
"friendly_name": "Main IVR",
_40
"status": "draft",
_40
"revision": 1,
_40
"commit_message": "First draft",
_40
"valid": true,
_40
"errors": [],
_40
"warnings": [],
_40
"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_40
"date_created": "2017-11-06T12:00:00Z",
_40
"date_updated": null,
_40
"url": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_40
"links": {
_40
"test_users": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TestUsers",
_40
"revisions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Revisions",
_40
"executions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Executions"
_40
}
_40
}


GET https://studio.twilio.com/v2/Flows/{Sid}

SidSID<FW>required

The SID of the Flow resource to fetch.

Pattern: ^FW[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.studio.v2.flows('FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(flow => console.log(flow.friendlyName));

Output

_23
{
_23
"sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"friendly_name": "Test Flow",
_23
"definition": {
_23
"initial_state": "Trigger"
_23
},
_23
"status": "published",
_23
"revision": 1,
_23
"commit_message": "commit",
_23
"valid": true,
_23
"errors": [],
_23
"warnings": [],
_23
"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"date_created": "2017-11-06T12:00:00Z",
_23
"date_updated": null,
_23
"url": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_23
"links": {
_23
"test_users": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TestUsers",
_23
"revisions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Revisions",
_23
"executions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Executions"
_23
}
_23
}


Read multiple Flow resources

read-multiple-flow-resources page anchor
GET https://studio.twilio.com/v2/Flows

(information)

Info

Note: Flow definitions are null in the Flows List Resource. To retrieve the Flow definition, use the Fetch method.

PageSizeinteger

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

Minimum: 1Maximum: 1000

Pageinteger

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

Minimum: 0

PageTokenstring

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.studio.v2.flows.list({limit: 20})
_10
.then(flows => flows.forEach(f => console.log(f.sid)));

Output

_34
{
_34
"meta": {
_34
"previous_page_url": "https://studio.twilio.com/v2/Flows?PageSize=50&Page=0",
_34
"next_page_url": "https://studio.twilio.com/v2/Flows?PageSize=50&Page=1",
_34
"url": "https://studio.twilio.com/v2/Flows?PageSize=50&Page=0",
_34
"page": 0,
_34
"first_page_url": "https://studio.twilio.com/v2/Flows?PageSize=50&Page=0",
_34
"page_size": 50,
_34
"key": "flows"
_34
},
_34
"flows": [
_34
{
_34
"sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"friendly_name": "Test Flow",
_34
"status": "published",
_34
"revision": 1,
_34
"definition": null,
_34
"commit_message": null,
_34
"valid": null,
_34
"errors": null,
_34
"warnings": null,
_34
"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"date_created": "2017-11-06T12:00:00Z",
_34
"date_updated": "2017-11-06T12:00:00Z",
_34
"url": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_34
"links": {
_34
"test_users": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TestUsers",
_34
"revisions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Revisions",
_34
"executions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Executions"
_34
}
_34
}
_34
]
_34
}


POST https://studio.twilio.com/v2/Flows/{Sid}

SidSID<FW>required

The SID of the Flow resource to fetch.

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

The status of the Flow. Can be: draft or published.

Possible values:
draftpublished

FriendlyNamestring

The string that you assigned to describe the Flow.


Definitionobject

JSON representation of flow definition.


CommitMessagestring

Description of change made in the revision.

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

_57
// Download the helper library from https://www.twilio.com/docs/node/install
_57
// Find your Account SID and Auth Token at twilio.com/console
_57
// and set the environment variables. See http://twil.io/secure
_57
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_57
const authToken = process.env.TWILIO_AUTH_TOKEN;
_57
const client = require('twilio')(accountSid, authToken);
_57
_57
client.studio.v2.flows('FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_57
.update({commitMessage: 'Prod release v2', definition: {
_57
description: 'A New Flow',
_57
states: [
_57
{
_57
name: 'Trigger',
_57
type: 'trigger',
_57
transitions: [
_57
{
_57
event: 'incomingMessage'
_57
},
_57
{
_57
next: 'say_play_1',
_57
event: 'incomingCall'
_57
},
_57
{
_57
event: 'incomingRequest'
_57
}
_57
],
_57
properties: {
_57
offset: {
_57
x: 0,
_57
y: 0
_57
}
_57
}
_57
},
_57
{
_57
name: 'say_play_1',
_57
type: 'say-play',
_57
transitions: [
_57
{
_57
event: 'audioComplete'
_57
}
_57
],
_57
properties: {
_57
offset: {
_57
x: 173,
_57
y: 212
_57
},
_57
loop: 1,
_57
say: 'Hello world'
_57
}
_57
}
_57
],
_57
initial_state: 'Trigger',
_57
flags: {
_57
allow_concurrent_calls: true
_57
}
_57
}, status: 'published'})
_57
.then(flow => console.log(flow.friendlyName));

Output

_68
{
_68
"sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_68
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_68
"definition": {
_68
"description": "A New Flow",
_68
"states": [
_68
{
_68
"name": "Trigger",
_68
"type": "trigger",
_68
"transitions": [
_68
{
_68
"event": "incomingMessage"
_68
},
_68
{
_68
"next": "say_play_1",
_68
"event": "incomingCall"
_68
},
_68
{
_68
"event": "incomingRequest"
_68
}
_68
],
_68
"properties": {
_68
"offset": {
_68
"x": 0,
_68
"y": 0
_68
}
_68
}
_68
},
_68
{
_68
"name": "say_play_1",
_68
"type": "say-play",
_68
"transitions": [
_68
{
_68
"event": "audioComplete"
_68
}
_68
],
_68
"properties": {
_68
"offset": {
_68
"x": 173,
_68
"y": 212
_68
},
_68
"loop": 1,
_68
"say": "Hello world"
_68
}
_68
}
_68
],
_68
"initial_state": "Trigger",
_68
"flags": {
_68
"allow_concurrent_calls": true
_68
}
_68
},
_68
"friendly_name": "Test Flow",
_68
"status": "published",
_68
"revision": 1,
_68
"commit_message": "Prod release v2",
_68
"valid": true,
_68
"errors": [],
_68
"warnings": [],
_68
"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_68
"date_created": "2017-11-06T12:00:00Z",
_68
"date_updated": "2017-11-06T12:00:00Z",
_68
"url": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_68
"links": {
_68
"test_users": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/TestUsers",
_68
"revisions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Revisions",
_68
"executions": "https://studio.twilio.com/v2/Flows/FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Executions"
_68
}
_68
}


DELETE https://studio.twilio.com/v2/Flows/{Sid}

SidSID<FW>required

The SID of the Flow resource to delete.

Pattern: ^FW[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.studio.v2.flows('FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: