Flows are individual workflows that you create. Flow definitions are expressed as instances of a JSON schema.
Note: Flow definitions are null
in the Flows List Resource. To retrieve the Flow definition, use the Fetch method.
The unique string that we created to identify the Flow resource.
^FW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Flow resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The status of the Flow. Can be: draft
or published
.
draft
published
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The URLs of the Flow's nested resources.
POST https://studio.twilio.com/v2/Flows
application/x-www-form-urlencoded
The status of the Flow. Can be: draft
or published
.
draft
published
Description of change made in the revision.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createFlow() {11const flow = await client.studio.v2.flows.create({12commitMessage: "First draft",13definition: {14description: "A New Flow",15states: [16{17name: "Trigger",18type: "trigger",19transitions: [],20properties: {21offset: {22x: 0,23y: 0,24},25},26},27],28initial_state: "Trigger",29flags: {30allow_concurrent_calls: true,31},32},33friendlyName: "Main IVR",34status: "draft",35});3637console.log(flow.sid);38}3940createFlow();
1{2"sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"definition": {5"initial_state": "Trigger"6},7"friendly_name": "Main IVR",8"status": "draft",9"revision": 1,10"commit_message": "First draft",11"valid": true,12"errors": [],13"warnings": [],14"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"date_created": "2017-11-06T12:00:00Z",16"date_updated": null,17"url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"links": {19"test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",20"revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",21"executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"22}23}
GET https://studio.twilio.com/v2/Flows/{Sid}
The SID of the Flow resource to fetch.
^FW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchFlow() {11const flow = await client.studio.v212.flows("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.fetch();1415console.log(flow.sid);16}1718fetchFlow();
1{2"sid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"friendly_name": "Test Flow",5"definition": {6"initial_state": "Trigger"7},8"status": "published",9"revision": 1,10"commit_message": "commit",11"valid": true,12"errors": [],13"warnings": [],14"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"date_created": "2017-11-06T12:00:00Z",16"date_updated": null,17"url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"links": {19"test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",20"revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",21"executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"22}23}
GET https://studio.twilio.com/v2/Flows
Note: Flow definitions are null
in the Flows List Resource. To retrieve the Flow definition, use the Fetch method.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listFlow() {11const flows = await client.studio.v2.flows.list({ limit: 20 });1213flows.forEach((f) => console.log(f.sid));14}1516listFlow();
1{2"meta": {3"previous_page_url": null,4"next_page_url": null,5"url": "https://studio.twilio.com/v2/Flows?PageSize=50&Page=0",6"page": 0,7"first_page_url": "https://studio.twilio.com/v2/Flows?PageSize=50&Page=0",8"page_size": 50,9"key": "flows"10},11"flows": [12{13"sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"friendly_name": "Test Flow",16"status": "published",17"revision": 1,18"definition": null,19"commit_message": null,20"valid": null,21"errors": null,22"warnings": null,23"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"date_created": "2017-11-06T12:00:00Z",25"date_updated": "2017-11-06T12:00:00Z",26"url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"links": {28"test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",29"revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",30"executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"31}32}33]34}
POST https://studio.twilio.com/v2/Flows/{Sid}
The SID of the Flow resource to fetch.
^FW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
The status of the Flow. Can be: draft
or published
.
draft
published
Description of change made in the revision.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateFlow() {11const flow = await client.studio.v212.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.update({14commitMessage: "Prod release v2",15definition: {16description: "A New Flow",17states: [18{19name: "Trigger",20type: "trigger",21transitions: [22{23event: "incomingMessage",24},25{26next: "say_play_1",27event: "incomingCall",28},29{30event: "incomingRequest",31},32],33properties: {34offset: {35x: 0,36y: 0,37},38},39},40{41name: "say_play_1",42type: "say-play",43transitions: [44{45event: "audioComplete",46},47],48properties: {49offset: {50x: 173,51y: 212,52},53loop: 1,54say: "Hello world",55},56},57],58initial_state: "Trigger",59flags: {60allow_concurrent_calls: true,61},62},63status: "published",64});6566console.log(flow.sid);67}6869updateFlow();
1{2"sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"definition": {5"initial_state": "Trigger"6},7"friendly_name": "Test Flow",8"status": "published",9"revision": 1,10"commit_message": "Prod release v2",11"valid": true,12"errors": [],13"warnings": [],14"webhook_url": "http://webhooks.twilio.com/v1/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"date_created": "2017-11-06T12:00:00Z",16"date_updated": "2017-11-06T12:00:00Z",17"url": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"links": {19"test_users": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TestUsers",20"revisions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Revisions",21"executions": "https://studio.twilio.com/v2/Flows/FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Executions"22}23}
DELETE https://studio.twilio.com/v2/Flows/{Sid}
The SID of the Flow resource to delete.
^FW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteFlow() {11await client.studio.v2.flows("FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").remove();12}1314deleteFlow();