Created
November 3, 2017 18:41
-
-
Save armiiller/a945f191b807eaa841dfcbf69e954462 to your computer and use it in GitHub Desktop.
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
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