NAME

Twilio::Rest::Messaging::V1::Service - The Service resource

SYNOPSIS

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

my $service = $client->messaging->v1->services->create($friendly_name, \%options);
for my $service ($client->messaging->v1->services->read({}, 20)) {
  ...
}
my $service = $client->messaging->v1->services($sid)->fetch;
$client->messaging->v1->services($sid)->update(\%options);
$client->messaging->v1->services($sid)->delete;

DESCRIPTION

A Messaging Service resource to create, fetch, update, delete or add/remove senders from Messaging Services.

This file holds ServiceList, ServicePage, ServiceContext and ServiceInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

ServiceList

Returned by $client->messaging->v1->services. See also Twilio::ListResource.

create

my $service = $client->messaging->v1->services->create($friendly_name, \%options);

Returns a ServiceInstance.

The required values are:

$friendly_name

A descriptive string that you create to describe the resource. It can be up to 64 characters long.

The options are:

area_code_geomatch

Whether to enable Area Code Geomatch on the Service Instance.

fallback_method

The HTTP method we should use to call fallback_url. Can be: GET or POST. One of GET or POST.

fallback_to_long_code

[OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.

fallback_url

The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the fallback_url defined for the Messaging Service.

inbound_method

The HTTP method we should use to call inbound_request_url. Can be GET or POST and the default is POST. One of GET or POST.

inbound_request_url

The URL we call using inbound_method when a message is received by any phone number or short code in the Service. When this property is null, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the inbound_request_url defined for the Messaging Service.

mms_converter

Whether to enable the MMS Converter for messages sent through the Service instance.

scan_message_content

One of inherit, enable or disable.

smart_encoding

Whether to enable Smart Encoding for messages sent through the Service instance.

status_callback

The URL we should call to pass status updates about message delivery.

sticky_sender

Whether to enable Sticky Sender on the Service instance.

synchronous_validation

Reserved.

use_inbound_webhook_on_number

A boolean value that indicates either the webhook url configured on the phone number will be used or inbound_request_url/fallback_url url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the inbound_request_url/fallback_url defined for the Messaging Service.

usecase

A string that describes the scenario in which the Messaging Service will be used. Possible values are notifications, marketing, verification, discussion, poll, undeclared.

validity_period

How long, in seconds, messages sent from the Service are valid. Can be an integer from 1 to 36,000. Default value is 36,000.

read

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

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

stream

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

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

page

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

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

get_page

my $page = $client->messaging->v1->services->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->messaging->v1->services->get_context($sid);

Returns a ServiceContext, and makes no request.

ServicePage

A Twilio::Page of ServiceInstance objects.

records_key

build_instance

Used by Twilio::Page.

ServiceContext

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

fetch

my $service = $client->messaging->v1->services($sid)->fetch;

Returns a ServiceInstance.

update

my $service = $client->messaging->v1->services($sid)->update(\%options);

Returns a ServiceInstance.

The options are:

area_code_geomatch

Whether to enable Area Code Geomatch on the Service Instance.

fallback_method

The HTTP method we should use to call fallback_url. Can be: GET or POST. One of GET or POST.

fallback_to_long_code

[OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.

fallback_url

The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the fallback_url defined for the Messaging Service.

friendly_name

A descriptive string that you create to describe the resource. It can be up to 64 characters long.

inbound_method

The HTTP method we should use to call inbound_request_url. Can be GET or POST and the default is POST. One of GET or POST.

inbound_request_url

The URL we call using inbound_method when a message is received by any phone number or short code in the Service. When this property is null, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the inbound_request_url defined for the Messaging Service.

mms_converter

Whether to enable the MMS Converter for messages sent through the Service instance.

scan_message_content

One of inherit, enable or disable.

smart_encoding

Whether to enable Smart Encoding for messages sent through the Service instance.

status_callback

The URL we should call to pass status updates about message delivery.

sticky_sender

Whether to enable Sticky Sender on the Service instance.

synchronous_validation

Reserved.

use_inbound_webhook_on_number

A boolean value that indicates either the webhook url configured on the phone number will be used or inbound_request_url/fallback_url url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the inbound_request_url/fallback_url defined for the Messaging Service.

usecase

A string that describes the scenario in which the Messaging Service will be used. Possible values are notifications, marketing, verification, discussion, poll, undeclared.

validity_period

How long, in seconds, messages sent from the Service are valid. Can be an integer from 1 to 36,000. Default value is 36,000.

delete

$client->messaging->v1->services($sid)->delete;

Returns true.

alpha_senders

my $list = $object->alpha_senders;

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

See Twilio::Rest::Messaging::V1::Service::AlphaSender.

channel_senders

my $list = $object->channel_senders;

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

See Twilio::Rest::Messaging::V1::Service::ChannelSender.

destination_alpha_senders

my $list = $object->destination_alpha_senders;

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

See Twilio::Rest::Messaging::V1::Service::DestinationAlphaSender.

phone_numbers

my $list = $object->phone_numbers;

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

See Twilio::Rest::Messaging::V1::Service::PhoneNumber.

short_codes

my $list = $object->short_codes;

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

See Twilio::Rest::Messaging::V1::Service::ShortCode.

us_app_to_person

my $list = $object->us_app_to_person;

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

See Twilio::Rest::Messaging::V1::Service::UsAppToPerson.

us_app_to_person_usecases

my $list = $object->us_app_to_person_usecases;

See Twilio::Rest::Messaging::V1::Service::UsAppToPersonUsecase.

ServiceInstance

See also Twilio::InstanceResource.

It has fetch, update, delete, alpha_senders, channel_senders, destination_alpha_senders, phone_numbers, short_codes, us_app_to_person and us_app_to_person_usecases, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the Service resource.

area_code_geomatch

Whether to enable Area Code Geomatch on the Service Instance.

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.

fallback_method

The HTTP method we use to call fallback_url. Can be: GET or POST. One of GET or POST.

fallback_to_long_code

[OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.

fallback_url

The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the fallback_url defined for the Messaging Service.

friendly_name

The string that you assigned to describe the resource.

inbound_method

The HTTP method we use to call inbound_request_url. Can be GET or POST. One of GET or POST.

inbound_request_url

The URL we call using inbound_method when a message is received by any phone number or short code in the Service. When this property is null, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the use_inbound_webhook_on_number field is enabled then the webhook url defined on the phone number will override the inbound_request_url defined for the Messaging Service.

The absolute URLs of related resources.

mms_converter

Whether to enable the MMS Converter for messages sent through the Service instance.

scan_message_content

One of inherit, enable or disable.

sid

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

smart_encoding

Whether to enable Smart Encoding for messages sent through the Service instance.

status_callback

The URL we call to pass status updates about message delivery.

sticky_sender

Whether to enable Sticky Sender on the Service instance.

synchronous_validation

Reserved.

url

The absolute URL of the Service resource.

us_app_to_person_registered

Whether US A2P campaign is registered for this Service.

use_inbound_webhook_on_number

A boolean value that indicates either the webhook url configured on the phone number will be used or inbound_request_url/fallback_url url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the inbound_request_url/fallback_url defined for the Messaging Service.

usecase

A string that describes the scenario in which the Messaging Service will be used. Possible values are notifications, marketing, verification, discussion, poll, undeclared.

validity_period

How long, in seconds, messages sent from the Service are valid. Can be an integer from 1 to 36,000. Default value is 36,000.

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.