NAME
Twilio::Rest::Wireless::V1::Command - The Command resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $command = $client->wireless->v1->commands->create($command, \%options);
for my $command ($client->wireless->v1->commands->read({}, 20)) {
...
}
my $command = $client->wireless->v1->commands($sid)->fetch;
$client->wireless->v1->commands($sid)->delete;
DESCRIPTION
Machine-to-machine commands sent to/from devices
This file holds CommandList, CommandPage, CommandContext and CommandInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
CommandList
Returned by $client->wireless->v1->commands. See also Twilio::ListResource.
create
my $command = $client->wireless->v1->commands->create($command, \%options);
Send a Command to a Sim. Returns a CommandInstance.
The required values are:
$command-
The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode.
The options are:
callback_method-
The HTTP method we use to call
callback_url. Can be:POSTorGET, and the default isPOST. One ofGETorPOST. callback_url-
The URL we call using the
callback_urlwhen the Command has finished sending, whether the command was delivered or it failed. command_mode-
One of
textorbinary. delivery_receipt_requested-
Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to 'delivered' once the server has received a delivery receipt from the device. The default value is
true. include_sid-
Whether to include the SID of the command in the message body. Can be:
none,start, orend, and the default behavior isnone. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value ofstartwill prepend the message with the Command SID, andendwill append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included. sim-
The
sidorunique_nameof the SIM to send the Command to.
read
my @records = $client->wireless->v1->commands->read(\%options, $limit, $page_size);
Retrieve a list of Commands from your account. Returns the records as a list, fetching as many pages as it needs.
The options are:
direction-
Only return Commands with this direction value. One of
from_simorto_sim. sim-
The
sidorunique_nameof the Sim resources to read. status-
The status of the resources to read. Can be:
queued,sent,delivered,received, orfailed. One ofqueued,sent,delivered,receivedorfailed. transport-
Only return Commands with this transport value. Can be:
smsorip. One ofsmsorip.
stream
my $stream = $client->wireless->v1->commands->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->wireless->v1->commands->page(\%options, $page_size, $page_token, $page_number);
Fetches one page, and returns a Twilio::Page.
get_page
my $page = $client->wireless->v1->commands->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->wireless->v1->commands->get_context($sid);
Returns a CommandContext, and makes no request.
CommandPage
A Twilio::Page of CommandInstance objects.
records_key
build_instance
Used by Twilio::Page.
CommandContext
Returned by $client->wireless->v1->commands($sid). It makes no request until one of these methods is called.
fetch
my $command = $client->wireless->v1->commands($sid)->fetch;
Fetch a Command instance from your account. Returns a CommandInstance.
delete
$client->wireless->v1->commands($sid)->delete;
Delete a Command instance from your account. Returns true.
CommandInstance
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 Command resource.
- command
-
The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64.
- command_mode
-
One of
textorbinary. - 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.
- delivery_receipt_requested
-
Whether to request a delivery receipt.
- direction
-
One of
from_simorto_sim. - sid
-
The unique string that we created to identify the Command resource.
- sim_sid
-
The SID of the Sim resource that the Command was sent to or from.
- status
-
One of
queued,sent,delivered,receivedorfailed. - transport
-
One of
smsorip. - url
-
The absolute URL of the 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.