Created
June 20, 2019 14:55
-
-
Save nokenwa/f56217ab5f9912b2c0701ef49293853a to your computer and use it in GitHub Desktop.
Grab Voicemail and send link to audio as a text to personal phone number
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
exports.handler = function(context, event, callback) { | |
const client = context.getTwilioClient(); | |
const voicemail = event.RecordingUrl; | |
//Get Caller ID | |
client.calls(event.CallSid).fetch() | |
.then(call =>{ | |
const messageBody = 'You have a new voicemail from ' + call.From + ': ' + voicemail +'.mp3'; | |
console.log(fromNumber); | |
client.messages.create({ | |
from: context.twilioNumber, | |
to: context.MobileNumber, | |
body: messageBody | |
}, function(error,result){ | |
callback(); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment