I've got the following attempt to send an SMS
sendText: function(phone, callback) {
// maybe needs a .then() ?
var formattedPhone = Phone.format(Phone.parse(phone, 'US'), 'International_plaintext')
var messageBody = 'test'
client.sms.messages.create({
to: formattedPhone,
from: number,
body: messageBody
})
}, function(error, message) {
if (error) {
console.log("SMS ERROR sending to: " + formattedPhone)
callback(error)
} else {
console.log("SMS sent to: " + formattedPhone)
callback(null, message)
}
}
It doesn't print an error or a success string to console - is it the Phone.format(Phone.parse()) call that's causing it by blocking the thread or something?
via ARMATAV
No comments:
Post a Comment