Domanda

Using MVC 4, for some reason I'm having difficulties receiving Twilio HttpPost to my site URL. If I place the parameters directly in the URL ie.

www.somesite.com/Twilioin/index?From=15044025673&To=15046136807&Body=98

I receive the correct response from Twilio.

my [HttpGet] Controller is:

public class TwilioInController : AutoController
{
    [HttpGet]
    public ActionResult Index(string To, string From, string Body)


       int _body = Convert.ToInt32(Body);

       TextSearchResult(To, From, _body);
       return RedirectToAction("Index", "Auto");

    }
}

Ive set the Text Response URLon my TWILIO number to:

http://somesite.com/Twilioin/index/

Ive searched the web for TWILIO incoming TEXT receive/response but none fit my situation. Most of them deal with phone applications or returning simple XML response messages.

What I'm attempting to do is:

A user texts my Twilio Number, my controller receives the number, queries the database for the GUID and returns an entire object via text. As mentioned before, my only problem is receiving the correct request from Twilio (if placed in the URL directly, it works).

In MVC do I need a View to receive the request? Or simply making the correct controller enough? While on my local server, I could run test to ensure that the controller was in fact receiving the correct parameters through binding, i.e. (string From, string To, String Body), but while the site is published I cannot.

Please help. Thanks!

È stato utile?

Soluzione

Twilio evangelist here.

I'd check to make sure that your Twilio phone number is configured to make a GET request. By default they are configured to make POST requests, but you can change that in the phone number configuration page (the same place you set the URL).

Hope that helps.

Devin

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top