How to Receive Birthday Reminders for Your Contacts from Google Calendar
--
Have you ever forgotten to wish someone on their birthday or anniversary, be it a close friend, family member, or a relative? Well most of us have forgotten at some point or the other, and then you end up either awkwardly wishing a belated happy birthday, or not wishing at all. Or maybe you didn’t even realize it passed!
In this article I want to share with you how I manage my birthday reminders, and how I don’t miss to wish someone on their special day. To start off, you need to have your friends’ birthdays stored somewhere. From the title of this article you must have already guessed that we want to store that information in Google Contacts. Let’s face it, no one uses Facebook anymore and so its not a viable option to depend on Facebook or other social media platforms. Besides, even if you and your contacts still uses Facebook or some other social media platform, people may choose not to display their birthday publicly. With Google Contacts you have one centralized location for all the information including the birthday or anniversary of the ones you care about. With most of your data being stored securely with Google, it only makes sense to add and maintain this information in the contacts app itself.
Now Google Calendar already does a decent job of importing the birthdays from your contacts to your calendar. This appears as a separate calendar named “Birthdays”. This calendar is not owned by you, but rather owned by Google, and you have only view access. Which goes to say that if you tried modifying any of the birthday events on this Calendar, you wouldn’t be able to. These events do not have reminders set in them, and hence you wouldn’t be notified. The only way you would know is by opening the Calendar yourself everyday and checking whose birthday it is today. Google Assistant also does give birthday reminders with some setup, but many articles state that this feature isn’t live to everyone at the moment. Hence, for the remainder of this article, we will be writing a short script which will automatically create birthday reminders for your contacts on your calendar and update them regularly.
What we want to do is to create a new event corresponding to each birthday with notifications and other customizable options. To do this we are going to use Google Apps Script.
Apps Script is a scripting platform developed by Google for light-weight application development in the Google Workspace platform.
Apps script is very powerful and I have honestly not explored most of its features yet. Using the extensive bunch of Google APIs, one can create add-ons and scripts that can view and edit your Docs, Sheets, Calendar events, send emails, and pretty much do anything on your Google Workspace.
Head over to the Apps Scripts Editor to create a new project in Apps Script. Rename the project appropriately by clicking on “Untitled project” at the top left. In the file Code.gs, enter the following code.
After you have pasted the above code, let’s go ahead and create a new calendar in which we will add the birthday reminders. Create a new calendar to avoid modifying or deleting any of the existing events in your personal calendar. To create a new Calendar, head over to the settings in your Google Calendar. On the settings page, Click on “Add calendar” and choose “Create new calendar” as shown below. Name your calendar “Birthday Reminders” or something else you like.
Once you have created a new calendar, get the Calendar ID of your newly created calendar from the “Calendar Settings” menu under the new Calendar in the settings page as shown below.
Copy this ID and replace the text “<Your Calendar ID>” in the above script with the calendar ID you just retrieved. After this, save your project and run the script from the “Run” button on the top. With the first execution, it will ask you to review and grant permissions for your project to view and edit your calendar. Since Google hasn’t verified your app, it might show a warning that this is unsafe. Just go ahead and click on “Advanced” and continue to your project to grant the required permissions and run the script again. Voila! You have birthday events created for all your contacts with notifications setup. Feel free to play around with the code and optimize based on your requirements, by checking out the official documentation for Calendar Service. Some of the things you could consider are addEmailReminder(minutesBefore) or addSmsReminder(minutesBefore).
Lastly, we want the script to run on a regular basis, so that the updates we make to any contact’s birthday or anniversary information gets reflected in the reminders, and new information we add also create corresponding reminders. The above script creates reminders for birthdays and anniversaries occurring from tomorrow till one year from today. It does not create recurring events since we will anyway setup a rule to execute the script daily which would ensure that on any day, we have reminders for the next one year. To do this, we need to add a rule to trigger the execution of the script on a regular basis. On your apps script editor, click on “Triggers” and then click on “Add Trigger”.
Choose your desired options of how frequently and when to run this script, and then click on Save.
Congratulations! You’re all set to receive birthday and anniversary notifications!