Skip to content

Instantly share code, notes, and snippets.

@crtr0
Created September 29, 2012 09:54
Show Gist options
  • Save crtr0/3803605 to your computer and use it in GitHub Desktop.
Save crtr0/3803605 to your computer and use it in GitHub Desktop.
LxJs Texting
// Twilio API: http://twilio.com/api
// Twilio Node.js module: https://github.com/stevegraham/twilio-js
var Twilio = require('twilio-js')
, twilioNumber = "your SMS-enabled Twilio #";
require('./creds')(Twilio);
// creds.js should look like:
//
// module.exports = function(Twilio) {
// Twilio.AccountSid = "ACxxxxxxxxx";
// Twilio.AuthToken = "yyyyyyyyyyy";
// };
Twilio.Call.all(function(err, res) {
res.calls.forEach(function(call) {
Twilio.SMS.create({to: call.from, from: twilioNumber, body: "Your message here!"}, function(err, res) {
console.log("SMS " + (err ? "failed" : "succeeded") + " for: " + call.from);
});
});
}, {to: twilioNumber, pageSize: 500});
// email carter@twilio.com to get expedited access to the Twilio EU Beta: http://www.twilio.com/eu-beta-signup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment