NAME
Twilio::Rest::Messaging::V1::Service::ShortCode - The ShortCode resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $short_code = $client->messaging->v1->services($service_sid)->short_codes->create($short_code_sid);
for my $short_code ($client->messaging->v1->services($service_sid)->short_codes->read({}, 20)) {
...
}
my $short_code = $client->messaging->v1->services($service_sid)->short_codes($sid)->fetch;
$client->messaging->v1->services($service_sid)->short_codes($sid)->delete;
DESCRIPTION
A Messaging Service resource to add, fetch or remove short code numbers from a Messaging Service.
This file holds ShortCodeList, ShortCodePage, ShortCodeContext and ShortCodeInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
ShortCodeList
Returned by $client->messaging->v1->services($service_sid)->short_codes. See also Twilio::ListResource.
create
my $short_code = $client->messaging->v1->services($service_sid)->short_codes->create($short_code_sid);
Returns a ShortCodeInstance.
The required values are:
read
my @records = $client->messaging->v1->services($service_sid)->short_codes->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)->short_codes->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)->short_codes->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)->short_codes->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->messaging->v1->services($service_sid)->short_codes->get_context($sid);
Returns a ShortCodeContext, and makes no request.
ShortCodePage
A Twilio::Page of ShortCodeInstance objects.
records_key
build_instance
Used by Twilio::Page.
ShortCodeContext
Returned by $client->messaging->v1->services($service_sid)->short_codes($sid). It makes no request until one of these methods is called.
fetch
my $short_code = $client->messaging->v1->services($service_sid)->short_codes($sid)->fetch;
Returns a ShortCodeInstance.
delete
$client->messaging->v1->services($service_sid)->short_codes($sid)->delete;
Returns true.
ShortCodeInstance
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 ShortCode resource.
- capabilities
-
An array of values that describe whether the number can receive calls or messages. Can be:
SMSandMMS. - 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.
- service_sid
-
The SID of the Service the resource is associated with.
- short_code
-
The E.164 format of the short code.
- sid
-
The unique string that we created to identify the ShortCode resource.
- url
-
The absolute URL of the ShortCode 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.