Programmable Messaging

Learn how to use Twilio's Programmable Messaging to send outbound SMS messages and respond to incoming messages.

Send an outbound SMS message

The code in the following widget sends an SMS message from our Twilio phone number (specified by from_) to our desired phone number (specified by to). The text of the SMS is specified by the body field.

Note: Please avoid any special character in the body text because it sometimes causes problems in the SMS delivery.

Put the desired to number against the YOUR_MOBILE_NUMBER API key in the widget below using the following E.164 formatting, which is the format used for international phone numbers:

[+][country code][phone number including area code]

Note: If the desired phone number is different than the number we used while creating the Twilio account, we need to verify that number. We can visit the Verified Caller IDs page to add our desired number to the verified caller IDs.

Press the “Run” button in the following widget to receive an SMS message on our phone from our Twilio number.

Get hands-on with 1200+ tech skills courses.