Twilio Request Parameters in ASP.NET MVC

Integrating Twilio into your ASP.NET MVC applications is now just a tiny bit easier … The latest twilio-csharp project contains a few new classes which can be used as the parameter of your SMS, Voice, and Status endpoints:

This makes it so that the MVC framework will automatically map the incoming parameters into a strongly typed object:

public ActionResult sms(SmsRequest request)
{
    var response = new TwilioResponse();
    response.Sms(string.Format("You said '{0}'", request.Body));

    return TwiML(response);
}

These changes were merged in with the pull request, which was originally meant to only include the MonoTouch and Mono For Android projects. But I had made these additional changes in preparation for the talk I’ll be giving at ONETUG on using Twilio. So those changes snuck right in to the main lib :)

Leave a Comment