

Love them or hate them, text messages are a part of life, and your implementation may need to contact customers, vendors, or staff at any time of the day or night. Twilio provides a frictionless way to send your messages at some of the lowest cost in the industry. You can both send and receive messages in DragToCode with little effort, and we had fun connecting them.
Here's how we did it.
Twilio Setup
We created a free trial account with Twilio, but then we went ahead and spent the $10 for credit in order to buy a phone number to play with. The location of the phone number isn't important, but we were able to score a local virtual number.
The last step before we leave the Twilio site is to copy the account SID and token.
Script Setup
Now that we picked up a phone number, account SID, and token, we can enter it in a DragToCode connector.
A direct route is https://www.dragtocode.com/connectors_view?action=SMS
Here's the super-simple, one-block way to send a text message anywhere:
CAVEAT SENDER
The one and only caveat for sending text messages is in formatting the phone number: format it for an international call. In the United States, this means preface your number with "+1" (like "+14152341234") and in the UK "+44" (like "+441143520352").
Receiving Texts
A nice selling point for Twilio is that inbound messages are FREE (as of this writing),
only requiring a Twilio phone number to receive them. Let's start with the script at DragToCode,
then show how to configure Twilio to receive it.
This is a simple play on the Abbott and Costello "Who's On First" bit.
- if we receive "who", we tell them "he's on first"
- if we receive "what", we tell them "he's on second"
- if we receive anything else, we tell them "Abbott and Cosello baseball"
Configuring Twilio For Incoming SMS
When we purchased the phone number, we skipped the part about configuring it for incoming. There are two ways to do that.
https://www.dragtocode.com/script/voice?token=[YOUR_TOKEN_HERE]Into Twilio's interface:

Be sure to click save when you're done.
Breathlessly panic! It says voice in the URL! The reason why it says voice is that the voice and SMS interfaces are identical, so we re-use the URL.

Wait. How does this even work?
When Twilio receives a text, it calls the URL you set with some extra information like the sending phone ("from" variable), time ("date_created"), identification number ("sid"), and the text of the message ("body"). DragToCode receives this like a input parameters from any internet form, and makes them available to the script.
Maintaining State
DragToCode sends every variable in your script as part of the cookie submission. What that means to you is that you only need to set a regular DragToCode variable to get it back when the participant responds.
Conclusion
Customers prefer messages to almost any other form of communication. We're all texters, so why not interact with your customers that way? Give it a try and tell us about the great things you build!