Menu

Expand
Rate this page:

Roles and Permissions

Programmable Chat will no longer be available or supported after July 25, 2022. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.

If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.

The Programmable Chat Permission model uses Roles and Permissions to enforce what Users and Members can do within a Service instance. These permissions are related to Channels, Members, and Messages. Roles and their associated permissions can be edited and extended on a per Service instance basis to meet the needs of different use cases.

Table of Contents

Roles and Role Scopes

Chat Roles are divided into two "Scopes," Service and Channel. These determine how the Role permissions are applied depending on the context.

  • Service level Roles are assigned to Users and dictate which Channels the User can see, join, and create.
  • Channel level Roles are assigned to Members within a Channel. These roles determine what Members can do within that Channel, such as send Messages, add other Members, edit Messages and more.

Permissions are enforced at runtime based on the action being performed and whether the User/Member's Role has the required Permissions. If they do, the action is allowed and will be processed. If not, the action will be disallowed, and an error message will be returned to the requesting endpoint (usually a 403 Permission Denied error).

Note: Chat Service instances are created with a default set of Roles and Permissions. You can modify and extend these Roles and their assigned Permissions via the REST API.

Default Roles and Permissions

When a new Chat Service instance is created, the following default Roles are created with the assigned set of Permissions:

Role Type Permissions
Service Admin deployment
  • createChannel
  • joinChannel
  • destroyChannel
  • editChannelAttributes
  • editChannelName
  • addMember
  • inviteMember
  • removeMember
  • editAnyMemberAttributes
  • editAnyMessage
  • deleteAnyMessage
  • editAnyMessageAttributes
  • editAnyUserInfo
Service User (Default Service User Role) deployment
  • createChannel
  • editOwnUserInfo
  • joinChannel
Channel Admin channel
  • addMember
  • deleteAnyMessage
  • destroyChannel
  • editAnyMessage
  • editAnyMessageAttributes
  • editAnyMemberAttributes
  • editChannelAttributes
  • editChannelName
  • editNotificationLevel
  • inviteMember
  • leaveChannel
  • removeMember
  • sendMediaMessage
  • sendMessage
Channel User (Default Channel Member Role) channel
  • deleteOwnMessage
  • editOwnMessage
  • editOwnMessageAttributes
  • editOwnMemberAttributes
  • leaveChannel
  • sendMediaMessage
  • sendMessage
  • editNotificationLevel

Manage Roles and Permissions

It is possible to manage Roles within a Service instance, create new ones, modify Permissions for a Role, and more via the Roles REST endpoint. The following roles and permissions management best practices will help you to setup needed roles for the newly created or invited users.

  • When you create a User you must pick a Service Role, if you have not created your own Service Role, you must choose whether they are a Service User, or a Service Admin.
  • When you invite a User to a Channel, they become a member and the Channel Role they receive is an optional parameter in the invite. Alternatively, you can add the optional Channel Role while Creating a Channel Member by adding the member using the Identity of the User.

You can also create your own Service and Channel Roles if the defaults do not suit you. We recommend leaving the default roles untouched. To see the full list of permissions available please follow this link.

You can find more information on how to do this in our Programmable Chat Roles REST Resource

Note: While it is possible to delete the default Roles, it is not advisable, as any Users and Members created before the delete will reference the Default Role SIDs. Instead, modify these roles and reuse them, adding new Roles as needed.

Modifying Permissions in the Twilio Console

Adding or Removing Permissions

To add or remove permissions, first select the Chat Service which you would like to modify. Click the Chat heading in the left sidebar, then click Manage. You will then see the Services menu option, give it a click. Once on the "Chat Services" page select the name of the Chat service you want to edit.

Chat Services Selection Page

Click Roles and Permissions in the side navigation menu and select the "deployment" role.

Chat Roles and Permissions

From here, you can add and remove permissions as needed.

Edit chat Roles and Permissions

Adding or Removing Permissions for a Specific User

From the page of the individual Chat service you’d like to modify, click Users and search for a specific user identity from your list of users, and click the Identity name once found.

List of Chat Users

You can now adjust the role for that user by selecting either "service user" or "service admin".

Individual User Screen

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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

        
        
        

        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        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