A Channel is a Programmable Chat object that is equivalent to a Conversation in the Conversations API.
Please see the Conversation Resource for Conversations that are already available to your Conversations application.
Only 'private' type Channels are automatically migrated to Conversations. For 'public' type Channels, please use this API to migrate them to 'private' type.
1https://chat.twilio.com/v32
There is only one API endpoint on the v3 Chat API:
1POST /Services/ISxx/Channels/CHxx2
The unique string that we created to identify the Channel resource.
^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Channel resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Service the Channel resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid
in the URL.
The JSON string that stores application-specific data. If attributes have not been set, {}
is returned.
The visibility of the channel. Can be: public
or private
.
public
private
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 identity
of the User that created the channel. If the Channel was created by using the API, the value is system
.
The number of Messages that have been passed in the Channel.
0
The unique ID of the Messaging Service this channel belongs to.
^MG[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The absolute URL of the Channel resource.
POST https://chat.twilio.com/v3/Services/{ServiceSid}/Channels/{Sid}
Use this API to change a Channel's type from public
to private
. This makes it available in Conversations.
Read here to determine if you need to include a Messaging Service SID in your request.
The X-Twilio-Webhook-Enabled HTTP request header
true
false
application/x-www-form-urlencoded
TThe Type for this Channel to migrate to. Can only be private
. Migration to 'public' is not allowed.
public
private
The unique ID of the Messaging Service this channel belongs to.
^MG[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 updateChannel() {11const channel = await client.chat.v312.channels("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "Sid")13.update({14messagingServiceSid: "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",15type: "private",16});1718console.log(channel.sid);19}2021updateChannel();
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",6"friendly_name": "friendly_name",7"unique_name": "unique_name",8"attributes": "{ \"foo\": \"bar\" }",9"type": "private",10"date_created": "2015-12-16T22:18:37Z",11"date_updated": "2015-12-16T22:18:38Z",12"created_by": "username",13"members_count": 0,14"messages_count": 0,15"url": "https://chat.twilio.com/v3/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"16}