Skip to content

Instantly share code, notes, and snippets.

@clonn
Created March 17, 2016 11:29
Show Gist options
  • Save clonn/73eeb6554a4afb2e3a44 to your computer and use it in GitHub Desktop.
Save clonn/73eeb6554a4afb2e3a44 to your computer and use it in GitHub Desktop.
twilio sms sender node.js simple code.
// Your accountSid and authToken from twilio.com/user/account
var accountSid = 'AUTH_SID';
var authToken = "AUTH_KEY";
var client = require('twilio')(accountSid, authToken);
var text = "TEXT_CONTENT";
var users = [--phone number array-];
for (var i=0;i<users.length ; i ++) {
var sender = "+886" + users[i];
sendSMS(sender);
}
// sendSMS("+886985018121")
function sendSMS (number) {
client.messages.create({
body: text,
to: number,
from: "+1201----"
}, function(err, message) {
console.log(err)
console.log(message);
process.stdout.write(message.sid);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment