Last active
October 3, 2019 22:22
-
-
Save kimberleehowley/445c478f91ac9fb2461287215d6c1fda to your computer and use it in GitHub Desktop.
Playing an audio file in response to a call to a Twilio number from Azure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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