.NET Twilio Server Library by Tony Gravagno

Tony1  We’re fortunate at Twilio to have an amazing community of developers that openly share their work for the rest of the
community to benefit from. One such developer is Tony Gravagno, President of Nebula Research and Development. Tony does a lot of work with
.NET and wanted to simplify working with the Twilio APIs. Existing open source options were incomplete so Tony started work
on Twilio Server Library (or TSL.NET for short).

TSL.NET covers both major use cases for working with Twilio: the REST API and TwiML responses. Lets take a look at a couple
examples of how the library works.


With complete coverage of the Twilio REST API, TSL.NET makes sending a text message as easy as two lines of code:

You can also easily initiate a call:

That’s just the beginning of what the TwilioRestClient supports. You can read more about the other features here.


TSL.NET originally started out focusing on TwiML generation inspired the PHP Helper Library. These libraries
are designed to make it easy to dynamically build TwiML from code. Let’s take a look at a simple example.

Let’s say we need some TwiML for a simple voicemail app:

Generating this can be accomplished with the following C#:

If you’re using Webforms, you can return that string using Response.Write from your generic handler or codebehind (just make sure
you set the Response.ContentType = “application/xml”). If you’re using ASP.NET MVC, you can return the XML from a controller action.

Nesting of verbs is also supported. For instance to nest a <Say> verb inside a <Gather<>

Net_v_rgb_2Tony has done a great job of providing complete coverage for both the REST API and TwiML making it extremely easy to get started
building your Twilio-based application, or integrating voice and SMS functionality into existing .NET applications. To learn more about the project, visit the project home page on CodePlex, check out the documentation or download the latest version and play with some of the included examples.