I created a webhook answering Twilio voice calls.
var router = require('express').Router();
var twilio = require('twilio');
router.post("/voice", (request, response) => {
// var fs = require('fs');
// var util = require('util');
// fs.writeFileSync('./request.json', util.inspect(request.body), 'utf-8');
console.log(request.body);
console.log('Call received from ' + request.body.From);
//twimlAnswer();}
The webhook and the connection work fine, but I am trying to access some of the request parameters usually provided by Twilio inside 'request' (similar way than this example https://www.twilio.com/docs/tutorials/automated-survey-node-express#responding-to-a-phone-call)
I am getting the following log:
Express server listening on port 3000
undefined
TypeError: Cannot read property 'From' of undefined
at router.post
Do you know why I am not accessing request correctly? Most examples I found have no issue accessing request.body...
Thanks,
via Jose Lopez