NAME

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

SYNOPSIS

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

my $communication = $client->conversations->v2->communications($conversation_id)->create(\%body);
for my $communication ($client->conversations->v2->communications($conversation_id)->read({}, 20)) {
  ...
}
my $communication = $client->conversations->v2->communications($conversation_id, $id)->fetch;

DESCRIPTION

This file holds CommunicationList, CommunicationPage, CommunicationContext and CommunicationInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

CommunicationList

Returned by $client->conversations->v2->communications($conversation_id). See also Twilio::ListResource.

create

my $communication = $client->conversations->v2->communications($conversation_id)->create(\%body);

Create a Communication. Returns a CommunicationInstance.

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

Its fields are:

author

Required. No description in the specification.

channelId

No description in the specification.

content

Required. The content of the Communication.

occurredAt

Timestamp when this Communication occurred. If omitted, the server uses the current time.

recipients

Required. No description in the specification.

resourceId

External resource identifier for this Communication (e.g. MessageSid for SMS/RCS/WhatsApp, TranscriptionSid + MessageIndex for Voice). If a Communication with the same resourceId already exists in the Conversation, it is updated instead of a new one being created.

read

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

Retrieve a list of Communications in a Conversation. Returns the records as a list, fetching as many pages as it needs.

The options are:

channel_id

Resource identifier to filter communications

stream

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

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

page

my $page = $client->conversations->v2->communications($conversation_id)->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->communications($conversation_id)->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

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

Returns a CommunicationContext, and makes no request.

CommunicationPage

A Twilio::Page of CommunicationInstance objects.

records_key

build_instance

Used by Twilio::Page.

CommunicationContext

Returned by $client->conversations->v2->communications($conversation_id, $id). It makes no request until one of these methods is called.

fetch

my $communication = $client->conversations->v2->communications($conversation_id, $id)->fetch;

Retrieve a Communication. Returns a CommunicationInstance.

CommunicationInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_id

Account ID.

author

No description in the specification.

channel_id

Channel-specific reference ID.

content

The content of the Communication using type field for discrimination.

conversation_id

Conversation ID.

created_at

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

id

Communication ID.

occurred_at

ISO 8601 timestamp when the communication occurred. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

recipients

Communication recipients.

resource_id

External resource identifier for this Communication (e.g. MessageSid for SMS/RCS/WhatsApp, TranscriptionSid + MessageIndex for Voice). When set, used for Communication deduplication/uniqueness within a Conversation.

updated_at

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

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.