Copies calendar events into a primary Google calendar from iCal feeds thereby making it possible for a Google Home to read the calendar events.
Google Assistant, and thereby Google Home, only supports reading calendar events from your primary calendar in Google Calendar. If you have any subscriptions, delegates or multiple accounts these are not supported. This is stated in the Google Home help section under Supported Calendars.
This project introduces a workaround. The app will read your calenders as iCal feeds and add the events from the feeds to your primary calendar. By relying on iCal feeds, this works both with other Google calendars as well as iCloud calendars.
⚠️ Before adding events to your calendar, the app will clear your primary calendar, mening that all events in the calendar are removed. That means the app assumes that you are not already using your primary calendar but instead are relying on other calendars, e.g. an iCloud calendar for your primary events and another Google calendar for your work calendar. This is done to avoid duplicates.
The following will guide you through configuring the app.
The first thing you will need is to enable the Google Calendar API on your Google Account. To enable the API, follow the steps below. The steps can also be found on Googles Node.js Quickstart guide.
google-client-secret.json
. This is important as the app will look for a file with that name in the root of the project.Next you will need to generate an OAuth token that the app can use to manage your Google Calendar.
npm run token
.google-auth-token.json
in the root of your project.Now you are ready to add the calendars you want to put into your primary calendar. Follow the steps below.
config.default.json
to config.json
.You can add as many calendars as you want to. The two attributes past_days
and future_days
specify the amount of days to copy events into the past and into the future. If you leave out either attribute, the app will look indefinitely into either direction in time. Leave out both attributes to copy your entire calendar. This is not recommended.
You are now ready to deploy the app. Ensure everything is staged and commited to your git repository. Remember that you just added two files containing credentials and a config file with the URLs to your personal calendars, so you probably don’t wnat to push this to any public remotes.
You can deploy to Heroku by pressing the above button or you can deploy manually in whatever way you prefer.
⚠️ This is the moment you will remove all events in your primary calendar. For an explanation, see the top of this readme.
Running npm run refresh
will refresh your calendar. You probably want to configure this to be run periodically, e.g. every hour. If you have deployed to Heroku, it is recommended that you use Heroku Scheduler to configure this. Otherwise you will probably want to set up a cronjob.
If you used the “Deploy to Heroku” button, the Heroku Scheduler addon is already added but it is not configured. You will need to log into Heroku, navigate to the Heroku Scheduler dashboard addon and add a new job that runs npm run refresh
.