Created
February 20, 2014 22:22
-
-
Save dchanTwilio/9124538 to your computer and use it in GitHub Desktop.
Responding to incoming messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using Twilio; | |
using Twilio.TwiML; | |
using Twilio.TwiML.Mvc; | |
namespace MessageResponseDemo.Controllers | |
{ | |
public class MessageController : TwilioController | |
{ | |
public ActionResult Incoming() | |
{ | |
var response = new TwilioResponse(); | |
var messageBody = Request.Params.Get("Body"); | |
string responseBody = ""; | |
if (messageBody == "Okay") | |
responseBody = "Thank you"; | |
else | |
{ | |
responseBody = "Sorry, I don't understand"; | |
} | |
// Do something else with Message Body | |
response.Message(responseBody); | |
return TwiML(response); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment