This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

Sending SMS using Twilio

Home/Nodejs/Sending SMS using Twilio

Sending SMS using Twilio

Setting Up Node.js application 
twilioauth = require('../credentials/twilio.js'),
twilio = require('twilio')(twilioauth.account_sid, twilioauth.auth_token),
speakeasy = require('speakeasy');
account_sid : 'AC9cewefwerferfewrferferfwe22f19e',
auth_token : 'b0a5rfwefefrefwefwefewf30b21096ed',
twilio_number : 'XXXXXXXXXX',
secret: 'XXXXXX'
var sendSms = function(phone_number) {
    var code = speakeasy.totp({key: twilioauth.secret});
    console.log('code is: ' + code);
    twilio.sendSms({
        to: phone_number,
        from: twilioauth.twilio_number,
        body: 'Your verification code is: ' + code
    }, function (twilioerr, responseData) {
        if (twilioerr) {
            console.log('twilio error while sending sms to: ' + phone_number);
            console.log(JSON.stringify(twilioerr));
        } else {
            console.log('code_generated and sent to: ' + phone_number);
        }
    });
}

Error - 21211

Invalid 'To' Phone Number

You attempted to initiate an outbound phone call, but the 'To' phone number you supplied was not a valid phone number. Twilio accepts phone numbers in E164 format (i.e. "+1 format"), or 10-digit US and Canadian numbers with any combination of non-digit separators.

By | 2017-03-23T21:32:21+00:00 March 10th, 2015|Nodejs|Comments Off on Sending SMS using Twilio

About the Author: