When you have a message on your voicemail, to a phone number that is linked to your account at Google Voice, you receive an email notification to your Gmail account along with a link so you can hear the audio message on your phone or computer. Below we will post a script that will enable you to automatically save this voice messages to your Google Drive as MP3 files.
The web application was developed by Amit Agarwal (amit [at] labnol.org) and scans your Gmail mailbox for any voicemail messages from Google Voice. Once discovered, it saves the sound to a specific folder on your Google Drive. The application converts voicemail messages into the MP3 file, and lets you search for them through Google Drive.
To get started, Click here to allow the application to have access στους λογαριασμούς σας στο Gmail και το Google Drive. Στην επόμενη σελίδα, κάντε κλικ στο button of Google Voice and wait for the application to prepare. That's it. The app will run in the background and monitor your Gmail account for any messages from Google Voicemail.
It will create a new folder that will name Google Voice on your Google Drive and will store all the MP3 files it will convert from your voicemail. Also, each time a voice message is processed in your Gmail, it will display a new tag called MP3 to prevent its reprocessing from the application.
Below is the source codeof the application. You can stop the script from running at any time using the uninstall link you will have received in your Gmail when you authorized the app.
- / * Written by Amit Agarwal amit@labnol.org * /
- / * Tutorial: http://www.labnol.org/?p=25153 * /
- var folder, folder_name =Google Voice;
- var archive, gmail_label ="MP3";
- / * Find Google Voice messages in Gmail * /
- var filter =“From: voice-noreply@google.com -label:”+ gmail_label;
- var threads =GmailApp.search(filter,0,10);
- if(threads.length){
- / * Google Drive folder where MP3 files will be stored * /
- var folders =DriveApp.getFoldersByName(folder_name);
- folder = folders.hasNext()? folders.Next():DriveApp.createFolder(folder_name);
- / * Gmail Label that is applied to processed voice mails * /
- archive =GmailApp.getUserLabelByName(gmail_label)?
- GmailApp.getUserLabelByName(gmail_label):GmailApp.createLabel(gmail_label);
- for(var x=0; xthreads.length; x+){
- threads[x].addLabel(archive);
- var msg = threads[x].getMessages() [0];
- / * Find the link to play the voice mail message * /
- var url = msg.getBody().match(/https?:\/\/www.google.com\/voice\/fm[^\ `]*/gi);
- if(url){
- / * Find the name of the voice sender (or their phone number) * /
- var file_name = msg.getSubject().match(/ new voicemail from (. *) at /i);
- / * Add the voice mail to the file name * /
- var file_date =Utilities.formatDate(
- msg.getDate()Session.getScriptTimeZone()"Yyyy-MM-dd HH: mm");
- if(file_name){
- / * Extract the audio file and save as a MP3 file * /
- var mp3 = url[0].replace(“/ Voice / fm /”,“/ Voice / media / svm /”);
- var fillet = folder.createFile(UrlFetchApp.fetch(mp3).getBlob());
- / * Save the voice mail transcript with the audio file * /
- fillet.setName(file_name[1]+”[“+ file_date +"]"+“.Mp3”);
- fillet.setDescription(msg.getPlainBody());
- }
- }
- }
- }
[**] The web application requires permissions to access your Gmail and Google Drive. The source code of the application will convince you that the application is secure. If the Web App is not believed to be running with the above code, just make a copy of the above code on your Google Drive and run it manually.