Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Channels Resource

The Channel resource of Programmable Chat represents a "chat room" - a scope in which Messages can be sent and received.

Members can be added or invited to join channels. Channels exist within a Chat Service scope.

A list of a Users Channels can be retrieved which will return all the Channels the specified User is a Member of.

Channels can also have an optional, addressable Unique Name. This allows for a channel to be named something specific, and be looked up and addressed directly. The Unique Name is enforced as unique within the Service instance.

Twilio Console

You can view your Chat Channels using your Twilio console when logged in to the console. Within a Service, you will be able to browse the Channels within the Service.

Properties

Each channel has these properties:

Names in PHP format
sid
sid<CH> Not PII

The unique string that we created to identify the Channel resource.

accountSid
sid<AC> Not PII

The SID of the Account that created the Channel resource.

serviceSid
sid<IS> Not PII

The SID of the Service the resource is associated with.

friendlyName

The string that you assigned to describe the resource.

uniqueName

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

The JSON string that stores application-specific data. Note If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, {} is returned.

type
enum:channel_type Not PII

The visibility of the channel. Can be: public or private.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

createdBy

The identity of the User that created the channel. If the Channel was created by using the API, the value is system.

membersCount
integer Not PII

The number of Members in the Channel.

messagesCount
integer Not PII

The number of Messages in the Channel.

url
url Not PII

The absolute URL of the Channel resource.

links
uri_map Not PII

The absolute URLs of the Members, Messages , Invites and, if it exists, the last Message for the Channel.


List All Channels

GET /Services/{Service SID}/Channels
Names in PHP format
serviceSid
Required
get sid<IS> Not PII

The SID of the Service to read the resources from.

type
Optional
get enum:channel_type[] Not PII

The visibility of the Channels to read. Can be: public or private and defaults to public.

        
        
        
        

        Create a Channel

        POST /Services/{Service SID}/Channels
        

        Parameters

        Names in PHP format
        serviceSid
        Required
        post sid<IS> Not PII

        The SID of the Service to create the resource under.

        friendlyName
        Optional
        post string PII MTL: 120 DAYS

        A descriptive string that you create to describe the new resource. It can be up to 64 characters long.

        uniqueName
        Optional
        post string PII MTL: 120 DAYS

        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 64 characters or less in length and be unique within the Service.

        attributes
        Optional
        post string PII MTL: 120 DAYS

        A valid JSON string that contains application-specific data.

        type
        Optional
        post enum:channel_type Not PII

        The visibility of the channel. Can be: public or private and defaults to public.

        dateCreated
        Optional
        post date_time<iso8601> Not PII

        The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default 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
        Optional
        post date_time<iso8601> Not PII

        The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated. The default value is null. Note that this 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
        Optional
        post string PII MTL: 120 DAYS

        The identity of the User that created the channel. Default is: system.

        Notable Response Codes

        code description
        409 Conflict Channel with the specified unique name already exists
              
              
              
              

              Retrieve a Channel

              You are able to retrieve a Channel via the SID or UniqueName

              Channel SID

              GET /Services/{Service SID}/Channels/{Channel SID}
              

              UniqueName

              GET /Services/{Service SID}/Channels/{Unique Name}
              
                    
                    
                    
                    

                    Update a Channel

                    You are able to update a Channel via the SID or UniqueName

                    Channel SID

                    POST /Services/{Service SID}/Channels/{Channel SID}
                    

                    UniqueName

                    POST /Services/{Service SID}/Channels/{Unique Name}
                    

                    Parameters

                    Names in PHP format
                    serviceSid
                    Required
                    post sid<IS> Not PII

                    The SID of the Service to update the resource from.

                    sid
                    Required
                    post sid_like<CH> Not PII

                    The Twilio-provided string that uniquely identifies the Channel resource to update.

                    friendlyName
                    Optional
                    post string PII MTL: 120 DAYS

                    A descriptive string that you create to describe the resource. It can be up to 256 characters long.

                    uniqueName
                    Optional
                    post string PII MTL: 120 DAYS

                    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
                    Optional
                    post string PII MTL: 120 DAYS

                    A valid JSON string that contains application-specific data.

                    dateCreated
                    Optional
                    post date_time<iso8601> Not PII

                    The date, specified in ISO 8601 format, to assign to the resource as the date it was created.

                    dateUpdated
                    Optional
                    post date_time<iso8601> Not PII

                    The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated.

                    createdBy
                    Optional
                    post string PII MTL: 120 DAYS

                    The identity of the User that created the channel. Default is: system.

                          
                          
                          
                          

                          Delete a Channel

                          You are able to delete a Channel via the SID or UniqueName

                          Channel SID

                          DELETE /Services/{Service SID}/Channels/{Channel SID}
                          

                          UniqueName

                          DELETE /Services/{Service SID}/Channels/{Unique Name}
                          
                                
                                
                                
                                
                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.