Twilio没有使用MeteorJS

时间:2015-11-29 20:52:26

标签: javascript meteor twilio

我一直试图通过Twilio用我买的号码发短信。以下是我采取的步骤:

  1. 制作Twilio帐户

  2. 走到"电话号码"并要求提供电话号码

  3. 然后我去了#34;帐户"并找到了我的真实帐户sid和授权码。然后我将此方法放在Meteor.isServer

    Meteor.methods({
    sendSMS: function(){
        twilio = Twilio('sid', 'auth code');
        twilio.sendSms({
    
                       to:'+7033502148', // Any number Twilio can deliver to
                       from: '+13348331065', // A number you bought from Twilio and can use for outbound communication
                       body: 'Test.' // body of the SMS message
                       }, function(err, responseData) { //this function is executed when a response is received from Twilio
                       if (!err) { // "err" is an error received during the request, if any
                       // "responseData" is a JavaScript object containing data received from Twilio.
                       // A sample response from sending an SMS message is here (click "JSON" to see how the data appears in JavaScript):
                       // http://www.twilio.com/docs/api/rest/sending-sms#example-1
                       console.log(responseData.from); // outputs "+14506667788"
                       console.log(responseData.body); // outputs "word to your mother."
                       }
                       });
    }
                   });
    

    而且..我已经从客户端的外部函数调用了sendSMS(使用Meteor.call('sendSMS'))。我已经确认使用sendSMS实际调用了console.log。谁能告诉我我在这里失踪的步骤?

    没有错误;它只是没有发送给收件人。

0 个答案:

没有答案