Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save armiiller/a945f191b807eaa841dfcbf69e954462 to your computer and use it in GitHub Desktop.
Save armiiller/a945f191b807eaa841dfcbf69e954462 to your computer and use it in GitHub Desktop.
console.log('starting function');
const qs = require('qs');
const snsPublish = require('aws-sns-publish');
exports.handle = function(e, ctx, cb) {
console.log('processing event: %j', e)
var snsarn = process.env.SNSARN;
var body = {};
if(e && e.reqbody){
body = qs.parse(e.reqbody);
}
if(snsarn){
snsPublish(`New Voicemail: ${body.RecordingUrl}`, {arn: snsarn, subject: 'New Voicemail'});
}
var response = {
statusCode: 200,
};
cb(null, response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment