NAME

Twilio::Rest::Proxy::V1::Service::Session - The Session resource

SYNOPSIS

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

my $session = $client->proxy->v1->services($service_sid)->sessions->create(\%options);
for my $session ($client->proxy->v1->services($service_sid)->sessions->read({}, 20)) {
  ...
}
my $session = $client->proxy->v1->services($service_sid)->sessions($sid)->fetch;
$client->proxy->v1->services($service_sid)->sessions($sid)->update(\%options);
$client->proxy->v1->services($service_sid)->sessions($sid)->delete;

DESCRIPTION

This file holds SessionList, SessionPage, SessionContext and SessionInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

SessionList

Returned by $client->proxy->v1->services($service_sid)->sessions. See also Twilio::ListResource.

create

my $session = $client->proxy->v1->services($service_sid)->sessions->create(\%options);

Create a new Session. Returns a SessionInstance.

The options are:

date_expiry

The ISO 8601 date when the Session should expire. If this is value is present, it overrides the ttl value. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

mode

One of message-only, voice-only or voice-and-message.

participants

The Participant objects to include in the new session. An array reference. A hash or array reference, or a string of JSON.

status

One of open, in-progress, closed, failed or unknown.

ttl

The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.

unique_name

An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. This value should not have PII.

read

my @records = $client->proxy->v1->services($service_sid)->sessions->read(\%options, $limit, $page_size);

Retrieve a list of all Sessions for the Service. A maximum of 100 records will be returned per page. Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->proxy->v1->services($service_sid)->sessions->stream(\%options, $limit, $page_size);

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

page

my $page = $client->proxy->v1->services($service_sid)->sessions->page(\%options, $page_size, $page_token, $page_number);

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

get_page

my $page = $client->proxy->v1->services($service_sid)->sessions->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->proxy->v1->services($service_sid)->sessions->get_context($sid);

Returns a SessionContext, and makes no request.

SessionPage

A Twilio::Page of SessionInstance objects.

records_key

build_instance

Used by Twilio::Page.

SessionContext

Returned by $client->proxy->v1->services($service_sid)->sessions($sid). It makes no request until one of these methods is called.

fetch

my $session = $client->proxy->v1->services($service_sid)->sessions($sid)->fetch;

Fetch a specific Session. Returns a SessionInstance.

update

my $session = $client->proxy->v1->services($service_sid)->sessions($sid)->update(\%options);

Update a specific Session. Returns a SessionInstance.

The options are:

date_expiry

The ISO 8601 date when the Session should expire. If this is value is present, it overrides the ttl value. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

status

One of open, in-progress, closed, failed or unknown.

ttl

The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.

delete

$client->proxy->v1->services($service_sid)->sessions($sid)->delete;

Delete a specific Session. Returns true.

interactions

my $list = $object->interactions;

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

See Twilio::Rest::Proxy::V1::Service::Session::Interaction.

participants

my $list = $object->participants;

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

See Twilio::Rest::Proxy::V1::Service::Session::Participant.

SessionInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_sid

The SID of the Account that created the Session resource.

closed_reason

The reason the Session ended.

date_created

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

date_ended

The ISO 8601 date when the Session ended. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_expiry

The ISO 8601 date when the Session should expire. If this is value is present, it overrides the ttl value. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_last_interaction

The ISO 8601 date when the Session last had an interaction. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_started

The ISO 8601 date when the Session started. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

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

The URLs of resources related to the Session.

mode

One of message-only, voice-only or voice-and-message.

service_sid

The SID of the Service the session is associated with.

sid

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

status

One of open, in-progress, closed, failed or unknown.

ttl

The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction.

unique_name

An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. This value should not have PII.

url

The absolute URL of the Session 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.