【发布时间】:2014-05-17 18:51:44
【问题描述】:
快速提问(希望如此)- 我正在尝试使用 Meteor Twilio 包(“mrt add twilio”)从我的应用程序发送短信。
一切都设置正确(并且我预装了文档中提到的 Moment),我认为......但是当我的代码在事件处理程序中运行时,我收到“Twilio 未定义”错误。
大概这与包“需要” NPM 包代码的方式有关?有其他人遇到过这种情况吗?
Template.registration.events({
'click #registerButton': function (e) {
e.preventDefault();
var accountSid = 'AC758eaf30370ee2ba8b64f64ce19769c8';
var authToken = 'f8a0ee4560d3368a461e1f751b98fd90';
twilio = Twilio(accountSid, authToken); //this appears to be the issue
twilio.sendSms({
to:'+966533444837',
from: '+18654072438',
body: 'Hi this is a test from Twilio.'
}, function(err, responseData) {
if (!err) {
console.log(err)
}
});
}
});
【问题讨论】:
标签: javascript node.js meteor twilio