Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// your Twilio AccountSid and AuthToken
var account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
var auth_token = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";
var twilio_num = "5558675309";
var number = "55555555555"; // The number you want to text the information to
var client = require('twilio')(account_sid, auth_token);
sendText( number, twilio_num, "This text message was sent by Tessel. Cool, right?!");
function sendText(to,from,msg) {
client.sms.messages.create({
to: to,
from: from,
body:msg
}, function(error, message) {
if (!error) {
console.log('Success! The SID for this SMS message is:');
console.log(message.sid);
console.log('Message sent on:');
console.log(message.dateCreated);
} else {
console.log('Oops! There was an error.', error);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.