Skip to content

Instantly share code, notes, and snippets.

@nokenwa
Created June 20, 2019 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nokenwa/f56217ab5f9912b2c0701ef49293853a to your computer and use it in GitHub Desktop.
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
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