NAME

Twilio::Rest::Conversations::V1::Role - The Role resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $role = $client->conversations->v1->roles->create($friendly_name, $type, $permission);
for my $role ($client->conversations->v1->roles->read({}, 20)) {
  ...
}
my $role = $client->conversations->v1->roles($sid)->fetch;
$client->conversations->v1->roles($sid)->update($permission);
$client->conversations->v1->roles($sid)->delete;

DESCRIPTION

A Role resource represents a set of permissions granted to a user within a service or a conversation.

This file holds RoleList, RolePage, RoleContext and RoleInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

RoleList

Returned by $client->conversations->v1->roles. See also Twilio::ListResource.

create

my $role = $client->conversations->v1->roles->create($friendly_name, $type, $permission);

Create a new user role in your account's default service. Returns a RoleInstance.

The required values are:

$friendly_name

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

$type

One of conversation or service.

$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 type. An array reference.

read

my @records = $client->conversations->v1->roles->read(\%options, $limit, $page_size);

Retrieve a list of all user roles in your account's default service. Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->conversations->v1->roles->stream(\%options, $limit, $page_size);

Takes the same arguments as "read", and returns a Twilio::Stream.

page

my $page = $client->conversations->v1->roles->page(\%options, $page_size, $page_token, $page_number);

Fetches one page, and returns a Twilio::Page.

get_page

my $page = $client->conversations->v1->roles->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->conversations->v1->roles->get_context($sid);

Returns a RoleContext, and makes no request.

RolePage

A Twilio::Page of RoleInstance objects.

records_key

build_instance

Used by Twilio::Page.

RoleContext

Returned by $client->conversations->v1->roles($sid). It makes no request until one of these methods is called.

fetch

my $role = $client->conversations->v1->roles($sid)->fetch;

Fetch a user role from your account's default service. Returns a RoleInstance.

update

my $role = $client->conversations->v1->roles($sid)->update($permission);

Update an existing user role in your account's default service. Returns a RoleInstance.

The required values are:

$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 type. An array reference.

delete

$client->conversations->v1->roles($sid)->delete;

Remove a user role from your account's default service. Returns true.

RoleInstance

See also Twilio::InstanceResource.

It has fetch, update and delete, which work as they do on the context.

Its fields are:

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.

date_created

The date and time in GMT when the resource was created specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the resource was last updated specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

friendly_name

The string that you assigned to describe the resource.

permissions

An array of the permissions the role has been granted.

sid

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

type

One of conversation or service.

url

An absolute API resource URL for this user role.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.