Send a Command to a Sim

POST /v1/Commands

Machine-to-machine commands sent to/from devices

Send a Command to a Sim.

Body

  • CallbackMethod string(http-method)

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

    Values are HEAD, GET, POST, PATCH, PUT, or DELETE.

  • CallbackUrl string(uri)

    The URL we call using the callback_url when the Command has finished sending, whether the command was delivered or it failed.

  • Command string Required

    The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode.

  • The mode to use when sending the SMS message. Can be: text or binary. The default SMS mode is text.

    Values are text or binary.

  • 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.

  • Whether to include the SID of the command in the message body. Can be: none, start, or end, and the default behavior is none. 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 of start will prepend the message with the Command SID, and end will 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 string

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

Responses

  • Created

    Hide response attributes Show response attributes object
    • account_sid string | null

      The SID of the Account that created the resource

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • command string | null

      The message being sent to or from the SIM

    • command_mode string | null

      The mode used to send the SMS message

      Values are text or binary.

    • date_created string(date-time) | null

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

    • date_updated string(date-time) | null

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

    • Whether to request a delivery receipt

    • direction string | null

      The direction of the Command

      Values are from_sim or to_sim.

    • sid string | null

      The unique string that identifies the resource

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^DC[0-9a-fA-F]{32}$.

    • sim_sid string | null

      The SID of the Sim resource that the Command was sent to or from

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^DE[0-9a-fA-F]{32}$.

    • status string | null

      The status of the Command

      Values are queued, sent, delivered, received, or failed.

    • transport string | null

      The type of transport used

      Values are sms or ip.

    • url string(uri) | null

      The absolute URL of the resource

POST /v1/Commands
curl \
 -X POST https://wireless.twilio.com/v1/Commands \
 --user "username:password" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d 'CallbackMethod=HEAD&CallbackUrl=https%3A%2F%2Fexample.com&Command=string&CommandMode=text&DeliveryReceiptRequested=true&IncludeSid=string&Sim=string'
Request example
{
  "CallbackMethod": "HEAD",
  "CallbackUrl": "https://example.com",
  "Command": "string",
  "CommandMode": "text",
  "DeliveryReceiptRequested": true,
  "IncludeSid": "string",
  "Sim": "string"
}
Request examples
{
  "CallbackMethod": "HEAD",
  "CallbackUrl": "https://example.com",
  "Command": "string",
  "CommandMode": "text",
  "DeliveryReceiptRequested": true,
  "IncludeSid": "string",
  "Sim": "string"
}
Response examples (201)
{
  "account_sid": "string",
  "command": "string",
  "command_mode": "text",
  "date_created": "2023-05-04T09:42:00+00:00",
  "date_updated": "2023-05-04T09:42:00+00:00",
  "delivery_receipt_requested": true,
  "direction": "from_sim",
  "sid": "string",
  "sim_sid": "string",
  "status": "queued",
  "transport": "sms",
  "url": "https://example.com"
}
Response examples (201)
{
  "account_sid": "string",
  "command": "string",
  "command_mode": "text",
  "date_created": "2024-05-04T09:42:00+00:00",
  "date_updated": "2024-05-04T09:42:00+00:00",
  "delivery_receipt_requested": true,
  "direction": "from_sim",
  "sid": "string",
  "sim_sid": "string",
  "status": "queued",
  "transport": "sms",
  "url": "https://example.com"
}