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

WebChats Resource


Flex Webchats is an endpoint that simplifies orchestrating a Conversation for a guest user: It creates a conversation, adds a randomly generated user identity to this conversation, and configures the Conversation based on the Address SID you provide. To get started with this endpoint, please refer to the web chat React-based demo app(link takes you to an external page).

(information)

Info

Webchat 3.0 (currently in Public Beta) provides a simple, secure way to add a Twilio-hosted chat widget to your website. Before deciding to use the Webchat React App, you may want to consider using Webchat 3.0. For a comparison between these apps, see Migrate to Webchat 3.0.


WebChannel Properties

webchannel-properties page anchor
Resource properties
conversation_sidtype: SID<CH>Not PII

The unique string representing the Conversation resource(link takes you to an external page) created.


identitytype: stringNot PII

The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see User Identity & Access Tokens(link takes you to an external page).


Create a WebChannel resource

create-a-webchannel-resource page anchor
POST https://flex-api.twilio.com/v2/WebChats

Parameters

create-parameters page anchor
Request body parameters
AddressSidtype: stringNot PII
Required

The SID of the Conversations Address. See Address Configuration Resource(link takes you to an external page) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration.


ChatFriendlyNametype: stringNot PII

The Conversation's friendly name. See the Conversation resource(link takes you to an external page) for an example.


CustomerFriendlyNametype: stringNot PII

The Conversation participant's friendly name. See the Conversation Participant Resource(link takes you to an external page) for an example.


PreEngagementDatatype: stringNot PII

The pre-engagement data.

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

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = require('twilio')(accountSid, authToken);
_14
_14
client.flexApi.v2.webChannels
_14
.create({
_14
chatFriendlyName: 'Customer Support',
_14
customerFriendlyName: 'Alice',
_14
addressSid: 'IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
_14
})
_14
.then(web_channels => console.log(web_channels.conversationSid));

Output

_10
{
_10
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"identity": "seinfeld"
_10
}


Rate this page: