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 sid
type: SID<CH>
The unique string that we created to identify the Channel resource.
friendly_name
type: string
The string that you assigned to describe the resource.
unique_name
type: string
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.
attributes
type: string
The JSON string that stores application-specific data. If attributes have not been set, {}
is returned.
type
type: enum<string>
The visibility of the channel. Can be: public
or private
.
Possible values:
public
private
date_created
type: string<date-time>
date_updated
type: string<date-time>
created_by
type: string
The identity
of the User that created the channel. If the Channel was created by using the API, the value is system
.
members_count
type: integer
The number of Members in the Channel.
messages_count
type: integer
The number of Messages that have been passed in the Channel.
url
type: string<uri>
The absolute URL of the Channel resource.
links
type: object<uri-map>
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels
Request headers X-Twilio-Webhook-Enabled
type: enum<string>
The X-Twilio-Webhook-Enabled HTTP request header
Possible values:
true
false
URI parameters Request body parameters FriendlyName
type: string
A descriptive string that you create to describe the new resource. It can be up to 64 characters long.
UniqueName
type: string
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.
Attributes
type: string
A valid JSON string that contains application-specific data.
Type
type: enum<string>
The visibility of the channel. Can be: public
or private
and defaults to public
.
Possible values:
public
private
DateCreated
type: string<date-time>
The 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>
The 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.
CreatedBy
type: string
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 Sid
type: string
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 Type
type: array[string]
The visibility of the Channels to read. Can be: public
or private
and defaults to public
.
Possible values:
public
private
PageSize
type: integer
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Page
type: integer
The page index. This value is simply for client state.
PageToken
type: string
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>
The X-Twilio-Webhook-Enabled HTTP request header
Possible values:
true
false
URI parameters Sid
type: string
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 FriendlyName
type: string
A descriptive string that you create to describe the resource. It can be up to 256 characters long.
UniqueName
type: string
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.
Attributes
type: string
A valid JSON string that contains application-specific data.
DateCreated
type: string<date-time>
The 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>
CreatedBy
type: string
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 .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>
The X-Twilio-Webhook-Enabled HTTP request header
Possible values:
true
false
URI parameters Sid
type: string
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')