メニュー

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?

Role Resource

The Role resource of Programmable Chat represents what a user can do within a Chat Service instance. Roles are scoped to either a Service or a Channel.

Users are assigned a role at the Service scope, which determines what they are can do within the Chat Service instance, such as create and destroy channels.

Members are assigned a role at the Channel scope. This determines what they are able to do within a particular channel, such as invite users to be members of the channel, post messages, and remove members from the channel.

See Permission values for information about the permissions that can be assigned in each scope.

Role properties

Each Role resource contains these properties.

Names in PHP format
sid
sid<RL> Not PII

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

accountSid
sid<AC> Not PII

The SID of the Account that created the Role resource.

serviceSid
sid<IS> Not PII

The SID of the Service the Role resource is associated with.

friendlyName
文字列 PII MTL: 120 DAYS

The string that you assigned to describe the resource.

type
enum:role_type Not PII

The type of role. Can be: channel for Channel roles or deployment for Service roles.

permissions
string[] Not PII

An array of the permissions the role has been granted.

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.

url
url Not PII

The absolute URL of the Role resource.

Create a Role resource

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

The SID of the Service to create the Role 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.

type
必須
post enum:role_type Not PII

The type of role. Can be: channel for Channel roles or deployment for Service roles.

permission
必須
post string[] Not PII

A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's type.

例 1
        
        
        
        

        Fetch a Role resource

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

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

        sid
        必須
        GET sid<RL> Not PII

        The SID of the Role resource to fetch.

        例 1
              
              
              
              

              Read multiple Role resources

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

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

              例 1
                    
                    
                    
                    

                    Update a Role resource

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

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

                    sid
                    必須
                    post sid<RL> Not PII

                    The SID of the Role resource to update.

                    permission
                    必須
                    post string[] Not PII

                    A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's type.

                    例 1
                          
                          
                          
                          

                          Delete a Role resource

                          削除する
                          https://chat.twilio.com/v2/Services/{ServiceSid}/Roles/{Sid}
                          パラメーター
                          Names in None format
                          service_sid
                          必須
                          削除する sid<IS> Not PII

                          The SID of the Service to delete the Role resource from.

                          sid
                          必須
                          削除する sid<RL> Not PII

                          The SID of the Role resource to delete.

                          例 1
                                
                                
                                
                                

                                Service scope permissions

                                These are the available permissions entries for roles where type = deployment.

                                パーミッション Enables the user to:
                                addMember Add other users as members of a channel
                                createChannel Create new channels
                                deleteAnyMessage Delete any message in the Service
                                destroyChannel Delete channels
                                editAnyMessage Edit any message in the Service
                                editAnyMessageAttributes Edit any message attributes in the Service
                                editAnyUserInfo Edit other User's User Info properties
                                editChannelAttributes Update the optional attributes metadata field on a channel
                                editChannelName Change the name of a channel
                                editOwnMessage Edit their own messages in the Service
                                editOwnMessageAttributes Edit the own message attributes in the Service
                                editOwnUserInfo Edit their own User Info properties
                                inviteMember Invite other users to be members of a channel
                                joinChannel Join channels
                                removeMember Remove members from a channel

                                Channel scope permissions

                                These are the available permissions entries for roles where type = channel.

                                パーミッション Enables the user to:
                                addMember Add other users as members of a channel
                                deleteAnyMessage Delete any message in the Service
                                deleteOwnMessage Delete their own messages in the Service
                                destroyChannel Delete channels
                                editAnyMessage Edit any message in the Service
                                editAnyMessageAttributes Edit any message attributes in the Service
                                editAnyUserInfo Edit other User's User Info properties
                                editChannelAttributes Update the optional attributes metadata field on a channel
                                editChannelName Change the name of a channel
                                editOwnMessage Edit their own messages in the Service
                                editOwnMessageAttributes Edit the own message attributes in the Service
                                editOwnUserInfo Edit their own User Info properties
                                inviteMember Invite other users to be members of a channel
                                leaveChannel Leave a channel
                                removeMember Remove members from a channel
                                sendMediaMessage Send media messages to channels
                                sendMessage Send messages to channels
                                Rate this page:

                                ヘルプが必要ですか?

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