Channel Resource
A Channel resource of Programmable Chat represents a chat room, which is a familiar concept for what is, programmatically, a scope in which Messages can be sent and received by its members. Members can be added or invited to join channels and Channels exist within a Chat Service scope.
Channels can have an optional unique_name
that can replace the Channel's {ChannelSid}
in the URL. This allows a channel to be named something specific and be addressed by that name. A Channel's unique_name
must be unique within its Service instance.
The User Channels resource lists all the Channels to which a specific User is a Member.
Chat Channels are organized by their Chat service. You can view that Channels in a Chat service by using your Twilio console when logged in to the console and selecting the Chat Service from the list. Within a Chat Service, you can browse its Channels.
Each Channel resource contains these properties.
Resource properties The unique string that we created to identify the Channel resource.
The string that you assigned to describe the resource.
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
.
Possible values:
public
private
date_created
type: string<DATE TIME> Not PIIdate_updated
type: string<DATE TIME> Not PIIThe identity
of the User that created the channel. If the Channel was created by using the API, the value is system
.
The number of Members in the Channel.
The number of Messages that have been passed in the Channel.
The absolute URL of the Channel resource.
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels
Request headers X-Twilio-Webhook-Enabled
type: enum<STRING> Not PII
The X-Twilio-Webhook-Enabled HTTP request header
Possible values:
true
false
URI parameters Request body parameters A descriptive string that you create to describe the new resource. It can be up to 64 characters long.
An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource's sid
in the URL. This value must be 64 characters or less in length and be unique within the Service.
A valid JSON string that contains application-specific data.
The visibility of the channel. Can be: public
or private
and defaults to public
.
Possible values:
public
private
DateCreated
type: string<DATE TIME> Not PIIThe date, specified in ISO 8601(link takes you to an external page) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source.
DateUpdated
type: string<DATE TIME> Not PIIThe date, specified in ISO 8601(link takes you to an external page) format, to assign to the resource as the date it was last updated. The default value is null
. Note that this parameter should only be used in cases where a Channel is being recreated from a backup/separate source and where a Message was previously updated.
The identity
of the User that created the channel. Default is: system
.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(channel => console.log(channel.sid));
_24 "sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "friendly_name": "friendly_name",
_24 "unique_name": "unique_name",
_24 "date_created": "2015-12-16T22:18:37Z",
_24 "date_updated": "2015-12-16T22:18:38Z",
_24 "created_by": "username",
_24 "url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "members": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members",
_24 "messages": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_24 "invites": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites",
_24 "webhooks": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{Sid}
When fetching a Channel resource, the {Sid}
value can be either the sid
or the unique_name
of the Channel resource to fetch.
URI parameters Path Parameter
The SID of the Channel resource to fetch. This value can be either the sid
or the unique_name
of the Channel resource to fetch.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(channel => console.log(channel.friendlyName));
_24 "sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "friendly_name": "friendly_name",
_24 "unique_name": "unique_name",
_24 "date_created": "2015-12-16T22:18:37Z",
_24 "date_updated": "2015-12-16T22:18:37Z",
_24 "created_by": "system",
_24 "url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "members": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members",
_24 "messages": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_24 "invites": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites",
_24 "webhooks": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels
URI parameters Query Parameter
The visibility of the Channels to read. Can be: public
or private
and defaults to public
.
Possible values:
public
private
Query Parameter
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Query Parameter
The page index. This value is simply for client state.
Query Parameter
The page token. This is provided by the API.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(channels => channels.forEach(c => console.log(c.sid)));
_37 "sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37 "service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37 "friendly_name": "friendly_name",
_37 "unique_name": "unique_name",
_37 "date_created": "2015-12-16T22:18:37Z",
_37 "date_updated": "2015-12-16T22:18:37Z",
_37 "created_by": "system",
_37 "url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37 "members": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members",
_37 "messages": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_37 "invites": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites",
_37 "webhooks": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
_37 "first_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=0",
_37 "previous_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=0",
_37 "url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=0",
_37 "next_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels?PageSize=50&Page=1",
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{Sid}
When updating a Channel resource, the {Sid}
value can be either the sid
or the unique_name
of the Channel resource to update.
Request headers X-Twilio-Webhook-Enabled
type: enum<STRING> Not PII
The X-Twilio-Webhook-Enabled HTTP request header
Possible values:
true
false
URI parameters Path Parameter
The SID of the Channel resource to update. This value can be either the sid
or the unique_name
of the Channel resource to update.
Request body parameters A descriptive string that you create to describe the resource. It can be up to 256 characters long.
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. This value must be 256 characters or less in length and unique within the Service.
A valid JSON string that contains application-specific data.
DateCreated
type: string<DATE TIME> Not PIIThe date, specified in ISO 8601(link takes you to an external page) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source.
DateUpdated
type: string<DATE TIME> Not PIIThe identity
of the User that created the channel. Default is: system
.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .update({friendlyName: 'friendly_name'})
_11 .then(channel => console.log(channel.friendlyName));
_24 "sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "friendly_name": "friendly_name",
_24 "unique_name": "unique_name",
_24 "date_created": "2015-12-16T22:18:37Z",
_24 "date_updated": "2015-12-16T22:18:38Z",
_24 "created_by": "username",
_24 "url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24 "members": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members",
_24 "messages": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_24 "invites": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites",
_24 "webhooks": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks",
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{Sid}
When deleting a Channel resource, the {Sid}
value can be either the sid
or the unique_name
of the Channel resource to delete.
Request headers X-Twilio-Webhook-Enabled
type: enum<STRING> Not PII
The X-Twilio-Webhook-Enabled HTTP request header
Possible values:
true
false
URI parameters Path Parameter
The SID of the Channel resource to delete. This value can be either the sid
or the unique_name
of the Channel resource to delete.
_10 // Download the helper library from https://www.twilio.com/docs/node/install
_10 // Find your Account SID and Auth Token at twilio.com/console
_10 // and set the environment variables. See http://twil.io/secure
_10 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10 const authToken = process.env.TWILIO_AUTH_TOKEN;
_10 const client = require('twilio')(accountSid, authToken);
_10 client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10 .channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')