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.
Do not use Personally Identifiable Information (PII) for the friendlyName field.
Avoid using a person's name, home address, email, phone number, or other PII in the friendlyName
field. Use some form of pseudonymized identifier, instead.
You can learn more about how we process your data in our privacy policy.
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 Conversation Service instance via a "shortened" URL that does not include the Conversation Service instance SID ("ISXXX..."). If you are only using one Conversation Service (the default), you do not need to include the Conversation Service SID in your URL, e.g.
GET /v1/Roles/
For Conversations applications that build on more than one Conversation Service instance, you will need to specify the Conversation 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
|
The unique string that we created to identify the Role resource. |
account_sid
|
The SID of the Account that created the Role resource. |
chat_service_sid
|
The SID of the Conversation Service the Role resource is associated with. |
friendly_name
|
The string that you assigned to describe the resource. |
type
|
The type of role. Can be: |
permissions
|
An array of the permissions the role has been granted. |
date_created
|
The date and time in GMT when the resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the resource was last updated specified in ISO 8601 format. |
url
|
An absolute API resource URL for this user role. |
Create a Role resource
https://conversations.twilio.com/v1/Roles
Parameters
Parameters in REST API format | |
---|---|
friendly_name
Required
|
A descriptive string that you create to describe the new resource. It can be up to 64 characters long. |
type
Required
|
The type of role. Can be: |
permission
Required
|
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 |
Example 1
Fetch a Role resource
https://conversations.twilio.com/v1/Roles/{Sid}
Parameters
Parameters in REST API format | |
---|---|
sid
Path
|
The SID of the Role resource to fetch. |
Example 1
Read multiple Role resources
https://conversations.twilio.com/v1/Roles
Example 1
Update a Role resource
https://conversations.twilio.com/v1/Roles/{Sid}
Parameters
Parameters in REST API format | |
---|---|
sid
Path
|
The SID of the Role resource to update. |
permission
Required
|
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 |
Example 1
Delete a Role resource
https://conversations.twilio.com/v1/Roles/{Sid}
Parameters
Parameters in REST API format | |
---|---|
sid
Path
|
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
= service.
Permission | Enables User to: |
addParticipant |
Add other users as Participants of a Conversation |
createConversation |
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 |
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 |
leaveConversation |
Leave a Conversation |
removeParticipant |
Remove Participants from a Conversation |
sendMediaMessage |
Send media Messages to Conversations |
sendMessage |
Send Messages to Conversations |
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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.