Send a Command to a Sim.
Machine-to-machine commands sent to/from devices
Send a Command to a Sim.
Body
-
The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode.
-
The
sidorunique_nameof the SIM to send the Command to. -
The HTTP method we use to call
callback_url. Can be:POSTorGET, and the default isPOST.Values are
GETorPOST. -
The URL we call using the
callback_urlwhen the Command has finished sending, whether the command was delivered or it failed. -
The mode used to send the SMS message. Can be:
textorbinary. The default SMS mode istext.Values are
textorbinary. -
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. -
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.
curl \
--request POST 'https://wireless.twilio.com/v1/Commands' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'Sim=sim&Command=command&IncludeSid=include_sid&CallbackUrl=http%3A%2F%2Fwww.example.com&CommandMode=text&CallbackMethod=callback_method'
{"Sim" => "sim", "Command" => "command", "IncludeSid" => "include_sid", "CallbackUrl" => "http://www.example.com", "CommandMode" => "text", "CallbackMethod" => "callback_method"}
{"Sim" => "sim", "Command" => "command", "IncludeSid" => "include_sid", "CallbackUrl" => "http://www.example.com", "CommandMode" => "binary", "CallbackMethod" => "callback_method", "DeliveryReceiptRequested" => true}
{
"sid": "DCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://wireless.twilio.com/v1/Commands/DCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"status": "queued",
"command": "command",
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"direction": "from_sim",
"transport": "sms",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"command_mode": "text",
"date_created": "2015-07-30T20:00:00Z",
"date_updated": "2015-07-30T20:00:00Z",
"delivery_receipt_requested": true
}
{
"sid": "DCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://wireless.twilio.com/v1/Commands/DCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"status": "queued",
"command": "command",
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"direction": "to_sim",
"transport": "ip",
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"command_mode": "binary",
"date_created": "2015-07-30T20:00:00Z",
"date_updated": "2015-07-30T20:00:00Z",
"delivery_receipt_requested": true
}