Productivity Technology

Contacts – Keep In Touch or Update Details

One of my New Year resolutions was to keep in touch with more people.

I also need to clear out my contact list as there are lots of “old” and incomplete entries in my Google contacts list.

Ever the productivity geek I wanted to automate this. I ended up writing the following Google Apps Script:

Select a random contact and then send myself an email prompting me to contact the person, edit their details and look them up on LinkedIn. This is then scheduled to run once a day:

function reviewContacts() {
var contacts=ContactsApp.getContacts()
var contactCount=contacts.length
var randID=Math.ceil(Math.random()*contactCount)
var aContact=contacts[randID]
var contactArray = aContact.getId().split(‘/’)
var contactID = contactArray[contactArray.length – 1]
var contactName = aContact.getFullName()
if (aContact.getCompanies().length > 0) {
var companyName = aContact.getCompanies()[0].getCompanyName()
else {
var companyName = “”
if (aContact.getEmails().length > 0){
var emailAddress = aContact.getEmails()[0].getAddress()
else {
var emailAddress = “”
var strMessage = ‘Please review the contact information for ‘ + contactName + ‘ from ‘ +companyName +’.\n’
strMessage += ‘Send an email to: ‘ + emailAddress + ‘.\n’
strMessage += ‘Edit the contact’ + contactID + ‘ ‘ + contactName + ‘.\n’
strMessage += ‘Search LinkedIn’ + encodeURI(contactName) + ‘.’

GmailApp.sendEmail(‘’, ‘Review Contact – ‘ + contactName + ‘ from ‘ + companyName , strMessage)

Please NOTE:

  • Any Quotes in the script should be delete and re-typed as the editor replaces them with “smart” quotes.
  • This is not very performant – I’m just learning the Google APIs.
  • This is not very “good” – I have never claimed to be a JavaScript programmer !

If you have any suggestions for improvements to this code, let me know in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *