Skip to content

Instantly share code, notes, and snippets.

@kimberleejohnson kimberleejohnson/index.js
Last active Oct 3, 2019

Embed
What would you like to do?
Playing an audio file in response to a call to a Twilio number from Azure
// Use Twilio in this app
const VoiceResponse = require('twilio').twiml.VoiceResponse;
// Export the function from Azure
module.exports = function (context) {
// Log the response in Azure
context.log('JavaScript HTTP trigger function processed a request.');
// Create a new TwiML response, this time using voice
const twiml = new VoiceResponse();
// Play the secret link that's disguised
twiml.play('https://your-twilio-asset-link-here');
// Let Twilio know what we're responding with
context.res = {
status: 200,
body: twiml.toString(),
headers: {'Content-Type': 'application/xml' },
isRaw: true
};
// We're done!
context.done();
};
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.