Menu

Expand
Rate this page:

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 Base URL

All URLs in the reference documentation use the following base 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

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
Parameters in REST API format
friendly_name
Required
post string PII MTL: 30 DAYS

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

type
Required
post ienum:role_type Not PII

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

permission
Required
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.

Example 1
        
        
        
        

        Fetch a Role resource

        get
        https://conversations.twilio.com/v1/Roles/{Sid}
        Parameters
        Parameters in REST API format
        sid
        Path
        get sid<RL> Not PII

        The SID of the Role resource to fetch.

        Example 1
              
              
              
              

              Read multiple Role resources

              get
              https://conversations.twilio.com/v1/Roles
              Example 1
                    
                    
                    
                    

                    Update a Role resource

                    post
                    https://conversations.twilio.com/v1/Roles/{Sid}
                    Parameters
                    Parameters in REST API format
                    sid
                    Path
                    post sid<RL> Not PII

                    The SID of the Role resource to update.

                    permission
                    Required
                    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.

                    Example 1
                          
                          
                          
                          

                          Delete a Role resource

                          delete
                          https://conversations.twilio.com/v1/Roles/{Sid}
                          Parameters
                          Parameters in REST API format
                          sid
                          Path
                          delete sid<RL> Not PII

                          The SID of the Role resource to delete.

                          Example 1
                                
                                
                                
                                

                                Permission Values

                                Service-scope permissions

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

                                Permission 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.

                                Permission 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
                                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.

                                      
                                      
                                      

                                      Thank you for your feedback!

                                      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!

                                      Step 1

                                      Get link

                                      Get a free personal referral link here

                                      Step 2

                                      Give $10

                                      Your user signs up and upgrade using link

                                      Step 3

                                      Get $10

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