I am using twilio to send sms using nodejs, but sometimes it not working, not going to catch or not going to then, above it calling, client also created but create not working.
const accountSid = globals.twilioAccountSid;
const authToken = globals.authToken;
const client = require('twilio')(accountSid, authToken);
client.messages
.create({
body: params.message,
messagingServiceSid: globals.messagingServiceSid,
to: params.country_code+params.phone,
})
.then(message => console.log(message),error => console.log('error'))
.catch(e => { console.error('Got an error:', e.code, e.message); })
.done();