Reputation: 3187
I am testing out Twilio and am attempting to receive an SMS message. When I send a text, my app route is getting triggered as expected, however the "params" are empty. I've tried both post
and get
. Using Express (and Coffeescript), here is what I've got (not much to it):
app.post '/receive', (req, res) ->
console.log req.params
In this case, it logs out an empty object. Any ideas?
Upvotes: 1
Views: 473
Reputation: 1209
req.params
refers to URL parameters in Express 4. Twilio sends HTTP POST parameters (by default) with a webhook request. Are you using a body parser middleware?
https://github.com/expressjs/body-parser
With this module, if you use the form-encoded middleware, the parameters sent from a Twilio POST request will be in req.body
. If Twilio sends you a GET, the parameters should be in req.query
without using any additional middleware.
Thanks, -Kevin
Upvotes: 2