NAME

Twilio::Rest::Chat::V2::Service::Channel::Webhook - The Webhook resource

SYNOPSIS

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

my $webhook = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->create($type, \%options);
for my $webhook ($client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->read({}, 20)) {
  ...
}
my $webhook = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid)->fetch;
$client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid)->update(\%options);
$client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid)->delete;

DESCRIPTION

Webhooks for specific channels

This file holds WebhookList, WebhookPage, WebhookContext and WebhookInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

WebhookList

Returned by $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks. See also Twilio::ListResource.

create

my $webhook = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->create($type, \%options);

Returns a WebhookInstance.

The required values are:

$type

One of webhook, trigger or studio.

The options are:

configuration_filters

The events that cause us to call the Channel Webhook. Used when type is webhook. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see Webhook Event Triggers. An array reference.

configuration_flow_sid

The SID of the Studio Flow to call when an event in configuration.filters occurs. Used only when type is studio.

configuration_method

One of GET or POST.

configuration_retry_count

The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.

configuration_triggers

A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when type = trigger. An array reference.

configuration_url

The URL of the webhook to call using the configuration.method.

read

my @records = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->read(\%options, $limit, $page_size);

Returns the records as a list, fetching as many pages as it needs.

stream

my $stream = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->stream(\%options, $limit, $page_size);

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

page

my $page = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->page(\%options, $page_size, $page_token, $page_number);

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

get_page

my $page = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks->get_context($sid);

Returns a WebhookContext, and makes no request.

WebhookPage

A Twilio::Page of WebhookInstance objects.

records_key

build_instance

Used by Twilio::Page.

WebhookContext

Returned by $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid). It makes no request until one of these methods is called.

fetch

my $webhook = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid)->fetch;

Returns a WebhookInstance.

update

my $webhook = $client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid)->update(\%options);

Returns a WebhookInstance.

The options are:

configuration_filters

The events that cause us to call the Channel Webhook. Used when type is webhook. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see Webhook Event Triggers. An array reference.

configuration_flow_sid

The SID of the Studio Flow to call when an event in configuration.filters occurs. Used only when type = studio.

configuration_method

One of GET or POST.

configuration_retry_count

The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.

configuration_triggers

A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when type = trigger. An array reference.

configuration_url

The URL of the webhook to call using the configuration.method.

delete

$client->chat->v2->services($service_sid)->channels($channel_sid)->webhooks($sid)->delete;

Returns true.

WebhookInstance

See also Twilio::InstanceResource.

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

Its fields are:

account_sid

The SID of the Account that created the Channel Webhook resource.

channel_sid

The SID of the Channel the Channel Webhook resource belongs to.

configuration

The JSON string that describes how the channel webhook is configured. The configuration object contains the url, method, filters, and retry_count values that are configured by the create and update actions.

date_created

The date and time in GMT when the resource was created specified 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 resource was last updated specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

service_sid

The SID of the Service the Channel Webhook resource is associated with.

sid

The unique string that we created to identify the Channel Webhook resource.

type

The type of webhook. Can be: webhook, studio, or trigger.

url

The absolute URL of the Channel Webhook 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.