Last active
March 29, 2019 05:15
-
-
Save ChloeCodesThings/b11b1c41397ff0bc9a7f27d800db968a to your computer and use it in GitHub Desktop.
An Ambivert's Guide to Azure Functions Sample Code- Call Example
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
const accountSid = process.env.TWILIO_SID; | |
const authToken = process.env.TWILIO_TOKEN; | |
const client = require('twilio')(accountSid, authToken); | |
// This can also be accomplished with a Twilio output binding- you can read more on this at http://aka.ms/AA4n3j | |
module.exports = async function (context){ | |
const twilioOptions = { | |
url: process.env.TWIML_URL, | |
to: process.env.RECIPIENT_NUMBER, | |
from: process.env.SENDER_NUMBER | |
}; | |
await client.calls | |
.create(twilioOptions) | |
.then(call => { | |
context.log("Call sent"); | |
context.res = { | |
body: "Call successfully sent" | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment