Tuesday 23 May 2017

TypeError: twilio.TwimlResponse is not a constructor

i m using the twilio api to receive sms to my application

router.post('/getSMS', function(req, res) {
    var twiml = new twilio.TwimlResponse();
    if (req.body.Body == 'hello') {
        twiml.message('Hi!');
    } else if (req.body.Body == 'bye') {
        twiml.message('Goodbye');
    } else {
        twiml.message('No Body param match, Twilio sends this in the request to your server.');
    }
    res.writeHead(200, { 'Content-Type': 'text/xml' });
    res.end(twiml.toString());
});

this is the router to get msg i m using webhooks to check receiving msg i recieve the sms but i get this error

twilio.TwimlResponse is not a constructor

TypeError: twilio.TwimlResponse is not a constructor


via Hachimi Ahmed Amine

No comments:

Post a Comment