const got = require('got');
//Boilerplate for function code
exports.handler = function(context, event, callback) {
// Make an HTTP Request using a template literal for the Twilio API call
got(`https://api.twilio.com/2010-04-01/Accounts/${context.ACCOUNT_SID}/Calls/${event.callSid}/Recordings.json`,{
method:'post',
username: context.ACCOUNT_SID,
password: context.AUTH_TOKEN
})
.then(res => {
console.log(res);
callback(null, res.body);
})
.catch(err => {
console.log(err);
callback(err);
});
};