Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created March 10, 2014 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/9458584 to your computer and use it in GitHub Desktop.
Save kwhinnery/9458584 to your computer and use it in GitHub Desktop.
var twilio = require('twilio');
var client = twilio('your account sid', 'your auth token');
// Call everyone that texted a number you just bought - remember, for this to work,
// this needs to be a number you just bought, that only this room full of people have
// texted
client.listMessages({
to:'your twilio number'
}, function(err, data) {
data.messages.forEach(function(message) {
client.makeCall({
to:message.from,
from:'your twilio number',
url:'http://someserver.com/twiml.php' // TwiML instructions for the outbound call
});
});
});
<?php header('Content-Type:text/xml'); ?>
<!-- Would be easy to just generate this XML from a node server - doesn't need to be PHP -->
<Response>
<Play>http://someserver.com/audio/zelda.mp3</Play>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment