NAME
Twilio::Rest::Memory::V1::Observation - The Observation resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $observation = $client->memory->v1->observations($store_id, $profile_id)->create(\%body, \%options);
for my $observation ($client->memory->v1->observations($store_id, $profile_id)->read({}, 20)) {
...
}
my $observation = $client->memory->v1->observations($store_id, $profile_id, $observation_id)->fetch;
$client->memory->v1->observations($store_id, $profile_id, $observation_id)->patch(\%body);
$client->memory->v1->observations($store_id, $profile_id, $observation_id)->delete;
DESCRIPTION
This file holds ObservationList, ObservationPage, ObservationContext, ObservationInstance, ObservationCreatedResponseInstance, CreateProfileObservation308ResponseInstance, PatchProfileObservation202ResponseInstance and DeleteProfileObservation202ResponseInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
ObservationList
Returned by $client->memory->v1->observations($store_id, $profile_id). See also Twilio::ListResource.
create
my $observation = $client->memory->v1->observations($store_id, $profile_id)->create(\%body, \%options);
Create one or more transient observations associated with the specified profile. Supports both single observation creation and batch creation of up to 10 observations. Supports request compression for large batch operations and response compression for the response. All observations will be automatically indexed for semantic search capabilities. The content can be up to 4KB in length and should contain relevant information about the profile. The createdAt and updatedAt timestamps will be automatically set to the current time. Each observation will be created with a unique ID in Twilio Type ID (TTID) format. Returns a CreateProfileObservation308ResponseInstance when Twilio answers 308, and a ObservationCreatedResponseInstance otherwise.
%body is sent as JSON. It takes the names Twilio's API documentation uses.
Its fields are:
observations-
Required. Array of observations to create in a single batch operation.
The options are:
accept_encoding-
Compression algorithms supported by the client (e.g., gzip, deflate, br)
content_encoding-
Compression algorithm used for the request body (e.g., gzip, deflate, br) One of
gzip,deflate,brorcompress.
read
my @records = $client->memory->v1->observations($store_id, $profile_id)->read(\%options, $limit, $page_size);
Retrieve a paginated list of transient observations for a specific profile. Observations are sorted by creation time in descending order by default. Results can be filtered by source parameter. Supports response compression for large datasets. Returns the records as a list, fetching as many pages as it needs.
The options are:
accept_encoding-
Compression algorithms supported by the client (e.g., gzip, deflate, br)
conversation_id-
Filter by conversation ID. Returns only items associated with the specified conversation.
created_after-
Filter observations created after this timestamp (inclusive). A string, or an object with an
epochmethod. See "iso8601_date_time" in Twilio::Serialize. created_before-
Filter observations created before this timestamp (exclusive). A string, or an object with an
epochmethod. See "iso8601_date_time" in Twilio::Serialize. order_by-
Either 'ASC' or 'DESC' to sort results ascending or descending respectively. One of
ASCorDESC. source-
Filter by source. Allows letters, numbers, spaces, periods, underscores, hyphens, and forward slashes.
stream
my $stream = $client->memory->v1->observations($store_id, $profile_id)->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->memory->v1->observations($store_id, $profile_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->memory->v1->observations($store_id, $profile_id)->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->memory->v1->observations($store_id, $profile_id)->get_context($observation_id);
Returns a ObservationContext, and makes no request.
ObservationPage
A Twilio::Page of ObservationInstance objects.
records_key
build_instance
Used by Twilio::Page.
ObservationContext
Returned by $client->memory->v1->observations($store_id, $profile_id, $observation_id). It makes no request until one of these methods is called.
fetch
my $observation = $client->memory->v1->observations($store_id, $profile_id, $observation_id)->fetch;
Retrieve a specific transient observation by its ID for the given profile. Returns a ObservationInstance.
patch
my $observation = $client->memory->v1->observations($store_id, $profile_id, $observation_id)->patch(\%body);
Update a specific transient observation by its ID. Only provided fields will be updated. The updated timestamp will be automatically set. This allows for selective updates without needing to provide all fields. Returns a CreateProfileObservation308ResponseInstance when Twilio answers 308, and a PatchProfileObservation202ResponseInstance otherwise.
%body is sent as JSON. It takes the names Twilio's API documentation uses.
Its fields are:
content-
The main content of the observation.
conversationIds-
Array of conversation IDs associated with this observation.
occurredAt-
The timestamp when the observation originally occurred.
source-
The source system that generated this observation. Allows letters, numbers, spaces, periods, underscores, hyphens, and forward slashes.
delete
$client->memory->v1->observations($store_id, $profile_id, $observation_id)->delete;
Delete a specific transient observation by its ID. This action is irreversible. Returns a CreateProfileObservation308ResponseInstance when Twilio answers 308, and a DeleteProfileObservation202ResponseInstance otherwise.
ObservationInstance
See also Twilio::InstanceResource.
It has fetch, patch and delete, which work as they do on the context.
Its fields are:
- content
-
The main content of the observation.
- conversation_ids
-
Array of conversation IDs associated with this observation.
- created_at
-
The timestamp when the observation was created. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- id
-
No description in the specification.
- occurred_at
-
The timestamp when the observation originally occurred. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- source
-
The source system that generated this observation. Allows letters, numbers, spaces, periods, underscores, hyphens, and forward slashes.
- updated_at
-
The timestamp when the observation was last updated. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
ObservationCreatedResponseInstance
Returned by create, for an answer that is not a Observation. See also Twilio::InstanceResource.
Its fields are:
- message
-
Confirmation message for the operation.
CreateProfileObservation308ResponseInstance
Returned by create, patch and delete, for an answer that is not a Observation. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
- uri
-
No description in the specification.
PatchProfileObservation202ResponseInstance
Returned by patch, for an answer that is not a Observation. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
DeleteProfileObservation202ResponseInstance
Returned by delete, for an answer that is not a Observation. See also Twilio::InstanceResource.
Its fields are:
- message
-
No description in the specification.
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.