NAME

Twilio::Rest::Studio::V1::Flow::Engagement - The Engagement resource

SYNOPSIS

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

my $engagement = $client->studio->v1->flows($flow_sid)->engagements->create($to, $from, \%options);
for my $engagement ($client->studio->v1->flows($flow_sid)->engagements->read({}, 20)) {
  ...
}
my $engagement = $client->studio->v1->flows($flow_sid)->engagements($sid)->fetch;
$client->studio->v1->flows($flow_sid)->engagements($sid)->delete;

DESCRIPTION

[DEPRECATED] Excecutions of Studio flows

This file holds EngagementList, EngagementPage, EngagementContext and EngagementInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

EngagementList

Returned by $client->studio->v1->flows($flow_sid)->engagements. See also Twilio::ListResource.

create

my $engagement = $client->studio->v1->flows($flow_sid)->engagements->create($to, $from, \%options);

Triggers a new Engagement for the Flow. Returns a EngagementInstance.

The required values are:

$to

The Contact phone number to start a Studio Flow Engagement, available as variable {{contact.channel.address}}.

$from

The Twilio phone number to send messages or initiate calls from during the Flow Engagement. Available as variable {{flow.channel.address}}

The options are:

parameters

A JSON string we will add to your flow's context and that you can access as variables inside your flow. For example, if you pass in Parameters={'name':'Zeke'} then inside a widget you can reference the variable {{flow.data.name}} which will return the string 'Zeke'. Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode your JSON string. A hash or array reference, or a string of JSON.

read

my @records = $client->studio->v1->flows($flow_sid)->engagements->read(\%options, $limit, $page_size);

Retrieve a list of all Engagements for the Flow. Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->studio->v1->flows($flow_sid)->engagements->stream(\%options, $limit, $page_size);

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

page

my $page = $client->studio->v1->flows($flow_sid)->engagements->page(\%options, $page_size, $page_token, $page_number);

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

get_page

my $page = $client->studio->v1->flows($flow_sid)->engagements->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->studio->v1->flows($flow_sid)->engagements->get_context($sid);

Returns a EngagementContext, and makes no request.

EngagementPage

A Twilio::Page of EngagementInstance objects.

records_key

build_instance

Used by Twilio::Page.

EngagementContext

Returned by $client->studio->v1->flows($flow_sid)->engagements($sid). It makes no request until one of these methods is called.

fetch

my $engagement = $client->studio->v1->flows($flow_sid)->engagements($sid)->fetch;

Retrieve an Engagement. Returns a EngagementInstance.

delete

$client->studio->v1->flows($flow_sid)->engagements($sid)->delete;

Delete this Engagement and all Steps relating to it. Returns true.

engagement_context

my $context = $object->engagement_context;

See Twilio::Rest::Studio::V1::Flow::Engagement::EngagementContext.

steps

my $list = $object->steps;

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

See Twilio::Rest::Studio::V1::Flow::Engagement::Step.

EngagementInstance

See also Twilio::InstanceResource.

It has fetch, delete, engagement_context and steps, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the Engagement resource.

contact_channel_address

The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as name@company.com. Client identifiers are formatted client:name.

contact_sid

The SID of the Contact.

context

The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution.

date_created

The date and time in GMT when the Engagement was created in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the Engagement was updated in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

flow_sid

The SID of the Flow.

The URLs of the Engagement's nested resources.

sid

The unique string that we created to identify the Engagement resource.

status

One of active or ended.

url

The absolute URL of the resource.

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.