NAME

Twilio::Rest::Conversations::V1::Service::Conversation - The Conversation resource

SYNOPSIS

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

my $conversation = $client->conversations->v1->services($chat_service_sid)->conversations->create(\%options);
for my $conversation ($client->conversations->v1->services($chat_service_sid)->conversations->read({}, 20)) {
  ...
}
my $conversation = $client->conversations->v1->services($chat_service_sid)->conversations($sid)->fetch;
$client->conversations->v1->services($chat_service_sid)->conversations($sid)->update(\%options);
$client->conversations->v1->services($chat_service_sid)->conversations($sid)->delete;

DESCRIPTION

A Service Conversation resource represents an omnichannel group conversation with an ordered list of messages and a participant roster.

This file holds ConversationList, ConversationPage, ConversationContext and ConversationInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

ConversationList

Returned by $client->conversations->v1->services($chat_service_sid)->conversations. See also Twilio::ListResource.

create

my $conversation = $client->conversations->v1->services($chat_service_sid)->conversations->create(\%options);

Create a new conversation in your service. Returns a ConversationInstance.

The options are:

attributes

An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

bindings_email_address

The default email address that will be used when sending outbound emails in this conversation.

bindings_email_name

The default name that will be used when sending outbound emails in this conversation.

date_created

The date that this resource was created. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_updated

The date that this resource was last updated. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

friendly_name

The human-readable name of this conversation, limited to 256 characters. Optional.

messaging_service_sid

The unique ID of the Messaging Service this conversation belongs to.

state

One of inactive, active, closed or initializing.

timers_closed

ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.

timers_inactive

ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.

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.

x_twilio_webhook_enabled

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

read

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

Retrieve a list of conversations in your service. Returns the records as a list, fetching as many pages as it needs.

The options are:

end_date

Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order.

start_date

Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order.

state

State for sorting and filtering list of Conversations. Can be active, inactive or closed One of inactive, active, closed or initializing.

stream

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

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

page

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

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

get_page

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

Fetches the page at a URL given by Twilio.

get_context

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

Returns a ConversationContext, and makes no request.

ConversationPage

A Twilio::Page of ConversationInstance objects.

records_key

build_instance

Used by Twilio::Page.

ConversationContext

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

fetch

my $conversation = $client->conversations->v1->services($chat_service_sid)->conversations($sid)->fetch;

Fetch a conversation from your service. Returns a ConversationInstance.

update

my $conversation = $client->conversations->v1->services($chat_service_sid)->conversations($sid)->update(\%options);

Update an existing conversation in your service. Returns a ConversationInstance.

The options are:

attributes

An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

bindings_email_address

The default email address that will be used when sending outbound emails in this conversation.

bindings_email_name

The default name that will be used when sending outbound emails in this conversation.

date_created

The date that this resource was created. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_updated

The date that this resource was last updated. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

friendly_name

The human-readable name of this conversation, limited to 256 characters. Optional.

messaging_service_sid

The unique ID of the Messaging Service this conversation belongs to.

state

One of inactive, active, closed or initializing.

timers_closed

ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.

timers_inactive

ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.

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.

x_twilio_webhook_enabled

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

delete

$client->conversations->v1->services($chat_service_sid)->conversations($sid)->delete(\%options);

Remove a conversation from your service. Returns true.

The options are:

x_twilio_webhook_enabled

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

messages

my $list = $object->messages;

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

See Twilio::Rest::Conversations::V1::Service::Conversation::Message.

participants

my $list = $object->participants;

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

See Twilio::Rest::Conversations::V1::Service::Conversation::Participant.

webhooks

my $list = $object->webhooks;

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

See Twilio::Rest::Conversations::V1::Service::Conversation::Webhook.

ConversationInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_sid

The unique ID of the Account responsible for this conversation.

attributes

An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

bindings

No description in the specification.

chat_service_sid

The unique ID of the Conversation Service this conversation belongs to.

date_created

The date that this resource was created. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date that this resource was last updated. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

friendly_name

The human-readable name of this conversation, limited to 256 characters. Optional.

Contains absolute URLs to access the participants, messages and webhooks of this conversation.

messaging_service_sid

The unique ID of the Messaging Service this conversation belongs to.

sid

A 34 character string that uniquely identifies this resource.

state

One of inactive, active, closed or initializing.

timers

Timer date values representing state update for this conversation.

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

An absolute API resource URL for this conversation.

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.