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 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. |
service_sid
|
The SID of the 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
|
The absolute URL of the Role resource. |
Create a Role resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Roles
パラメーター
Names in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to create the Role resource under. |
friendly_name
必須
|
A descriptive string that you create to describe the new resource. It can be up to 64 characters long. |
type
必須
|
The type of role. Can be: |
permission
必須
|
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 |
例 1
Fetch a Role resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Roles/{Sid}
パラメーター
Names in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to fetch the Role resource from. |
sid
Path
|
The SID of the Role resource to fetch. |
例 1
Read multiple Role resources
https://chat.twilio.com/v2/Services/{ServiceSid}/Roles
パラメーター
Names in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to read the Role resources from. |
例 1
Update a Role resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Roles/{Sid}
パラメーター
Names in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to update the Role resource in. |
sid
Path
|
The SID of the Role resource to update. |
permission
必須
|
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 |
例 1
Delete a Role resource
https://chat.twilio.com/v2/Services/{ServiceSid}/Roles/{Sid}
パラメーター
Names in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to delete the Role resource from. |
sid
Path
|
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 |
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。