NAME

Twilio::Rest::Conversations::V2::Conversation - The Conversation resource

SYNOPSIS

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

my $conversation = $client->conversations->v2->conversations->create(\%body);
for my $conversation ($client->conversations->v2->conversations->read({}, 20)) {
  ...
}
my $conversation = $client->conversations->v2->conversations($id)->fetch;
$client->conversations->v2->conversations($id)->patch(\%body);
$client->conversations->v2->conversations($id)->update(\%body);
$client->conversations->v2->conversations($id)->delete;

DESCRIPTION

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

ConversationList

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

create

my $conversation = $client->conversations->v2->conversations->create(\%body);

Create a new conversation. Returns a ConversationInstance.

%body is sent as JSON. It can be left out. When given, it takes the names Twilio's API documentation uses.

Its fields are:

configuration

Conversation configuration settings. Without configurationId, conversationGroupingType and memoryStoreId are required. With configurationId, these settings override the Configuration's own for this Conversation only.

configurationId

The ID of an existing configuration. Omit it to define the configuration inline in configuration.

metadata

Optional customer-managed key-value metadata for this Conversation. Maximum 8 entries; keys up to 128 characters allowing alphanumeric characters, periods, underscores, and dashes; values up to 512 characters.

name

The name of the conversation.

participants

Optional list of Participants to create with the Conversation.

read

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

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

The options are:

channel_id

The resource identifier (such as callSid or messageSid) to filter conversations.

status

Filters for specific statuses One of ACTIVE, INACTIVE or CLOSED. An array reference.

stream

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

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

page

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

Fetches one page, and returns a Twilio::TokenPaginationPage. This API pages by token, so there is no page number.

get_page

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

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->conversations->v2->conversations->get_context($id);

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->v2->conversations($id). It makes no request until one of these methods is called.

fetch

my $conversation = $client->conversations->v2->conversations($id)->fetch;

Retrieve a Conversation. Returns a ConversationInstance.

patch

my $conversation = $client->conversations->v2->conversations($id)->patch(\%body);

Partially update the details of an existing Conversation. Returns a ConversationInstance.

%body is sent as JSON. It can be left out. When given, it takes the names Twilio's API documentation uses.

Its fields are:

configuration

Partial configuration update for an existing conversation. Only statusCallbacks can be modified.

metadata

Merge patch for customer-managed metadata (max 8 entries after merge). Provided keys are added or updated; keys set to null are removed; keys not mentioned are preserved.

name

The name of the Conversation.

status

Lifecycle status of a Conversation. One of ACTIVE, INACTIVE or CLOSED.

update

my $conversation = $client->conversations->v2->conversations($id)->update(\%body);

Update an existing conversation. Returns a ConversationInstance.

%body is sent as JSON. It can be left out. When given, it takes the names Twilio's API documentation uses.

Its fields are:

metadata

Customer-managed key-value metadata for this Conversation. Maximum 8 entries; keys up to 128 characters allowing alphanumeric characters, periods, underscores, and dashes; values up to 512 characters.

name

The name of the Conversation.

status

Required. Lifecycle status of a Conversation. One of ACTIVE, INACTIVE or CLOSED.

delete

$client->conversations->v2->conversations($id)->delete(\%options);

Asynchronously delete a conversation and all associated data. Returns 202 Accepted with an Operation-Id for status tracking via GET /v2/ControlPlane/Operations/{operationId}. Returns a DeleteConversationAsync202ResponseInstance.

The options are:

idempotency_key

Client-generated UUID key to ensure idempotent behavior. Submitting the same key returns the original response without creating a duplicate operation. Keys are scoped to account + region with a 24-hour TTL.

ConversationInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_id

Account ID.

action_id

The Action created for the request's action, present only on the create response that dispatched one. Poll GET /v2/Conversations/{ConversationId}/Actions/{ActionId} for its status.

configuration

Full configuration settings for this Conversation.

configuration_id

Configuration ID. Null when the Conversation was created with an inline configuration.

created_at

Timestamp when this Conversation was created. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

id

Conversation ID.

metadata

Customer-managed key-value metadata for this Conversation.

name

Conversation name.

participants

Participants in this Conversation.

status

Conversation status. One of ACTIVE, INACTIVE or CLOSED.

updated_at

Timestamp when this Conversation was last updated. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

DeleteConversationAsync202ResponseInstance

Returned by delete, for an answer that is not a Conversation. See also Twilio::InstanceResource.

Its fields are:

Named resource identifiers associated with this operation. Keys depend on the operation type: - config-create, config-update, config-delete: configurationId - conversation-delete: conversationId

status_url

URL to poll for operation status.

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.