public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); var zip = getValidZip(request, response); if (zip == null) { response.Message("Please text your ZIP code."); } else { var legislators = getLegislators(zip); if (legislators == null) { response.Message("Error getting results for " + zip); } else if (legislators.count == 0) { response.Message("Could not find results for " + zip); } else { foreach (var legislator in legislators.results) { response.Message("Your " + labelDict[legislator.chamber] + ": " + getFullName(legislator) + " - " + legislator.phone + " - " + legislator.oc_email); } } } return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); if (request.body == "hello") { response.Message("Hi!"); } else if (request.body == "bye") { response.Message("Goodbye"); } return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); response.Message("Hello, Mobile Monkey"); return(TwiML(response)); }
private TwiMLResult GenerateTwiML(string message) { var response = new TwilioResponse(); response.Message(message); return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { // get the session varible if it exists var counter = Session["counter"] != null ? (int)Session["counter"] : 0; // increment it counter++; // save it Session["counter"] = counter; // make an associative array of senders we know, indexed by phone number var people = new Dictionary <string, string>() { { "+14158675308", "Curious George" }, { "+12349013030", "Boots" }, { "+12348134522", "Virgil" } }; // if the sender is known, then greet them by name var name = people.ContainsKey(Request.Form["From"]) ? people[Request.Form["From"]] : "Monkey"; var response = new TwilioResponse(); response.Message($"{name} has messaged {request.To} {counter} times"); return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); response.Message("The Robots are coming! Head for the hills!"); return(TwiML(response)); }
public void Can_Generate_Single_Message() { var response = new TwilioResponse(); response.Message("Hello world"); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
public ActionResult AcceptOpenShift(string From, string Body) { var response = new TwilioResponse(); var employee = _employeeRepository.Select().Where(e => e.PhoneNumber == From).FirstOrDefault(); if (employee == null) { return(TwiML(response)); } //parse and process sms message body var parameters = Body.Split(' '); if (parameters.Count() < 2) { response.Message("Whoops. Not sure what that command was. Try again."); } if (parameters[0].ToLower() == "yes") { var openShift = _shiftRepository.Select().Where(s => s.ID.ToString() == parameters[1]).FirstOrDefault(); if (openShift.AssignedEmployee == null) { openShift.AssignedEmployee = employee; _shiftRepository.Update(openShift); _shiftRepository.Save(); var message = string.Format( "Awesome. Thanks for stepping up. See you on {0} at {1}", openShift.StartTime.ToLongDateString(), openShift.StartTime.ToShortTimeString() ); response.Message(message); } else { response.Message("Ohhh, so close. Try again next time"); } } return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); response.Message("Hello, Mobile Monkey", new [] { "https://demo.twilio.com/owl.png" }, null); return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); response.Message("The Robots are coming! Head for the hills!", new [] { "https://farm8.staticflickr.com/7090/6941316406_80b4d6d50e_z_d.jpg" }, null); return(TwiML(response)); }
public ActionResult Message(string body, string AddOns) { var response = new TwilioResponse(); dynamic addons = JsonConvert.DeserializeObject(AddOns); if (addons["status"] == "successful") { var language = addons["results"]["ibm_watson_insights"]["result"]["language"].Value; if (language == "spanish") { response.Message("Gracias por contactar con nuestro equipo de soporte. Uno de nuestros agentes de soporte estará con usted pronto."); } else if (language == "french") { response.Message("Merci de contacter notre équipe d’assistance. Un de nos agents de soutien fera avec vous sous peu."); } else { response.Message("Thank you for contacting our support team. One of our support agents will be with you shortly."); } var client = new TaskRouterClient("YOUR_ACCOUNT_SID", "YOUR_AUTH_TOKEN"); var result = client.AddTask( "YOUR_WORKSPACE_SID", JsonConvert.SerializeObject(new { language = language, body = body }), "YOUR_WORKFLOW_SID", null, null); if (result.RestException != null) { throw new HttpException(result.RestException.Message); } } else { response.Message("We're really sorry but something seems to have gone wrong when we tried to read your message. Can you try sending it again? If it keeps happening us, try giving us a call at 1-800-555-5555"); } return(TwiML(response)); }
public void Can_Generate_Single_Message_With_Attributes() { var response = new TwilioResponse(); response.Message( "Hello world", new { to = "+15551111111", from = "+15552222222", action = "sms.php", method = "GET", statusCallback = "status.php" } ); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
/// <summary> /// Creates an HTTP response to reply to a text received via Twilio. /// </summary> public static HttpResponseMessage CreateTwilioHttpResponse(string message) { var twilioResponse = new TwilioResponse(); twilioResponse.Message(message); var httpResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(twilioResponse.Element.ToString()) }; httpResponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml"); return(httpResponse); }
private string getValidZip(SmsRequest request, TwilioResponse response) { if (containsValidZip(request.Body)) { return(parseZip(request.Body)); } if (containsValidZip(request.FromZip)) { var fromZip = parseZip(request.FromZip); response.Message("Text your ZIP code for more accurate results. We're guessing " + fromZip); return(fromZip); } return(null); }
public async Task <ActionResult> Register(string from, String body) { var phoneNumber = from; var message = body; var messageCreator = new MessageCreator(_repository); var outputMessage = await messageCreator.Create(phoneNumber, message); var response = new TwilioResponse(); response.Message(outputMessage); return(TwiML(response)); }
public void Can_Generate_Single_Message_With_Media() { var response = new TwilioResponse(); response.Message( new string[] { "http://example.com/1", "http://example.com/2" }, new { to = "+15551111111", from = "+15552222222", action = "sms.php", method = "GET", statusCallback = "status.php" } ); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
private TwilioResponse GetTwilioResponseForEmployees(IEnumerable <Employee> employees, string incomingMessageText) { var response = new TwilioResponse(); var employeeList = employees.ToList(); switch (employeeList.Count) { case 0: // No Employees Found response.Message(string.Format(NotFoundMessage, incomingMessageText)); break; case 1: // A Single Employee Found var employee = employeeList.First(); response.Message(employee.FullName + " - " + employee.Email + " - " + employee.PhoneNumber, new[] { employee.ImageUrl }, null); break; default: // Multiple Employees Found response.Message(GetMessageForMultipleEmployees(employeeList)); break; } return(response); }
// GET: Home public async Task <ActionResult> Index(string To, string From, string Body) { var response = new TwilioResponse(); var match = new Match(); var opportunityResult = await match.Find(Body); var builder = new StringBuilder(); foreach (var opportunity in opportunityResult.Opportunities) { builder.Append($"{opportunity.Title}\r\n"); } response.Message(builder.ToString()); return(TwiML(response)); }
public ActionResult Index(SmsRequest request) { var response = new TwilioResponse(); response.Message("Hello World"); return(TwiML(response)); //////sending reply string AccountSid = "{{ account_sid }}"; string AuthToken = "{{ auth_token }}"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var message = twilio.SendMessage("+1253440106", "+201006728219", "Brooklyn is in the house!"); //from to body (diference between send message and send sms) Console.WriteLine(message.Sid); }
public ActionResult Index(SmsRequest request) { // make an associative array of people we know, indexed by phone number var people = new Dictionary <string, string>() { { "+14158675309", "Curious George" }, { "+14158675310", "Boots" }, { "+14158675311", "Virgil" } }; var name = people.ContainsKey(Request.Form["From"]) ? people[Request.Form["From"]] : "Monkey"; var response = new TwilioResponse(); response.Message($"{name}, thanks for the message!"); return(TwiML(response)); }
public ActionResult Register(string from, String body) { var phoneNumber = from; var message = body; System.Diagnostics.Debug.WriteLine("Adding phone number: " + phoneNumber); AlertablePhoneNumbers.Add(phoneNumber); System.Diagnostics.Debug.WriteLine("Number of alertable phone numbers: " + AlertablePhoneNumbers.Count); return(View()); #if false var response = new TwilioResponse(); response.Message(outputMessage); return(TwiML(response)); #endif }
public ActionResult Index(SmsRequest request) { var counter = 0; // get the session varible if it exists if (Session["counter"] != null) { counter = (int)Session["counter"]; } // increment it counter++; // save it Session["counter"] = counter; // make an associative array of senders we know, indexed by phone number var people = new Dictionary <string, string>() { { "+14158675308", "Rey" }, { "+12349013030", "Finn" }, { "+12348134522", "Chewy" } }; // if the sender is known, then greet them by name var name = "Friend"; if (people.ContainsKey(request.From)) { name = people[request.From]; } var response = new TwilioResponse(); response.Message($"{name} has messaged {request.To} {counter} times"); return(TwiML(response)); }
// GET: Phone public async Task <ActionResult> Store(string to, string from, string body) { var response = new TwilioResponse(); //do we want to fail fast on non-numeric bodies? body = body.Trim(); var survey = context.Surveys.Include(s => s.Responses).Where(s => s.PhoneNumber == to).FirstOrDefault(); if (survey != null) { if (!survey.IsEnabled) { return(TwiML(response)); } //parse the NPS value and comment from the body int value; if (!int.TryParse(body, out value)) { if (body.Contains(' ')) { if (!int.TryParse(body.Substring(0, body.IndexOf(' ')), out value)) { response.Message("Hmm. We could not find a score in your message."); //no number could be found at the start of the message return(TwiML(response)); } } } var surveyresponse = new SurveyResponse() { From = from, To = to, Body = body, Score = value }; survey.Responses.Add(surveyresponse); try { await context.SaveChangesAsync(); var surveyIdParam = new SqlParameter("@SurveyId", survey.SurveyId); await context.Database.ExecuteSqlCommandAsync("[dbo].[CalculateNps] @SurveyId", surveyIdParam); } catch (Exception exc) { //log string msg = exc.Message; return(new HttpStatusCodeResult(500, exc.Message)); } response.Message(survey.ResponseText); return(TwiML(response)); } return(new HttpStatusCodeResult(500)); }
public HttpResponseMessage IncomingMessage([FromUri] TwilioMessage request) { if (request == null || string.IsNullOrWhiteSpace(request.To) || string.IsNullOrWhiteSpace(request.From) || string.IsNullOrWhiteSpace(request.Body)) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } var response = new TwilioResponse(); var textMessage = new TextMessage(); textMessage.To = request.To.Replace("+", ""); textMessage.Msisdn = request.From.Replace("+", ""); textMessage.MessageId = request.MessageSid; textMessage.Timestamp = DateTime.UtcNow.ToLongDateString(); textMessage.Data = request.Body; textMessage.Text = request.Body; var messageEvent = new InboundMessageEvent(); messageEvent.MessageType = (int)InboundMessageTypes.TextMessage; messageEvent.RecievedOn = DateTime.UtcNow; messageEvent.Type = typeof(InboundMessageEvent).FullName; messageEvent.Data = JsonConvert.SerializeObject(textMessage); messageEvent.Processed = false; messageEvent.CustomerId = ""; try { var departmentId = _departmentSettingsService.GetDepartmentIdByTextToCallNumber(textMessage.To); if (departmentId.HasValue) { var department = _departmentsService.GetDepartmentById(departmentId.Value); var textToCallEnabled = _departmentSettingsService.GetDepartmentIsTextCallImportEnabled(departmentId.Value); var textCommandEnabled = _departmentSettingsService.GetDepartmentIsTextCommandEnabled(departmentId.Value); var dispatchNumbers = _departmentSettingsService.GetTextToCallSourceNumbersForDepartment(departmentId.Value); var authroized = _limitsService.CanDepartmentProvisionNumber(departmentId.Value); var customStates = _customStateService.GetAllActiveCustomStatesForDepartment(departmentId.Value); messageEvent.CustomerId = departmentId.Value.ToString(); if (authroized) { bool isDispatchSource = false; if (!String.IsNullOrWhiteSpace(dispatchNumbers)) { isDispatchSource = _numbersService.DoesNumberMatchAnyPattern(dispatchNumbers.Split(Char.Parse(",")).ToList(), textMessage.Msisdn); } // If we don't have dispatchNumbers and Text Command isn't enabled it's a dispatch text if (!isDispatchSource && !textCommandEnabled) { isDispatchSource = true; } if (isDispatchSource && textToCallEnabled) { var c = new Call(); c.Notes = textMessage.Text; c.NatureOfCall = textMessage.Text; c.LoggedOn = DateTime.UtcNow; c.Name = string.Format("TTC {0}", c.LoggedOn.TimeConverter(department).ToString("g")); c.Priority = (int)CallPriority.High; c.ReportingUserId = department.ManagingUserId; c.Dispatches = new Collection <CallDispatch>(); c.CallSource = (int)CallSources.EmailImport; c.SourceIdentifier = textMessage.MessageId; c.DepartmentId = departmentId.Value; var users = _departmentsService.GetAllUsersForDepartment(departmentId.Value, true); foreach (var u in users) { var cd = new CallDispatch(); cd.UserId = u.UserId; c.Dispatches.Add(cd); } var savedCall = _callsService.SaveCall(c); var cqi = new CallQueueItem(); cqi.Call = savedCall; cqi.Profiles = _userProfileService.GetSelectedUserProfiles(users.Select(x => x.UserId).ToList()); cqi.DepartmentTextNumber = _departmentSettingsService.GetTextToCallNumberForDepartment(cqi.Call.DepartmentId); _queueService.EnqueueCallBroadcast(cqi); messageEvent.Processed = true; } if (!isDispatchSource && textCommandEnabled) { var profile = _userProfileService.FindProfileByMobileNumber(textMessage.Msisdn); if (profile != null) { var payload = _textCommandService.DetermineType(textMessage.Text); var customActions = customStates.FirstOrDefault(x => x.Type == (int)CustomStateTypes.Personnel); var customStaffing = customStates.FirstOrDefault(x => x.Type == (int)CustomStateTypes.Staffing); switch (payload.Type) { case TextCommandTypes.None: response.Message("Resgrid (https://resgrid.com) Automated Text System. Unknown command, text help for supported commands."); break; case TextCommandTypes.Help: messageEvent.Processed = true; var help = new StringBuilder(); help.Append("Resgrid Text Commands" + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); help.Append("These are the commands you can text to alter your status and staffing. Text help for help." + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); help.Append("Core Commands" + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); help.Append("STOP: To turn off all text messages" + Environment.NewLine); help.Append("HELP: This help text" + Environment.NewLine); help.Append("CALLS: List active calls" + Environment.NewLine); help.Append("C[CallId]: Get Call Detail i.e. C1445" + Environment.NewLine); help.Append("UNITS: List unit statuses" + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); help.Append("Status or Action Commands" + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); if (customActions != null && customActions.IsDeleted == false && customActions.GetActiveDetails() != null && customActions.GetActiveDetails().Any()) { var activeDetails = customActions.GetActiveDetails(); for (int i = 0; i < activeDetails.Count; i++) { help.Append($"{activeDetails[i].ButtonText.Trim().Replace(" ", "").Replace("-", "").Replace(":", "")} or {i + 1}: {activeDetails[i].ButtonText}" + Environment.NewLine); } } else { help.Append("responding or 1: Responding" + Environment.NewLine); help.Append("notresponding or 2: Not Responding" + Environment.NewLine); help.Append("onscene or 3: On Scene" + Environment.NewLine); help.Append("available or 4: Available" + Environment.NewLine); } help.Append("---------------------" + Environment.NewLine); help.Append("Staffing Commands" + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); if (customStaffing != null && customStaffing.IsDeleted == false && customStaffing.GetActiveDetails() != null && customStaffing.GetActiveDetails().Any()) { var activeDetails = customStaffing.GetActiveDetails(); for (int i = 0; i < activeDetails.Count; i++) { help.Append($"{activeDetails[i].ButtonText.Trim().Replace(" ", "").Replace("-", "").Replace(":", "")} or S{i + 1}: {activeDetails[i].ButtonText}" + Environment.NewLine); } } else { help.Append("available or s1: Available Staffing" + Environment.NewLine); help.Append("delayed or s2: Delayed Staffing" + Environment.NewLine); help.Append("unavailable or s3: Unavailable Staffing" + Environment.NewLine); help.Append("committed or s4: Committed Staffing" + Environment.NewLine); help.Append("onshift or s4: On Shift Staffing" + Environment.NewLine); } response.Message(help.ToString()); //_communicationService.SendTextMessage(profile.UserId, "Resgrid TCI Help", help.ToString(), department.DepartmentId, textMessage.To, profile); break; case TextCommandTypes.Action: messageEvent.Processed = true; _actionLogsService.SetUserAction(profile.UserId, department.DepartmentId, (int)payload.GetActionType()); response.Message(string.Format("Resgrid recieved your text command. Status changed to: {0}", payload.GetActionType())); //_communicationService.SendTextMessage(profile.UserId, "Resgrid TCI Status", string.Format("Resgrid recieved your text command. Status changed to: {0}", payload.GetActionType()), department.DepartmentId, textMessage.To, profile); break; case TextCommandTypes.Staffing: messageEvent.Processed = true; _userStateService.CreateUserState(profile.UserId, department.DepartmentId, (int)payload.GetStaffingType()); response.Message(string.Format("Resgrid recieved your text command. Staffing level changed to: {0}", payload.GetStaffingType())); //_communicationService.SendTextMessage(profile.UserId, "Resgrid TCI Staffing", string.Format("Resgrid recieved your text command. Staffing level changed to: {0}", payload.GetStaffingType()), department.DepartmentId, textMessage.To, profile); break; case TextCommandTypes.Stop: messageEvent.Processed = true; _userProfileService.DisableTextMessagesForUser(profile.UserId); response.Message("Text messages are now turned off for this user, to enable again log in to Resgrid and update your profile."); break; case TextCommandTypes.CustomAction: messageEvent.Processed = true; _actionLogsService.SetUserAction(profile.UserId, department.DepartmentId, payload.GetCustomActionType()); if (customActions != null && customActions.IsDeleted == false && customActions.GetActiveDetails() != null && customActions.GetActiveDetails().Any() && customActions.GetActiveDetails().FirstOrDefault(x => x.CustomStateDetailId == payload.GetCustomActionType()) != null) { var detail = customActions.GetActiveDetails().FirstOrDefault(x => x.CustomStateDetailId == payload.GetCustomActionType()); response.Message(string.Format("Resgrid recieved your text command. Status changed to: {0}", detail.ButtonText)); } else { response.Message("Resgrid recieved your text command and updated your status"); } break; case TextCommandTypes.CustomStaffing: messageEvent.Processed = true; _userStateService.CreateUserState(profile.UserId, department.DepartmentId, payload.GetCustomStaffingType()); if (customStaffing != null && customStaffing.IsDeleted == false && customStaffing.GetActiveDetails() != null && customStaffing.GetActiveDetails().Any() && customStaffing.GetActiveDetails().FirstOrDefault(x => x.CustomStateDetailId == payload.GetCustomStaffingType()) != null) { var detail = customStaffing.GetActiveDetails().FirstOrDefault(x => x.CustomStateDetailId == payload.GetCustomStaffingType()); response.Message(string.Format("Resgrid recieved your text command. Staffing changed to: {0}", detail.ButtonText)); } else { response.Message("Resgrid recieved your text command and updated your staffing"); } break; case TextCommandTypes.MyStatus: messageEvent.Processed = true; var userStatus = _actionLogsService.GetLastActionLogForUser(profile.UserId); var userStaffing = _userStateService.GetLastUserStateByUserId(profile.UserId); var customStatusLevel = _customStateService.GetCustomPersonnelStatus(department.DepartmentId, userStatus); var customStaffingLevel = _customStateService.GetCustomPersonnelStaffing(department.DepartmentId, userStaffing); response.Message($"Hello {profile.FullName.AsFirstNameLastName} at {DateTime.UtcNow.TimeConverterToString(department)} your current status is {customStatusLevel.ButtonText} and your current staffing is {customStaffingLevel.ButtonText}."); break; case TextCommandTypes.Calls: messageEvent.Processed = true; var activeCalls = _callsService.GetActiveCallsByDepartment(department.DepartmentId); var activeCallText = new StringBuilder(); activeCallText.Append($"Active Calls for {department.Name}" + Environment.NewLine); activeCallText.Append("---------------------" + Environment.NewLine); foreach (var activeCall in activeCalls) { activeCallText.Append($"CallId: {activeCall.CallId} Name: {activeCall.Name} Nature:{activeCall.NatureOfCall}" + Environment.NewLine); } response.Message(activeCallText.ToString()); break; case TextCommandTypes.Units: messageEvent.Processed = true; var unitStatus = _unitsService.GetAllLatestStatusForUnitsByDepartmentId(department.DepartmentId); var unitStatusesText = new StringBuilder(); unitStatusesText.Append($"Unit Statuses for {department.Name}" + Environment.NewLine); unitStatusesText.Append("---------------------" + Environment.NewLine); foreach (var unit in unitStatus) { var unitState = _customStateService.GetCustomUnitState(unit); unitStatusesText.Append($"{unit.Unit.Name} is {unitState.ButtonText}" + Environment.NewLine); } response.Message(unitStatusesText.ToString()); break; case TextCommandTypes.CallDetail: messageEvent.Processed = true; var call = _callsService.GetCallById(int.Parse(payload.Data)); var callText = new StringBuilder(); callText.Append($"Call Information for {call.Name}" + Environment.NewLine); callText.Append("---------------------" + Environment.NewLine); callText.Append($"Id: {call.CallId}" + Environment.NewLine); callText.Append($"Number: {call.Number}" + Environment.NewLine); callText.Append($"Logged: {call.LoggedOn.TimeConverterToString(department)}" + Environment.NewLine); callText.Append("-----Nature-----" + Environment.NewLine); callText.Append(call.NatureOfCall + Environment.NewLine); callText.Append("-----Address-----" + Environment.NewLine); if (!String.IsNullOrWhiteSpace(call.Address)) { callText.Append(call.Address + Environment.NewLine); } else if (!string.IsNullOrEmpty(call.GeoLocationData)) { try { string[] points = call.GeoLocationData.Split(char.Parse(",")); if (points != null && points.Length == 2) { callText.Append(_geoLocationProvider.GetAproxAddressFromLatLong(double.Parse(points[0]), double.Parse(points[1])) + Environment.NewLine); } } catch { } } response.Message(callText.ToString()); break; } } } } } else if (textMessage.To == "17753765253") // Resgrid master text number { var profile = _userProfileService.FindProfileByMobileNumber(textMessage.Msisdn); var payload = _textCommandService.DetermineType(textMessage.Text); switch (payload.Type) { case TextCommandTypes.None: response.Message("Resgrid (https://resgrid.com) Automated Text System. Unknown command, text help for supported commands."); break; case TextCommandTypes.Help: messageEvent.Processed = true; var help = new StringBuilder(); help.Append("Resgrid Text Commands" + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); help.Append("This is the Resgrid system for first responders (https://resgrid.com) automated text system. Your department isn't signed up for inbound text messages, but you can send the following commands." + Environment.NewLine); help.Append("---------------------" + Environment.NewLine); help.Append("STOP: To turn off all text messages" + Environment.NewLine); help.Append("HELP: This help text" + Environment.NewLine); response.Message(help.ToString()); break; case TextCommandTypes.Stop: messageEvent.Processed = true; _userProfileService.DisableTextMessagesForUser(profile.UserId); response.Message("Text messages are now turned off for this user, to enable again log in to Resgrid and update your profile."); break; } } } catch (Exception ex) { Framework.Logging.LogException(ex); } finally { _numbersService.SaveInboundMessageEvent(messageEvent); } //return Request.CreateResponse(HttpStatusCode.OK); //var response = new TwilioResponse(); return(Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter())); }