Skip to content

Instantly share code, notes, and snippets.

@jgable
Created April 24, 2011 20:28
Show Gist options
  • Save jgable/939852 to your computer and use it in GitHub Desktop.
Save jgable/939852 to your computer and use it in GitHub Desktop.
TextController.cs - An example SMS Responder Controller for MVC 3
using System.Web.Mvc;
using _8Ball.Common;
using TwilioSharp.MVC3.Controllers;
using TwilioSharp.Request;
public class TextController : TwiMLController
{
[HttpPost]
public ActionResult New(TextRequest request)
{
var answer = "The Magical 8-Ball Says: " + Magic8BallAnswerizer3000.GetAnswer();
return TwiML(response => response
.Sms(answer));
// Alternatively:
//return TwiMLBuilder
// .Build()
// .Sms(answer)
// .ToTwiMLResult();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment