NAME

Twilio::Rest::Events::V1::Subscription - The Subscription resource

SYNOPSIS

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

my $subscription = $client->events->v1->subscriptions->create($description, $sink_sid, $types);
for my $subscription ($client->events->v1->subscriptions->read({}, 20)) {
  ...
}
my $subscription = $client->events->v1->subscriptions($sid)->fetch;
$client->events->v1->subscriptions($sid)->update(\%options);
$client->events->v1->subscriptions($sid)->delete;

DESCRIPTION

Subscription to send Event Types to a Sink

This file holds SubscriptionList, SubscriptionPage, SubscriptionContext and SubscriptionInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

SubscriptionList

Returned by $client->events->v1->subscriptions. See also Twilio::ListResource.

create

my $subscription = $client->events->v1->subscriptions->create($description, $sink_sid, $types);

Create a new Subscription. Returns a SubscriptionInstance.

The required values are:

$description

A human readable description for the Subscription This value should not contain PII.

$sink_sid

The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created.

$types

An array of objects containing the subscribed Event Types An array reference. A hash or array reference, or a string of JSON.

read

my @records = $client->events->v1->subscriptions->read(\%options, $limit, $page_size);

Retrieve a paginated list of Subscriptions belonging to the account used to make the request. Returns the records as a list, fetching as many pages as it needs.

The options are:

sink_sid

The SID of the sink that the list of Subscriptions should be filtered by.

stream

my $stream = $client->events->v1->subscriptions->stream(\%options, $limit, $page_size);

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

page

my $page = $client->events->v1->subscriptions->page(\%options, $page_size, $page_token, $page_number);

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

get_page

my $page = $client->events->v1->subscriptions->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->events->v1->subscriptions->get_context($sid);

Returns a SubscriptionContext, and makes no request.

SubscriptionPage

A Twilio::Page of SubscriptionInstance objects.

records_key

build_instance

Used by Twilio::Page.

SubscriptionContext

Returned by $client->events->v1->subscriptions($sid). It makes no request until one of these methods is called.

fetch

my $subscription = $client->events->v1->subscriptions($sid)->fetch;

Fetch a specific Subscription. Returns a SubscriptionInstance.

update

my $subscription = $client->events->v1->subscriptions($sid)->update(\%options);

Update a Subscription. Returns a SubscriptionInstance.

The options are:

description

A human readable description for the Subscription.

delete

$client->events->v1->subscriptions($sid)->delete;

Delete a specific Subscription. Returns true.

subscribed_events

my $list = $object->subscribed_events;

my $context = $object->subscribed_events($type);

See Twilio::Rest::Events::V1::Subscription::SubscribedEvent.

SubscriptionInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_sid

The unique SID identifier of the Account.

date_created

The date that this Subscription was created, given in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date that this Subscription was updated, given in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

description

A human readable description for the Subscription

Contains a dictionary of URL links to nested resources of this Subscription.

sid

A 34 character string that uniquely identifies this Subscription.

sink_sid

The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created.

url

The URL of this 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.