Rate this page:

Programmable Wireless: Send and Receive Text Messages

From October 1, 2021, Programmable SMS will no longer be supported on Programmable Wireless SIMs.

If you are currently using Programmable SMS to transfer messages between your IoT devices and your cloud, or if you plan to do so, please switch to the Commands API, which allows you to exchange machine-to-machine (M2M) SMS using a dedicated short code number.

Please see the Known Limitations section, below, for more information.

Any device connected by a Programmable Wireless SIM can send and receive Programmable SMS messages. This requires the device itself to support SMS messaging. It also requires the SIM’s Rate Plan to have Messaging selected as an Enabled Service.

SMS messages to or from a device are programmatically controlled using TwiML.

For machine-to-machine (M2M) SMS, specifically for cloud-to-device and device-to-cloud communications, see Send M2M Commands by SMS.

SIMs can only send and receive SMS messages of up to 160 characters.

SIMs cannot send or receive MMS message.

Apple iMessage is not supported.

How to send an SMS from a phone containing a Programmable Wireless SIM

To sends text mesages from your phone, you need to associate a real phone number with your SIM, and set up some logic to process messages. The logic uses Twilio Markup Language (TwiML) to ensure the message you’ve sent comes from your phone number.

Purchase an SMS-enabled Twilio phone number

You first need to purchase a Twilio phone number that is SMS enabled.

  1. Point your browser to the Buy a Number section of the Console.
  2. Optionally, enter an area code of your choice in the input field.
  3. Check at least SMS from the Capabilities selections. Additional options are available by clicking Show Advanced Search.
  4. Click Search.
  5. You should see a list of available numbers to purchase.
  6. Select one number and click Buy to buy it.


You now have a Twilio phone number that you can associate with a SIM.

Set the SMS TwiML URL for messages originated from your SIM-connected device

In the Console, you want to make sure the Internet of Things icon is visible in the side menu. If not, click All Products and Services, locate it under Super Network, and pin it to the dock.

  1. Under Programmable Wireless, click SIMs.
  2. Select the SIM that is in your phone. (Need help registering a SIM? See Ordering and Registering Your First SIM)
  3. Click the Programmable Voice & SMS tab.
  4. In the Programmable SMS section, select TwiML from the SMS URL popup.
  5. Click the blue + button to the right of the input field.
  6. You’ll now see a panel appear with a TwiML template for routing messages.
  7. You can rename the Friendly Name.
  8. In the Message element, replace YOUR_NUMBER_HERE with the number you just bought.
  9. Click Add TwiML Bin.
  10. Click Save.


You need to enter phone numbes in E.164 format. What does that mean? Look here

You’re done — you can now send text messages from your phone. Feeling creative? Use functions or set up your own TwiML server to dynamically set the Caller ID.

How to receive SMS on a phone with a Programmable Wireless SIM

You can now send SMS messages from your cellphone with a Programmable Wireless SIM but you can’t yet receive them. Let’s set this up now. Once again we’ll use TwiML to tell the Twilio cloud how to handle incoming messages.

Create TwiML for incoming SMSes

In the Console, you want to make sure the TwiML Bins icon is visible in the side menu. If not, click All Products and Services , look under Runtime and pin it to the dock.

  1. Open TwiML Bins.
  2. Click the Red + Button to create a new TwiML Bin.
  3. Enter a name in the FRIENDLY NAME input field.
  4. For the TwiML Response, you can use the example shown below: copy and paste it into the TWIML field.
  5. In the Message element, enter your SIM’s SID in place of YOUR_SIM_SID_HERE. You can find your SIM SID in the SIMs section under Programmable Wireless. The SIM Sid begins with the DE prefix. The to attribute starts with “sim:”
  6. Click Create.
<?xml version="1.0" encoding="UTF-8"?>
    <Message to="sim:YOUR_SIM_SID_HERE" from="{{From}}">


Associate TwiML with an SMS-enabled Twilio phone number

  1. Go to the Phone Numbers section of the Console and click on the number you wish to associate with your SIM
    (See Purchase an SMS-enabled Twilio phone number above if you don’t have a number yet)
  2. Scroll down to Messaging and make sure that Webhooks, TwiML Bins, Functions, Studio or Proxy is selected for CONFIGURE WITH.
  3. Under A MESSAGE COMES IN, select TwiML.
  4. Select the TwiML you created in the previous section using its Friendly Name.
  5. Click Save.

SMS Set Incoming TwiML

Well Done! Now you can try sending a message to the phone number. If everything was set up correctly, you should receive the SMS message on your SIM-connected device.

Logs and billing


You can view a log of messages send and recieved by selecting Phone Numbers > Active Numbers > Your Number in the Console and then clicking the Message Log tab.


Most call flows that involve a SIM will include two independent call legs: one call between Twilio and the non-SIM party, and the other between Twilio and the SIM-connected device.

The call leg from Twilio to the non-SIM party (PSTN, SIP, Client, etc.) is billed at standard Twilio voice rates, depending on the connectivity method used. The other call leg between Twilio and the SIM is billed at Programmable Wireless voice rates.

Known limitations

EOL notification: Programmable Wireless use of Programmable SMS will end on October 1, 2021

Twilio is ending support for Programmable SMS on Programmable Wireless SIMs on October 1, 2021. This functionality is primarily used to allow smartphones containing a Programmable Wireless SIM to send SMS messages, but Twilio IoT’s customers typically communicate with their IoT devices over data and machine-to-machine SMS which will continue to be supported through the Commands API.

From October 1, 2021, you will no longer be able to send SMS messages from a device connected with a Programmable Wireless SIM to any phone number. If you are using Programmable SMS to exchange information between IoT devices and your cloud, please switch to the Commands API, which enables the exchange of machine-to-machine SMS using a dedicated short code number.

OTT messaging applications that solely use data can continue to do so but will no longer be able to fallback to SMS if the application (e.g., iMessage) offers it.

Non-programmable SMS messages to the device

A phone number is provided on the SIM known as the MSISDN which is not used by Programmable Voice or Programmable SMS. The presence of the MSISDN means that some (potentially unwanted) calls may arrive straight to your SIM without routing via Twilio. If this occurs, Twilio cannot yet offer programmatic control over the calls and you won't see them in your Twilio call logs. However, all calls and messages originating from the SIM are programmatically routed by Twilio.

Trial accounts

Programmable SMS requires an upgraded Twilio account.

What’s next?

You’ve followed all the guides in the Getting Online section and you’re ready to dive deeper into Programmable Wireless. From here, you can learn more from our API documentation, or try some of our other guides:

Rate this page:

Need some help?

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.

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

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!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

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