NAME
Twilio::Rest::Messaging::V1::Service::PhoneNumber - The PhoneNumber resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $phone_number = $client->messaging->v1->services($service_sid)->phone_numbers->create($phone_number_sid);
for my $phone_number ($client->messaging->v1->services($service_sid)->phone_numbers->read({}, 20)) {
...
}
my $phone_number = $client->messaging->v1->services($service_sid)->phone_numbers($sid)->fetch;
$client->messaging->v1->services($service_sid)->phone_numbers($sid)->delete;
DESCRIPTION
A Messaging Service resource to add, fetch or remove phone numbers from a Messaging Service.
This file holds PhoneNumberList, PhoneNumberPage, PhoneNumberContext and PhoneNumberInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
PhoneNumberList
Returned by $client->messaging->v1->services($service_sid)->phone_numbers. See also Twilio::ListResource.
create
my $phone_number = $client->messaging->v1->services($service_sid)->phone_numbers->create($phone_number_sid);
Returns a PhoneNumberInstance.
The required values are:
read
my @records = $client->messaging->v1->services($service_sid)->phone_numbers->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($service_sid)->phone_numbers->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->messaging->v1->services($service_sid)->phone_numbers->page(\%options, $page_size, $page_token, $page_number);
Fetches one page, and returns a Twilio::Page.
get_page
my $page = $client->messaging->v1->services($service_sid)->phone_numbers->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->messaging->v1->services($service_sid)->phone_numbers->get_context($sid);
Returns a PhoneNumberContext, and makes no request.
PhoneNumberPage
A Twilio::Page of PhoneNumberInstance objects.
records_key
build_instance
Used by Twilio::Page.
PhoneNumberContext
Returned by $client->messaging->v1->services($service_sid)->phone_numbers($sid). It makes no request until one of these methods is called.
fetch
my $phone_number = $client->messaging->v1->services($service_sid)->phone_numbers($sid)->fetch;
Returns a PhoneNumberInstance.
delete
$client->messaging->v1->services($service_sid)->phone_numbers($sid)->delete;
Returns true.
PhoneNumberInstance
See also Twilio::InstanceResource.
It has fetch and delete, which work as they do on the context.
Its fields are:
- account_sid
-
The SID of the Account that created the PhoneNumber resource.
- capabilities
-
An array of values that describe whether the number can receive calls or messages. Can be:
Voice,SMS, andMMS. - country_code
-
The 2-character ISO Country Code of the number.
- 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.
- phone_number
-
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
- service_sid
-
The SID of the Service the resource is associated with.
- sid
-
The unique string that we created to identify the PhoneNumber resource.
- url
-
The absolute URL of the PhoneNumber 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.