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.
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.
- Use Googles wizard to create or select a project to turn on the API for.
- On the Add credentials to your project page, click the Cancel button.
- At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
- Select the application type Other, enter a name, and click the Create button.
- Click OK to dismiss the resulting dialog.
- Download the JSON containing your credentials and put it in the root of your repository.
- Rename the file
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.
- Start a wizard for generating a token by running
npm run token
. - Follow the steps in the wizard.
- If everything went correctly, you should have a file called
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.
- Copy
config.default.json
toconfig.json
. - You will see a sample calendar with no URL. This must be a URL that points to the iCal feed of your calendar. For Google Calendar and iCloud calendars, this can be obtained through their respective web interfaces.
- It is important that your calendars have unique names.
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.
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
.