メニュー

Expand
ページを評価:

SMS Command Resource

ベータ

SMS Commands for Super SIM is currently in Public Beta. Some features are not yet implemented and others may be changed before the product is declared as Generally Available. Beta products are not covered by a Twilio SLA. Learn more about beta product support.

To avoid ambiguity throughout this page, Sim (initial cap) refers to the Sim API resource. SIM (all caps) refers to the physical Subscriber Identity Module (that is, a SIM card) associated with a Sim resource.

SMS Commands enable you to exchange simple machine-to-machine (M2M) messages with devices over SMS. In order to use SMS Commands, devices must be capable of receiving and sending SMS messages. The SIM does not require an addressable phone number to send or receive a SMS Command. SMS Commands have a maximum length of 160 single-byte characters.

If you’d like to try SMS Commands out straight away, check out our Get Started guide. Or read on for the full API documentation.

SMS Commands to SIM (Mobile Terminated)

SMS Commands sent to your device, also known as Mobile Terminated (MT) SMS Commands, are initiated by making a POST request to the SMS Commands API endpoint:

https://supersim.twilio.com/v1/SmsCommands

The SMS will be sent to your SIM asynchronously. When the SMS Command API is invoked to send an SMS Command to your device, a SMS Command resource will be created with status queued. Learn more about the SMS Command states in the Status section below.

The SMS received by your device will always be from the number 000. There is no publicly addressable phone number for your Super SIM. The only way to reach it via SMS is by using the SMS Commands API.

The SMS Commands API will continue to attempt to send an SMS to your Super SIM-powered device for up to 24 hours. This is to account for cases where your device has not yet come online when your request to send an SMS Command was submitted. The status of the SMS Command resource will remain as queued until the first attempt to send it, after which its status will become sent. The command’s status will change to delivered once there its delivery has been confirmed. If there is no delivery confirmation within the 24-hour period, the status will stay sent.

You can receive status change notifications by providing a callback URL and method in your POST request. You will receive an HTTP request to that callback URL each time the command’s status changes.

SMS Commands from SIM (Mobile Originated)

All SMS sent from your device to 000 will be treated as SMS Commands. The status for all Mobile Originated (MO) SMS Commands will always be received.

You can be automatically notified when an SMS is received from your Super SIM connected device by configuring the sms_commands_url and sms_commands_method properties of the Fleet resource to which the Sim resource has been assigned. When your Super SIM-connected device sends an SMS message to the reserved number 000, an SMS Command resource will be created and your Fleet resource’s sms_commands_url will be sent a notification. The request made to your URL will include the same parameters as the SMS Commands Status Callback.

Currently all SMS, regardless of the number to which they were sent, are treated as SMS Commands, not just those sent to 000. This may change in the future. To ensure that there is no interruption to your services if this changes, all SMS you wish to be treated as Commands should be sent to 000.

Asynchronous resource

The SMS Command resource performs asynchronous operations. To receive an asynchronous notification when a SMS Command resource has finished updating, provide a callback URL, and optionally a callback method parameter, when you create the SMS Command.

SmsCommand properties

Resource Properties in REST API format
sid
sid<HC> Not PII

The unique string that we created to identify the SMS Command resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the SMS Command resource.

sim_sid
sid<HS> Not PII

The SID of the SIM that this SMS Command was sent to or from.

payload
文字列 PII MTL: 30 DAYS

The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters.

status
enum:status Not PII

The status of the SMS Command. Can be: queued, sent, delivered, received or failed. See the SMS Command Status Values for a description of each.

direction
enum:direction Not PII

The direction of the SMS Command. Can be to_sim or from_sim. The value of to_sim is synonymous with the term mobile terminated, and from_sim is synonymous with the term mobile originated.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601 format.

url
url Not PII

The absolute URL of the SMS Command resource.

SMS Command resource status callbacks

You can provide a callback method and callback URL to receive updates each time a SMS Command to your device’s status changes. The request sent to the callback URL contains the following properties:

AccountSid The SID of the Account that the SMS Command resource belongs to.
CommandSid The unique string that we created to identify the SMS Command resource.
SimSid The receiving Super SIM’s SID.
SimUniqueName The receiving Super SIM’s UniqueName.
Payload The body of the SMS Command message. This value can be up to 160 characters of text. Binary mode is not supported.
Direction Indicates whether the Command is MT or MO. It has two possible values: to_sim or from_sim.
Status The delivery status of the SMS Command.
ErrorCode

The error code (if any) associated with a failed SMS Command. Unless the status is failed, ErrorCode will not be present.

ErrorMessage A description of the error (if any) associated with a failed SMS Command. Unless the status is failed, ErrorMessage will not be present.

Status values

When the API is used to send an SMS to your device, the SMS Command resource status will be set to the statues queued. The Status property will be updated to sent when an SMS is sent from Twilio Mobile Core to the cellular network to which your device is connected (the ‘visited’ network). If a delivery receipt (DLR) is received from your device, the status will be updated to delivered. If at any point this process fails and the Command is no longer deliverable, the status will be updated to failed and an error code will be indicated on the resource.

queued The SMS Command is queued in our network waiting to be sent.
sent The SMS Command has been sent to the SIM.
delivered The SMS Command has been delivered to the SIM and there was a delivery confirmation from the device.
received The SMS Command has been received from the SIM.
failed The SMS Command could not be sent.

Create a SmsCommand resource

post
https://supersim.twilio.com/v1/SmsCommands
パラメーター
Parameters in REST API format
sim
必須
post sid<HS> Not PII

The sid or unique_name of the SIM to send the SMS Command to.

payload
必須
post 文字列 PII MTL: 30 DAYS

The message body of the SMS Command.

callback_method
オプション
post http_method Not PII

The HTTP method we should use to call callback_url. Can be: GET or POST and the default is POST.

callback_url
オプション
post url Not PII

The URL we should call using the callback_method after we have sent the command.

例 1
        
        
        

        Fetch a SmsCommand resource

        GET
        https://supersim.twilio.com/v1/SmsCommands/{Sid}
        パラメーター
        Parameters in REST API format
        sid
        Path
        GET sid<HC> Not PII

        The SID of the SMS Command resource to fetch.

        例 1
              
              
              

              Read multiple SmsCommand resources

              GET
              https://supersim.twilio.com/v1/SmsCommands
              パラメーター
              Parameters in REST API format
              sim
              オプション
              GET sid_like<HS> Not PII

              The SID or unique name of the Sim resource that SMS Command was sent to or from.

              status
              オプション
              GET ienum:status Not PII

              The status of the SMS Command. Can be: queued, sent, delivered, received or failed. See the SMS Command Status Values for a description of each.

              direction
              オプション
              GET ienum:direction Not PII

              The direction of the SMS Command. Can be to_sim or from_sim. The value of to_sim is synonymous with the term mobile terminated, and from_sim is synonymous with the term mobile originated.

              例 1
                    
                    
                    
                    ページを評価:

                    ヘルプが必要ですか?

                    We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

                          
                          
                          

                          フィードバックくださりありがとうございます!

                          We are always striving to improve our documentation quality, and your feedback is valuable to us. Please select the reason(s) for your feedback or provide additional information about how we can improve:

                          Sending your feedback...
                          🎉 Thank you for your feedback!
                          Something went wrong. Please try again.

                          Thanks for your feedback!

                          Refer us and get $10 in 3 simple steps!

                          ステップ1

                          Get link

                          Get a free personal referral link here

                          ステップ2:

                          Give $10

                          Your user signs up and upgrade using link

                          ステップ3

                          Get $10

                          1,250 free SMSes
                          OR 1,000 free voice mins
                          OR 12,000 chats
                          OR more