Created
March 17, 2016 11:29
-
-
Save clonn/73eeb6554a4afb2e3a44 to your computer and use it in GitHub Desktop.
twilio sms sender node.js simple code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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