NAME

Twilio::Rest::Insights::V3::CustomFieldMapping - The CustomFieldMapping resource

SYNOPSIS

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

my $custom_field_mapping = $client->insights->v3->custom_field_mappings->create(\%body);
for my $custom_field_mapping ($client->insights->v3->custom_field_mappings->read({}, 20)) {
  ...
}
my $custom_field_mapping = $client->insights->v3->custom_field_mappings($mapping_id)->fetch;
$client->insights->v3->custom_field_mappings($mapping_id)->patch(\%body, \%options);

DESCRIPTION

This file holds CustomFieldMappingList, CustomFieldMappingPage, CustomFieldMappingContext and CustomFieldMappingInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

CustomFieldMappingList

Returned by $client->insights->v3->custom_field_mappings. See also Twilio::ListResource.

create

my $custom_field_mapping = $client->insights->v3->custom_field_mappings->create(\%body);

Registers a custom field for the account. entityMetadata.sourceType selects where the field's value comes from, and the matching property on entityMetadata (intelligenceOperator for INTELLIGENCE_OPERATOR) carries its details. Only the MEASURE category is supported for now. The request is validated before the mapping is created: - name contains only letters, digits and _, and is not already registered for the account (otherwise 409); - description, when present, is at most 150 characters; - for INTELLIGENCE_OPERATOR, the operator has an active version with outputFormat JSON, and entityMetadata.intelligenceOperator.field is one or two .-separated segments that resolve to a number or integer property in that version's output schema (otherwise 400); - the account has a free slot in the category; by default an account can register up to 3 custom measures (otherwise 403). Use GET /v3/ControlPlane/ConversationInsights/CustomFieldMappingsCapacity to check the remaining slots. Create-only: if a mapping with the same name already exists for the account, 409 is returned with the existing mapping's id and nothing is changed. To modify an existing mapping, use PATCH /v3/ControlPlane/ConversationInsights/CustomFieldMappings/{mappingId}. Returns a CustomFieldMappingInstance.

%body is sent as JSON. It takes the names Twilio's API documentation uses.

Its fields are:

category

Required. Must be MEASURE.

description

Optional, free-text description of this custom field mapping, up to 150 characters. Display-only — not part of any uniqueness check.

entityMetadata

Required. No description in the specification.

name

Required. Name of the custom field, used to reference it in Insights queries. Contains only letters, digits and _, and must not be empty. Must be unique within the account across every sourceType; registering an existing name returns 409. Cannot be changed after registration.

read

my @records = $client->insights->v3->custom_field_mappings->read(\%options, $limit, $page_size);

Returns the custom field mappings registered for the account, one page at a time. Use pageSize to limit the number of mappings returned, and pass meta.nextToken from a response as pageToken to fetch the next page. On the last page, meta.nextToken is null. Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->insights->v3->custom_field_mappings->stream(\%options, $limit, $page_size);

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

page

my $page = $client->insights->v3->custom_field_mappings->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->insights->v3->custom_field_mappings->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->insights->v3->custom_field_mappings->get_context($mapping_id);

Returns a CustomFieldMappingContext, and makes no request.

CustomFieldMappingPage

A Twilio::Page of CustomFieldMappingInstance objects.

records_key

build_instance

Used by Twilio::Page.

CustomFieldMappingContext

Returned by $client->insights->v3->custom_field_mappings($mapping_id). It makes no request until one of these methods is called.

fetch

my $custom_field_mapping = $client->insights->v3->custom_field_mappings($mapping_id)->fetch;

Returns a single custom field mapping by its mappingId. The ETag response header identifies the mapping's current version; supply it as If-Match on PATCH to guard against concurrent updates. Returns a CustomFieldMappingInstance.

patch

my $custom_field_mapping = $client->insights->v3->custom_field_mappings($mapping_id)->patch(\%body, \%options);

Partially updates an existing custom field mapping. Only the properties present in the body are changed. The updatable properties depend on the mapping's sourceType; for INTELLIGENCE_OPERATOR, only entityMetadata.intelligenceOperator.field can be updated today. The new field is validated the same way as at registration: it must be one or two .-separated segments of letters, digits and _, and resolve to a number or integer property in the output schema of the operator's latest active version. The mapping's id, name, category, createdAt and owning entity never change. Sending a field value equal to the current one is a no-op that returns 200 without modifying the mapping, so the operation is idempotent. Supply If-Match with the ETag returned by GET, POST or a previous PATCH to guard against concurrent updates. Values already ingested are not recomputed; results processed after the update use the new field. Returns a CustomFieldMappingInstance.

%body is sent as JSON. It takes the names Twilio's API documentation uses.

Its fields are:

entityMetadata

No description in the specification.

The options are:

if_match

ETag of the custom field mapping, as returned in the ETag response header. When supplied, the update is applied only if the mapping has not changed since that ETag was issued; otherwise 412 is returned.

CustomFieldMappingInstance

See also Twilio::InstanceResource.

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

Its fields are:

category

Must be MEASURE.

created_at

When the mapping was registered. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

description

Optional, free-text description supplied at registration time. Display-only — not part of any uniqueness check.

entity_metadata

No description in the specification.

id

The unique identifier of the custom field mapping.

name

Name of the custom field, unique within the account.

updated_at

When the mapping was last modified via PATCH. Null until the first update. 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.