NAME

Twilio::Rest::Chat::V2::Service::Channel - The Channel resource

SYNOPSIS

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

my $channel = $client->chat->v2->services($service_sid)->channels->create(\%options);
for my $channel ($client->chat->v2->services($service_sid)->channels->read({}, 20)) {
  ...
}
my $channel = $client->chat->v2->services($service_sid)->channels($sid)->fetch;
$client->chat->v2->services($service_sid)->channels($sid)->update(\%options);
$client->chat->v2->services($service_sid)->channels($sid)->delete;

DESCRIPTION

Channels represent chat rooms

This file holds ChannelList, ChannelPage, ChannelContext and ChannelInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

ChannelList

Returned by $client->chat->v2->services($service_sid)->channels. See also Twilio::ListResource.

create

my $channel = $client->chat->v2->services($service_sid)->channels->create(\%options);

Returns a ChannelInstance.

The options are:

attributes

A valid JSON string that contains application-specific data.

created_by

The identity of the User that created the channel. Default is: system.

date_created

The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_updated

The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated. The default value is null. Note that this parameter should only be used in cases where a Channel is being recreated from a backup/separate source and where a Message was previously updated. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

friendly_name

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

type

One of public or private.

unique_name

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource's sid in the URL. This value must be 64 characters or less in length and be unique within the Service.

x_twilio_webhook_enabled

The X-Twilio-Webhook-Enabled HTTP request header One of true or false.

read

my @records = $client->chat->v2->services($service_sid)->channels->read(\%options, $limit, $page_size);

Returns the records as a list, fetching as many pages as it needs.

The options are:

type

The visibility of the Channels to read. Can be: public or private and defaults to public. One of public or private. An array reference.

stream

my $stream = $client->chat->v2->services($service_sid)->channels->stream(\%options, $limit, $page_size);

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

page

my $page = $client->chat->v2->services($service_sid)->channels->page(\%options, $page_size, $page_token, $page_number);

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

get_page

my $page = $client->chat->v2->services($service_sid)->channels->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->chat->v2->services($service_sid)->channels->get_context($sid);

Returns a ChannelContext, and makes no request.

ChannelPage

A Twilio::Page of ChannelInstance objects.

records_key

build_instance

Used by Twilio::Page.

ChannelContext

Returned by $client->chat->v2->services($service_sid)->channels($sid). It makes no request until one of these methods is called.

fetch

my $channel = $client->chat->v2->services($service_sid)->channels($sid)->fetch;

Returns a ChannelInstance.

update

my $channel = $client->chat->v2->services($service_sid)->channels($sid)->update(\%options);

Returns a ChannelInstance.

The options are:

attributes

A valid JSON string that contains application-specific data.

created_by

The identity of the User that created the channel. Default is: system.

date_created

The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_updated

The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

friendly_name

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

unique_name

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL. This value must be 256 characters or less in length and unique within the Service.

x_twilio_webhook_enabled

The X-Twilio-Webhook-Enabled HTTP request header One of true or false.

delete

$client->chat->v2->services($service_sid)->channels($sid)->delete(\%options);

Returns true.

The options are:

x_twilio_webhook_enabled

The X-Twilio-Webhook-Enabled HTTP request header One of true or false.

invites

my $list = $object->invites;

my $context = $object->invites($sid);

See Twilio::Rest::Chat::V2::Service::Channel::Invite.

members

my $list = $object->members;

my $context = $object->members($sid);

See Twilio::Rest::Chat::V2::Service::Channel::Member.

messages

my $list = $object->messages;

my $context = $object->messages($sid);

See Twilio::Rest::Chat::V2::Service::Channel::Message.

webhooks

my $list = $object->webhooks;

my $context = $object->webhooks($sid);

See Twilio::Rest::Chat::V2::Service::Channel::Webhook.

ChannelInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_sid

The SID of the Account that created the Channel resource.

attributes

The JSON string that stores application-specific data. If attributes have not been set, {} is returned.

created_by

The identity of the User that created the channel. If the Channel was created by using the API, the value is system.

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.

The absolute URLs of the Members, Messages, Invites, Webhooks and, if it exists, the last Message for the Channel.

members_count

The number of Members in the Channel.

messages_count

The number of Messages that have been passed in the Channel.

service_sid

The SID of the Service the Channel resource is associated with.

sid

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

type

One of public or private.

unique_name

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL.

url

The absolute URL of the Channel resource.

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.