# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'rubygems'
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(
janitor_enabled: true,
friendly_name: 'friendly_name',
chat_service_sid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
channel_type: 'web'
)
puts flex_flow.sid
# 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(
janitor_enabled=True,
friendly_name='friendly_name',
chat_service_sid='ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
channel_type='web'
)
print(flex_flow.sid)
<?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("friendly_name", // friendlyName
"ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", // chatServiceSid
"web", // channelType
["janitorEnabled" => True]
);
print($flex_flow->sid);
// Download the helper library from https://www.twilio.com/docs/node/install
// 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 = require('twilio')(accountSid, authToken);
client.flexApi.v1.flexFlow
.create({
janitorEnabled: true,
friendlyName: 'friendly_name',
chatServiceSid: 'ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
channelType: 'web'
})
.then(flex_flow => console.log(flex_flow.sid));
// 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(
"friendly_name",
"ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
FlexFlow.ChannelType.WEB)
.setJanitorEnabled(true).create();
System.out.println(flexFlow.getSid());
}
}
// Download the helper library from https://www.twilio.com/docs/go/install
package main
import (
"fmt"
"github.com/twilio/twilio-go"
flex_api "github.com/twilio/twilio-go/rest/flex_api/v1"
)
func main() {
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
client := twilio.NewRestClient()
params := &flex_api.CreateFlexFlowParams{}
params.SetJanitorEnabled(true)
params.SetFriendlyName("friendly_name")
params.SetChatServiceSid("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
params.SetChannelType("web")
resp, err := client.FlexApiV1.CreateFlexFlow(params)
if err != nil {
fmt.Println(err.Error())
} else {
if resp.Sid != nil {
fmt.Println(*resp.Sid)
} else {
fmt.Println(resp.Sid)
}
}
}
curl -X POST "https://flex-api.twilio.com/v1/FlexFlows" \
--data-urlencode "JanitorEnabled=True" \
--data-urlencode "FriendlyName=friendly_name" \
--data-urlencode "ChatServiceSid=ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
--data-urlencode "ChannelType=web" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
// Install the C# / .NET helper library from twilio.com/docs/csharp/install
using System;
using Twilio;
using Twilio.Rest.FlexApi.V1;
class Program
{
static void 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 = FlexFlowResource.Create(
janitorEnabled: true,
friendlyName: "friendly_name",
chatServiceSid: "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
channelType: FlexFlowResource.ChannelTypeEnum.Web
);
Console.WriteLine(flexFlow.Sid);
}
}
# Install the twilio-cli from https://twil.io/cli
twilio api:flex:v1:flex-flows:create \
--janitor-enabled \
--friendly-name friendly_name \
--chat-service-sid ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--channel-type web