# Flex Flow Resource

> \[!NOTE]
>
> This guide is for Flex UI 1.x.x and channels that use Programmable Chat and Proxy. Programmable Chat for Flex will reach end of life on June 1, 2026. If you're new to Flex or currently using Programmable Chat, [build with Flex Conversations](/docs/flex/conversations) or [migrate](/docs/flex/developer/conversations/programmable-chat-to-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](/docs/flex/developer/messaging/manage-flows).

## FlexFlow Properties

```json
{"type":"object","refName":"flex.v1.flex_flow","modelName":"flex_v1_flex_flow","properties":{"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the [Account](/docs/iam/api/account) that created the Flex Flow resource and owns this Workflow."},"date_created":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."},"date_updated":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."},"sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^FO[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string that we created to identify the Flex Flow resource."},"friendly_name":{"type":"string","nullable":true,"description":"The string that you assigned to describe the resource.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"chat_service_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the chat service."},"channel_type":{"type":"string","enum":["web","sms","facebook","whatsapp","line","custom"],"description":"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.","refName":"flex_flow_enum_channel_type","modelName":"flex_flow_enum_channel_type"},"contact_identity":{"type":"string","nullable":true,"description":"The channel contact's Identity."},"enabled":{"type":"boolean","nullable":true,"description":"Whether the Flex Flow is enabled."},"integration_type":{"type":"string","enum":["studio","external","task"],"description":"The software that will handle inbound messages. [Integration Type](/docs/flex/developer/messaging/manage-flows#integration-types) can be: `studio`, `external`,  or `task`.","refName":"flex_flow_enum_integration_type","modelName":"flex_flow_enum_integration_type"},"integration":{"nullable":true,"description":"An object that contains specific parameters for the integration."},"long_lived":{"type":"boolean","nullable":true,"description":"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_enabled":{"type":"boolean","nullable":true,"description":"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`."},"url":{"type":"string","format":"uri","nullable":true,"description":"The absolute URL of the Flex Flow resource."}}}
```

## Create a FlexFlow resource

`POST https://flex-api.twilio.com/v1/FlexFlows`

### Request body parameters

```json
{"schema":{"type":"object","title":"CreateFlexFlowRequest","required":["FriendlyName","ChatServiceSid","ChannelType"],"properties":{"FriendlyName":{"type":"string","description":"A descriptive string that you create to describe the Flex Flow resource.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"ChatServiceSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","description":"The SID of the chat service."},"ChannelType":{"type":"string","enum":["web","sms","facebook","whatsapp","line","custom"],"description":"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.","refName":"flex_flow_enum_channel_type","modelName":"flex_flow_enum_channel_type"},"ContactIdentity":{"type":"string","description":"The channel contact's Identity."},"Enabled":{"type":"boolean","description":"Whether the new Flex Flow is enabled."},"IntegrationType":{"type":"string","enum":["studio","external","task"],"description":"The software that will handle inbound messages. [Integration Type](/docs/flex/developer/messaging/manage-flows#integration-types) can be: `studio`, `external`,  or `task`.","refName":"flex_flow_enum_integration_type","modelName":"flex_flow_enum_integration_type"},"Integration.FlowSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^FW[0-9a-fA-F]{32}$","description":"The SID of the Studio Flow. Required when `integrationType` is `studio`."},"Integration.Url":{"type":"string","format":"uri","description":"The URL of the external webhook. Required when `integrationType` is `external`."},"Integration.WorkspaceSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^WS[0-9a-fA-F]{32}$","description":"The Workspace SID for a new Task. Required when `integrationType` is `task`."},"Integration.WorkflowSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^WW[0-9a-fA-F]{32}$","description":"The Workflow SID for a new Task. Required when `integrationType` is `task`."},"Integration.Channel":{"type":"string","description":"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.Timeout":{"type":"integer","description":"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.Priority":{"type":"integer","description":"The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise."},"Integration.CreationOnMessage":{"type":"boolean","description":"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."},"LongLived":{"type":"boolean","description":"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`."},"JanitorEnabled":{"type":"boolean","description":"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.RetryCount":{"type":"integer","description":"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."}}},"examples":{"create":{"value":{"lang":"json","value":"{\n  \"FriendlyName\": \"friendly_name\",\n  \"ChatServiceSid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"ChannelType\": \"sms\",\n  \"ContactIdentity\": \"12345\",\n  \"Enabled\": true,\n  \"IntegrationType\": \"studio\",\n  \"Integration.FlowSid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"LongLived\": true,\n  \"JanitorEnabled\": true,\n  \"Integration.RetryCount\": 1\n}","meta":"","code":"{\n  \"FriendlyName\": \"friendly_name\",\n  \"ChatServiceSid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"ChannelType\": \"sms\",\n  \"ContactIdentity\": \"12345\",\n  \"Enabled\": true,\n  \"IntegrationType\": \"studio\",\n  \"Integration.FlowSid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"LongLived\": true,\n  \"JanitorEnabled\": true,\n  \"Integration.RetryCount\": 1\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"FriendlyName\"","#7EE787"],[":","#C9D1D9"]," ",["\"friendly_name\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ChatServiceSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ChannelType\"","#7EE787"],[":","#C9D1D9"]," ",["\"sms\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ContactIdentity\"","#7EE787"],[":","#C9D1D9"]," ",["\"12345\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"Enabled\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"IntegrationType\"","#7EE787"],[":","#C9D1D9"]," ",["\"studio\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"Integration.FlowSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LongLived\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"JanitorEnabled\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"Integration.RetryCount\"","#7EE787"],[":","#C9D1D9"]," ",["1","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Create a Flex Flow with Studio

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createFlexFlow() {
  const flexFlow = await client.flexApi.v1.flexFlow.create({
    channelType: "web",
    chatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    contactIdentity: "+14155551234",
    enabled: true,
    friendlyName: "My New Flex Flow",
    "integration.flowSid": "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    integrationType: "studio",
  });

  console.log(flexFlow.accountSid);
}

createFlexFlow();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

flex_flow = client.flex_api.v1.flex_flow.create(
    channel_type="web",
    integration_type="studio",
    enabled=True,
    integration_flow_sid="FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    friendly_name="My New Flex Flow",
    contact_identity="+14155551234",
    chat_service_sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
)

print(flex_flow.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var flexFlow = await FlexFlowResource.CreateAsync(
            channelType: FlexFlowResource.ChannelTypeEnum.Web,
            integrationType: FlexFlowResource.IntegrationTypeEnum.Studio,
            enabled: true,
            integrationFlowSid: "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            friendlyName: "My New Flex Flow",
            contactIdentity: "+14155551234",
            chatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(flexFlow.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.flexapi.v1.FlexFlow;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        FlexFlow flexFlow =
            FlexFlow.creator("My New Flex Flow", "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FlexFlow.ChannelType.WEB)
                .setIntegrationType(FlexFlow.IntegrationType.STUDIO)
                .setEnabled(true)
                .setIntegrationFlowSid("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
                .setContactIdentity("+14155551234")
                .create();

        System.out.println(flexFlow.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	flex "github.com/twilio/twilio-go/rest/flex/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &flex.CreateFlexFlowParams{}
	params.SetChannelType("web")
	params.SetIntegrationType("studio")
	params.SetEnabled(true)
	params.SetIntegrationFlowSid("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
	params.SetFriendlyName("My New Flex Flow")
	params.SetContactIdentity("+14155551234")
	params.SetChatServiceSid("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

	resp, err := client.FlexV1.CreateFlexFlow(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$flex_flow = $twilio->flexApi->v1->flexFlow->create(
    "My New Flex Flow", // FriendlyName
    "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // ChatServiceSid
    "web", // ChannelType
    [
        "integrationType" => "studio",
        "enabled" => true,
        "integrationFlowSid" => "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "contactIdentity" => "+14155551234",
    ]
);

print $flex_flow->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

flex_flow = @client
            .flex_api
            .v1
            .flex_flow
            .create(
              channel_type: 'web',
              integration_type: 'studio',
              enabled: true,
              integration_flow_sid: 'FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
              friendly_name: 'My New Flex Flow',
              contact_identity: '+14155551234',
              chat_service_sid: 'ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
            )

puts flex_flow.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:flex:v1:flex-flows:create \
   --channel-type web \
   --integration-type studio \
   --enabled \
   --integration.flow-sid FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
   --friendly-name "My New Flex Flow" \
   --contact-identity +14155551234 \
   --chat-service-sid ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X POST "https://flex-api.twilio.com/v1/FlexFlows" \
--data-urlencode "ChannelType=web" \
--data-urlencode "IntegrationType=studio" \
--data-urlencode "Enabled=true" \
--data-urlencode "Integration.FlowSid=FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
--data-urlencode "FriendlyName=My New Flex Flow" \
--data-urlencode "ContactIdentity=+14155551234" \
--data-urlencode "ChatServiceSid=ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

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

Create a Flex Flow with an External Webhook

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createFlexFlow() {
  const flexFlow = await client.flexApi.v1.flexFlow.create({
    channelType: "web",
    chatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    friendlyName: "FriendlyName",
    "integration.url": "https://link-to-your-webhook.com/flex-message-endpoint",
  });

  console.log(flexFlow.accountSid);
}

createFlexFlow();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

flex_flow = client.flex_api.v1.flex_flow.create(
    integration_url="https://link-to-your-webhook.com/flex-message-endpoint",
    friendly_name="FriendlyName",
    chat_service_sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    channel_type="web",
)

print(flex_flow.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var flexFlow = await FlexFlowResource.CreateAsync(
            integrationUrl: new Uri("https://link-to-your-webhook.com/flex-message-endpoint"),
            friendlyName: "FriendlyName",
            chatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            channelType: FlexFlowResource.ChannelTypeEnum.Web);

        Console.WriteLine(flexFlow.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import java.net.URI;
import com.twilio.Twilio;
import com.twilio.rest.flexapi.v1.FlexFlow;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        FlexFlow flexFlow =
            FlexFlow.creator("FriendlyName", "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FlexFlow.ChannelType.WEB)
                .setIntegrationUrl(URI.create("https://link-to-your-webhook.com/flex-message-endpoint"))
                .create();

        System.out.println(flexFlow.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	flex "github.com/twilio/twilio-go/rest/flex/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &flex.CreateFlexFlowParams{}
	params.SetIntegrationUrl("https://link-to-your-webhook.com/flex-message-endpoint")
	params.SetFriendlyName("FriendlyName")
	params.SetChatServiceSid("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	params.SetChannelType("web")

	resp, err := client.FlexV1.CreateFlexFlow(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$flex_flow = $twilio->flexApi->v1->flexFlow->create(
    "FriendlyName", // FriendlyName
    "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // ChatServiceSid
    "web", // ChannelType
    [
        "integrationUrl" =>
            "https://link-to-your-webhook.com/flex-message-endpoint",
    ]
);

print $flex_flow->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

flex_flow = @client
            .flex_api
            .v1
            .flex_flow
            .create(
              integration_url: 'https://link-to-your-webhook.com/flex-message-endpoint',
              friendly_name: 'FriendlyName',
              chat_service_sid: 'ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
              channel_type: 'web'
            )

puts flex_flow.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:flex:v1:flex-flows:create \
   --integration.url https://link-to-your-webhook.com/flex-message-endpoint \
   --friendly-name FriendlyName \
   --chat-service-sid ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --channel-type web
```

```bash
curl -X POST "https://flex-api.twilio.com/v1/FlexFlows" \
--data-urlencode "Integration.Url=https://link-to-your-webhook.com/flex-message-endpoint" \
--data-urlencode "FriendlyName=FriendlyName" \
--data-urlencode "ChatServiceSid=ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--data-urlencode "ChannelType=web" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "date_created": "2016-08-01T22:10:40Z",
  "date_updated": "2016-08-01T22:10:40Z",
  "friendly_name": "FriendlyName",
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "channel_type": "web",
  "contact_identity": "12345",
  "enabled": true,
  "integration_type": "studio",
  "integration": {
    "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "retry_count": 1
  },
  "long_lived": true,
  "janitor_enabled": true,
  "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

> \[!NOTE]
>
> [The Studio Usage Guide](/docs/studio/user-guide) is a helpful introduction to Studio Flows and the general idea of how Studio works. If you're looking for a way to power your Flex Flow with little or no code, 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

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

## Fetch a FlexFlow resource

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

### Path parameters

```json
[{"name":"Sid","in":"path","description":"The SID of the Flex Flow resource to fetch.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^FO[0-9a-fA-F]{32}$"},"required":true}]
```

Fetch a Flex Flow resource

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchFlexFlow() {
  const flexFlow = await client.flexApi.v1
    .flexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .fetch();

  console.log(flexFlow.accountSid);
}

fetchFlexFlow();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

flex_flow = client.flex_api.v1.flex_flow(
    "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).fetch()

print(flex_flow.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var flexFlow =
            await FlexFlowResource.FetchAsync(pathSid: "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(flexFlow.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.flexapi.v1.FlexFlow;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        FlexFlow flexFlow = FlexFlow.fetcher("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch();

        System.out.println(flexFlow.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	resp, err := client.FlexV1.FetchFlexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$flex_flow = $twilio->flexApi->v1
    ->flexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->fetch();

print $flex_flow->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

flex_flow = @client
            .flex_api
            .v1
            .flex_flow('FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
            .fetch

puts flex_flow.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:flex:v1:flex-flows:fetch \
   --sid FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X GET "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "date_created": "2016-08-01T22:10:40Z",
  "date_updated": "2016-08-01T22:10:40Z",
  "friendly_name": "friendly_name",
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "channel_type": "sms",
  "contact_identity": "12345",
  "enabled": true,
  "integration_type": "studio",
  "integration": {
    "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "retry_count": 1
  },
  "long_lived": true,
  "janitor_enabled": true,
  "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

## Read multiple FlexFlow resources

`GET https://flex-api.twilio.com/v1/FlexFlows`

### Query parameters

```json
[{"name":"FriendlyName","in":"query","description":"The `friendly_name` of the Flex Flow resources to read.","schema":{"type":"string"},"x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 1000.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":1000}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

Read multiple Flex Flow resources

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listFlexFlow() {
  const flexFlows = await client.flexApi.v1.flexFlow.list({ limit: 20 });

  flexFlows.forEach((f) => console.log(f.accountSid));
}

listFlexFlow();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

flex_flows = client.flex_api.v1.flex_flow.list(limit=20)

for record in flex_flows:
    print(record.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var flexFlows = await FlexFlowResource.ReadAsync(limit: 20);

        foreach (var record in flexFlows) {
            Console.WriteLine(record.AccountSid);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.flexapi.v1.FlexFlow;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<FlexFlow> flexFlows = FlexFlow.reader().limit(20).read();

        for (FlexFlow record : flexFlows) {
            System.out.println(record.getAccountSid());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	flex "github.com/twilio/twilio-go/rest/flex/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &flex.ListFlexFlowParams{}
	params.SetLimit(20)

	resp, err := client.FlexV1.ListFlexFlow(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].AccountSid != nil {
				fmt.Println(*resp[record].AccountSid)
			} else {
				fmt.Println(resp[record].AccountSid)
			}
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$flexFlows = $twilio->flexApi->v1->flexFlow->read([], 20);

foreach ($flexFlows as $record) {
    print $record->accountSid;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

flex_flows = @client
             .flex_api
             .v1
             .flex_flow
             .list(limit: 20)

flex_flows.each do |record|
   puts record.account_sid
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:flex:v1:flex-flows:list
```

```bash
curl -X GET "https://flex-api.twilio.com/v1/FlexFlows?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

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

## Update a FlexFlow resource

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

### Path parameters

```json
[{"name":"Sid","in":"path","description":"The SID of the Flex Flow resource to update.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^FO[0-9a-fA-F]{32}$"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateFlexFlowRequest","properties":{"FriendlyName":{"type":"string","description":"A descriptive string that you create to describe the Flex Flow resource.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"ChatServiceSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","description":"The SID of the chat service."},"ChannelType":{"type":"string","enum":["web","sms","facebook","whatsapp","line","custom"],"description":"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.","refName":"flex_flow_enum_channel_type","modelName":"flex_flow_enum_channel_type"},"ContactIdentity":{"type":"string","description":"The channel contact's Identity."},"Enabled":{"type":"boolean","description":"Whether the new Flex Flow is enabled."},"IntegrationType":{"type":"string","enum":["studio","external","task"],"description":"The software that will handle inbound messages. [Integration Type](/docs/flex/developer/messaging/manage-flows#integration-types) can be: `studio`, `external`,  or `task`.","refName":"flex_flow_enum_integration_type","modelName":"flex_flow_enum_integration_type"},"Integration.FlowSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^FW[0-9a-fA-F]{32}$","description":"The SID of the Studio Flow. Required when `integrationType` is `studio`."},"Integration.Url":{"type":"string","format":"uri","description":"The URL of the external webhook. Required when `integrationType` is `external`."},"Integration.WorkspaceSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^WS[0-9a-fA-F]{32}$","description":"The Workspace SID for a new Task. Required when `integrationType` is `task`."},"Integration.WorkflowSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^WW[0-9a-fA-F]{32}$","description":"The Workflow SID for a new Task. Required when `integrationType` is `task`."},"Integration.Channel":{"type":"string","description":"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.Timeout":{"type":"integer","description":"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.Priority":{"type":"integer","description":"The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise."},"Integration.CreationOnMessage":{"type":"boolean","description":"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."},"LongLived":{"type":"boolean","description":"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`."},"JanitorEnabled":{"type":"boolean","description":"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.RetryCount":{"type":"integer","description":"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."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"FriendlyName\": \"friendly_name\",\n  \"ChatServiceSid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"ChannelType\": \"sms\",\n  \"ContactIdentity\": \"12345\",\n  \"Enabled\": true,\n  \"IntegrationType\": \"studio\",\n  \"Integration.FlowSid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"LongLived\": true,\n  \"JanitorEnabled\": true,\n  \"Integration.RetryCount\": 1\n}","meta":"","code":"{\n  \"FriendlyName\": \"friendly_name\",\n  \"ChatServiceSid\": \"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"ChannelType\": \"sms\",\n  \"ContactIdentity\": \"12345\",\n  \"Enabled\": true,\n  \"IntegrationType\": \"studio\",\n  \"Integration.FlowSid\": \"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"LongLived\": true,\n  \"JanitorEnabled\": true,\n  \"Integration.RetryCount\": 1\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"FriendlyName\"","#7EE787"],[":","#C9D1D9"]," ",["\"friendly_name\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ChatServiceSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ChannelType\"","#7EE787"],[":","#C9D1D9"]," ",["\"sms\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ContactIdentity\"","#7EE787"],[":","#C9D1D9"]," ",["\"12345\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"Enabled\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"IntegrationType\"","#7EE787"],[":","#C9D1D9"]," ",["\"studio\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"Integration.FlowSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LongLived\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"JanitorEnabled\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"Integration.RetryCount\"","#7EE787"],[":","#C9D1D9"]," ",["1","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Update a Flex Flow

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function updateFlexFlow() {
  const flexFlow = await client.flexApi.v1
    .flexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .update({ longLived: false });

  console.log(flexFlow.accountSid);
}

updateFlexFlow();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

flex_flow = client.flex_api.v1.flex_flow(
    "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).update(long_lived=False)

print(flex_flow.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var flexFlow = await FlexFlowResource.UpdateAsync(
            longLived: false, pathSid: "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(flexFlow.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.flexapi.v1.FlexFlow;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        FlexFlow flexFlow = FlexFlow.updater("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").setLongLived(false).update();

        System.out.println(flexFlow.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	flex "github.com/twilio/twilio-go/rest/flex/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &flex.UpdateFlexFlowParams{}
	params.SetLongLived(false)

	resp, err := client.FlexV1.UpdateFlexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$flex_flow = $twilio->flexApi->v1
    ->flexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->update(["longLived" => false]);

print $flex_flow->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

flex_flow = @client
            .flex_api
            .v1
            .flex_flow('FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
            .update(long_lived: false)

puts flex_flow.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:flex:v1:flex-flows:update \
   --sid FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X POST "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
--data-urlencode "LongLived=false" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "sid": "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "date_created": "2016-08-01T22:10:40Z",
  "date_updated": "2016-08-01T22:10:40Z",
  "friendly_name": "friendly_name",
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "channel_type": "sms",
  "contact_identity": "12345",
  "enabled": true,
  "integration_type": "studio",
  "integration": {
    "flow_sid": "FWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "retry_count": 1
  },
  "long_lived": false,
  "janitor_enabled": true,
  "url": "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

## Delete a Flex Flow

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

### Path parameters

```json
[{"name":"Sid","in":"path","description":"The SID of the Flex Flow resource to delete.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^FO[0-9a-fA-F]{32}$"},"required":true}]
```

Delete a Flex Flow resource

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function deleteFlexFlow() {
  await client.flexApi.v1
    .flexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .remove();
}

deleteFlexFlow();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

client.flex_api.v1.flex_flow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        await FlexFlowResource.DeleteAsync(pathSid: "FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.flexapi.v1.FlexFlow;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        FlexFlow.deleter("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete();
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	err := client.FlexV1.DeleteFlexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$twilio->flexApi->v1->flexFlow("FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete();
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client
  .flex_api
  .v1
  .flex_flow('FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
  .delete
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:flex:v1:flex-flows:remove \
   --sid FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X DELETE "https://flex-api.twilio.com/v1/FlexFlows/FOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```
