Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

メニュー

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?

チャンネルリソース

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.

Twilio コンソール

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.

Channel properties

Each Channel resource contains 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 Channel resource is associated with.

friendlyName
文字列 PII MTL: 120 DAYS

The string that you assigned to describe the resource.

uniqueName
文字列 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.

attributes
文字列 PII MTL: 120 DAYS

The JSON string that stores application-specific data. If 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 ISO 8601 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601 format.

createdBy
文字列 PII MTL: 120 DAYS

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 that have been passed 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, Webhooks and, if it exists, the last Message for the Channel.

Create a Channel resource

post
https://chat.twilio.com/v2/Services/{ServiceSid}/Channels
パラメーター
Names in None format
service_sid
必須
post sid<IS> Not PII

The SID of the Service to create the Channel resource under.

friendly_name
オプション
post 文字列 PII MTL: 120 DAYS

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

unique_name
オプション
post 文字列 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 Channel resource's sid in the URL. This value must be 64 characters or less in length and be unique within the Service.

attributes
オプション
post 文字列 PII MTL: 120 DAYS

A valid JSON string that contains application-specific data.

type
オプション
post enum:channel_type Not PII

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

date_created
オプション
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 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.

date_updated
オプション
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 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.

created_by
オプション
post 文字列 PII MTL: 120 DAYS

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

例 1
        
        
        
        

        Fetch a Channel resource

        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.

        パラメーター
        Names in None format
        service_sid
        必須
        GET sid<IS> Not PII

        The SID of the Service to fetch the Channel resource from.

        sid
        必須
        GET sid_like<CH> Not PII

        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.

        例 1
              
              
              
              

              Read multiple Channel resources

              GET
              https://chat.twilio.com/v2/Services/{ServiceSid}/Channels
              パラメーター
              Names in None format
              service_sid
              必須
              GET sid<IS> Not PII

              The SID of the Service to read the Channel resources from.

              type
              オプション
              GET enum:channel_type[] Not PII

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

              例 1
                    
                    
                    
                    

                    Update a Channel resource

                    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.

                    パラメーター
                    Names in None format
                    service_sid
                    必須
                    post sid<IS> Not PII

                    The SID of the Service to update the Channel resource in.

                    sid
                    必須
                    post sid_like<CH> Not PII

                    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.

                    friendly_name
                    オプション
                    post 文字列 PII MTL: 120 DAYS

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

                    unique_name
                    オプション
                    post 文字列 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
                    オプション
                    post 文字列 PII MTL: 120 DAYS

                    A valid JSON string that contains application-specific data.

                    date_created
                    オプション
                    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 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.

                    date_updated
                    オプション
                    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.

                    created_by
                    オプション
                    post 文字列 PII MTL: 120 DAYS

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

                    例 1
                          
                          
                          
                          

                          Delete a Channel resource

                          削除する
                          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.

                          パラメーター
                          Names in None format
                          service_sid
                          必須
                          削除する sid<IS> Not PII

                          The SID of the Service to delete the resource from.

                          sid
                          必須
                          削除する sid_like<CH> Not PII

                          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.

                          例 1
                                
                                
                                
                                
                                Rate this page:

                                ヘルプが必要ですか?

                                誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。