0
我按照对方回答这一点,并简化了我的电话到这一点:Twilio TwimlResponse不是构造
var http = require('http');
var twilio = require('twilio');
http.createServer(function (req, res) {
var resp = new twilio.TwimlResponse();
resp.say({voice:'woman'}, 'ahoy hoy! Testing Twilio and node.js');
res.writeHead(200, {
'Content-Type':'text/xml'
});
res.end(resp.toString());
}).listen(1337);
这将返回:
TypeError: twilio.TwimlResponse is not a constructor
at Server.<anonymous> (C:\Users\jmmann\Projects\node-sms\server.js:9:14)
at emitTwo (events.js:106:13)
at Server.emit (events.js:191:7)
at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:548:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
任何想法/建议?
您使用的SDK版本是什么,因为TwimlResponse在当前的3.X版本中已弃用。 – Andy