メニュー

Expand
ページを評価:

Role Resource

In Twilio Conversations, the Role Resource represents what a User can do within the Service and individual Conversations. Roles are scoped to either a Service or a Conversation.

Users are assigned a Role at the Service level. This determines what they can do within the chat Service instance, such as create and destroy Conversations within the Service.

Participants are assigned a Role at the Conversation level. This determines what they are able to do within a particular Conversation, such as invite Participants to be members of the Conversation, post Messages, and remove other Participants from the Conversation.

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

APIのベースURL

リファレンスドキュメントの URL はすべて、次のベース URL を使用しています。

https://conversations.twilio.com/v1

Using the shortened base URL

Using the REST API, you can interact with Role resources in the default Chat Service instance via a "shortened" URL that does not include the Chat Service instance SID ("ISXXX..."). If you are only using one Chat Service (the default), you do not need to include the Chat Service SID in your URL, e.g.

GET /v1/Roles/

For Conversations applications that build on more than one Chat Service instance, you will need to specify the Chat Service SID in the REST API call.

GET /v1/Services/<Service SID, ISXXX...>/Roles/

Role properties

Each Role resource contains these properties.

Resource Properties in REST API format
sid
sid<RL> Not PII

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

account_sid
sid<AC> Not PII

The SID of the Account that created the Role resource.

chat_service_sid
sid<IS> Not PII

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

friendly_name
文字列 PII MTL: 30 DAYS

The string that you assigned to describe the resource.

type
enum:role_type Not PII

The type of role. Can be: conversation for Conversation roles or service for Conversation Service roles.

permissions
string[] Not PII

An array of the permissions the role has been granted.

date_created
date_time<iso8601> Not PII

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

date_updated
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

An absolute API resource URL for this user role.

Create a Role resource

post
https://conversations.twilio.com/v1/Roles
パラメーター
Parameters in REST API format
friendly_name
必須
post 文字列 PII MTL: 30 DAYS

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

type
必須
post ienum:role_type Not PII

The type of role. Can be: conversation for Conversation roles or service for Conversation 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://conversations.twilio.com/v1/Roles/{Sid}
        パラメーター
        Parameters in REST API format
        sid
        Path
        GET sid<RL> Not PII

        The SID of the Role resource to fetch.

        例 1
              
              
              
              

              Read multiple Role resources

              GET
              https://conversations.twilio.com/v1/Roles
              例 1
                    
                    
                    
                    

                    Update a Role resource

                    post
                    https://conversations.twilio.com/v1/Roles/{Sid}
                    パラメーター
                    Parameters in REST API format
                    sid
                    Path
                    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://conversations.twilio.com/v1/Roles/{Sid}
                          パラメーター
                          Parameters in REST API format
                          sid
                          Path
                          削除する sid<RL> Not PII

                          The SID of the Role resource to delete.

                          例 1
                                
                                
                                
                                

                                Permission Values

                                Service-scope permissions

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

                                パーミッション Enables User to:
                                addParticipant Add other users as Participants of a Conversation
                                createChannel Create new Conversations
                                deleteAnyMessage Delete any Message in the Service
                                deleteConversation Delete Conversations
                                editAnyMessage Edit any Message in the Service
                                editAnyMessageAttributes Edit any Message attributes in the Service
                                editAnyUserInfo Edit other User's User Info properties
                                editConversationAttributes Update the optional attributes metadata field on a Conversation
                                editConversationName Change the name of a Conversation
                                editOwnMessage Edit their own Messages in the Service
                                editOwnMessageAttributes Edit the own Message attributes in the Service
                                editOwnUserInfo Edit their own User Info properties
                                joinConversation Join Conversations
                                removeParticipant Remove Participants from a Conversation

                                Conversation-scope permissions

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

                                パーミッション Enables User to:
                                addParticipant Add other users as Particpants of a Conversation
                                deleteAnyMessage Delete any Message in the Service
                                deleteOwnMessage Delete their own Messages in the Service
                                destroyConversation Delete Conversations
                                editAnyMessage Edit any Message in the Service
                                editAnyMessageAttributes Edit any Message attributes in the Service
                                editAnyUserInfo Edit other User's User Info properties
                                editConversationAttributes Update the optional attributes metadata field on a Conversation
                                editConversationName Change the name of a Conversation
                                editOwnMessage Edit their own Messages in the Service
                                editOwnMessageAttributes Edit the own Message attributes in the Service
                                editOwnUserInfo Edit their own User Info properties
                                leaveConversation Leave a Conversation
                                removeParticipant Remove Participants from a Conversation
                                sendMediaMessage Send media Messages to Conversations
                                sendMessage Send Messages to Conversations
                                ページを評価:

                                ヘルプが必要ですか?

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

                                      
                                      
                                      

                                      フィードバックくださりありがとうございます!

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

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      Refer us and get $10 in 3 simple steps!

                                      ステップ1

                                      Get link

                                      Get a free personal referral link here

                                      ステップ2:

                                      Give $10

                                      Your user signs up and upgrade using link

                                      ステップ3

                                      Get $10

                                      1,250 free SMSes
                                      OR 1,000 free voice mins
                                      OR 12,000 chats
                                      OR more