使用Twilio,无法使用Node.js中的试用帐户在手机上接收真正的短信

时间:2017-08-16 13:50:22

标签: node.js sms twilio sms-gateway twilio-api

我在 Node.js

中发送短信的代码
var accountSid = ''; // Your Account SID from www.twilio.com/console
var authToken = '';   // Your Auth Token from www.twilio.com/console


// Load the twilio module
var twilio = require('twilio');

// Create a new REST API client to make authenticated requests against the
// twilio back end
var client = new twilio(accountSid, authToken);

// Pass in parameters to the REST API using an object literal notation. The
// REST client will handle authentication and response serialzation for you.
client.messages.create({
    to: 'my_number',  // verified
    from: '+15005550006', // From a valid Twilio number
    body:'ahoy hoy! Testing Twilio and node.js'
}, function(error, message) {
    // The HTTP request to Twilio will run asynchronously. This callback
    // function will be called when a response is received from Twilio
    // The "error" variable will contain error information, if any.
    // If the request was successful, this value will be "falsy"
    if (!error) {
        // The second argument to the callback will contain the information
        // sent back by Twilio for the request. In this case, it is the
        // information about the text messsage you just sent:
        console.log('Success! The SID for this SMS message is:');
        console.log(message.sid);

        console.log('Message sent on:');
        console.log(message.dateCreated);
    } else {
        console.log('Oops! There was an error.');
         console.log(error)
    }
});

一切正常但我没有得到实际/真实短信所以如何通过仅在控制台上看到成功结果来确认。这就是为什么我想获得实际/真正的短信不仅仅是控制台中的成功消息吗?

因此,没有规定使用试用帐户来获取实际邮件。

任何建议,建议或答案对我来说都会更有帮助 提前谢谢!

1 个答案:

答案 0 :(得分:0)

您使用的是试用帐户吗?

如果是这样,您需要将要拨打的电话号码添加为已验证的号码。你可以这样做Here