Skip to content

Instantly share code, notes, and snippets.

@zackproser
Created July 21, 2015 05:32
Show Gist options
  • Save zackproser/00a2a628e2086c25c9e9 to your computer and use it in GitHub Desktop.
Save zackproser/00a2a628e2086c25c9e9 to your computer and use it in GitHub Desktop.
A simple route in Express to handle an incoming Twilio call
/**
* Handle a user phoning the Super CatFacts Attack Call Center
*
* @param {Request} - POST request from Twilio - generated when a user calls the associated Twilio phone number
* @param {Response}
* @return {Response} - Response containing valid Twiml as a string - which creates the CatFacts call center experience
*/
app.post('/incoming-call', function(req, res){
res.writeHead(200, { 'Content-Type': 'text/xml' });
res.end(generateCallResponseTwiml().toString());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment