How to Use Twilio to Send Text Messages from Your Application in 5 Easy Steps

December 29, 2017   //   Application Development, ,

If you’ve ever received a text from a restaurant when your table is ready, or from Uber letting you know your driver has arrived, or from your bank with an authentication code to log in, chances are you’ve experienced communication powered by Twilio.

Twilio is a communications platform that lets software developers embed voice, video, and text messaging into their applications. The company already powers communications for more than 40,000 businesses around the world including Netflix, Cocoa-Cola, and Airbnb. And this number is only expected to rise as programmable communication becomes more crucial than ever to the success of business today.

The Rise of Mobile Text Messaging in Business

We are no longer constrained to sending emails from a desktop computer. Mobile phones have allowed systems to deliver notifications in multiple ways, including voice, video, text, email, and social messaging – from anywhere, and on any device.

As technology becomes integrated into every layer of business and society at large, the habits and expectations of people are changing faster than ever before. Today’s customers want to be able to communicate with the business using their preferred method. And if you haven’t noticed, texting is quickly becoming the preference of many. Any remaining doubters need to only look at some of the latest statistics:

  • Texting is the highest rated method for customer satisfaction compared to all other communication channels (Text – 90; Phone – 77; Facebook – 6)
  • 90% of leads prefer to be texted, compared to called
  • Texting is the future: The average millennial exchanges 67 text messages per day. When given the choice between only being able to call or text, 75% of millennials choose texting over calling.

How to Use Twilio for Your Business

Bringing text messaging to your business applications is surprisingly easy with Twilio. Just follow these basic steps:

1. Get a Twillo account: Sign up at https://twilio.com. You will be provided with an account ID and token to which you can connect to use the Twilio service.

2. Add the Twilio nuget package to your solution: Inside your application code, within Visual Studio, add a reference to the Twilio nuget package. https://www.nuget.org/packages/Twilio/

3. Send your first text: The code to send a message is this easy!

var twilio = new TwilioRestClient(AccountSid, AuthToken);
var message = twilio.SendMessage(request.FromAddress, request.ToAddress, request.Body);

4. Ensure your message was sent correctly: Check the RestException property on the message object that was returned.

if (message.RestException != null)
{
response.IsSuccessful = false;
response.ErrorCode = message.RestException.Code;
response.ErrorDescription = message.RestException.Message;
response.StatusCode = Constants.COMMUNICATION_DELIVERY_STATUS_ERRORED;
LogService.Instance.Log.WarnFormat("Error sending text message to {0}. ErrorCode {1} - {2}. For more info see {3}", request.ToAddress,
message.RestException.Code,
message.RestException.Message,
message.RestException.MoreInfo);
1. }

Business Case for Text Messaging with Twilio

This tutorial gives you the basics for how to implement text messaging into your applications using Twilio. But this is just the beginning. Think about what more you can do when your business operations are interconnected with text communication and data. Once you have the foundation, you can build upon this application to allow users to respond to your texts; connect conversations to CRM to allow your sales team to look up customer information; use machine learning to create algorithms that can detect sentiment and recommend follow-up actions based on the text conversations. The possibilities are endless!

If you’re interested in taking your messaging system to the next level, contact us to learn more about our intelligent communications services and discuss the best approach for how to integrate text messaging into your business model.