Google Calendar Adapter

Requirements

  • Google API Project (https://cloud.google.com/console)
  • Calendar API Service turned on for the project
  • Google OAuth Service Account with P12 Private key file
  • The Kinetic Calendar web server must be using JDK 6.0 or higher.
  • The following java libraries (all included in kinetic-calendar-google-adapter-v1.0.0.zip) must be put in the Kinetic Calendar web application classpath:
    google-api-client-1.15.0-rc.jar
    google-api-services-calendar-v3-rev48-1.15.0-rc.jar
    google-http-client-jackson-1.15.0-rc.jar
    google-http-client-1.15.0-rc.jar
    google-oauth-client-1.15.0-rc.jar
    jackson-core-asl-1.9.11.jar
    kinetic-calendar-google-adapter.jar

Google Service Account

This section describes the steps necessary for creating the Google service account type required by this adapter. If you already have a Google service account and the private P12 key file associated with the service account, you can skip this section.

Step 1) Go to https://cloud.google.com/console

Step 2) Create a New Project by clicking on 'Create Project'

Step 3) Fill in the New Project details: "Project name" and "Project ID". Project Name can be anything you want. Project ID is something Google will make for you.

Step 4) After you've successfully created the project, click the 'APIs & auth' link on the left hand side of the page. Select the 'APIs' link directly under 'APIs & auth'. Find the 'Calendar API' in the list of available APIs and click on the 'OFF' button directly to the right. Accept the Terms of Service for the API.

Step 5) Click the 'Credentials' in the navigation section under the 'APIs & auth' section header.

Step 6) Click the 'CREATE NEW CLIENT ID' red button directly below the 'OAuth'.

Step 7) Choose the 'Service account' option and then click the blue 'Create Client ID' button.

Step 8) Google will now ask you to download a file (or depending on your browser settings it will automatically download & save). This file is your P12 private key file. Securely store this file and do not lose it. It is a necessary configuration property for this adapter.

Step 9) Read the 'New Public/Private key pair generated' pop-up information if you want and then click the 'Okay, got it' button.

Step 10) Under the new 'Service Account' section on the page copy the Service Account's 'Email Address'. It will look something like this: 361548398439-1ffipw9ane3vct19rbs2vphiu1qqea9@developer.gserviceaccount.com

Adapter Configuration

  • Adapter Class - This value must be added to the adapters.json configuration file:
    com.kineticdata.calendar.adapters.google.GoogleAdapter

Connection Configuration

  • Adapter Class
    com.kineticdata.calendar.adapters.google.GoogleAdapter

  • Properties
    SA Client Email - The e-mail address of a certificate based google service account. They will look something like this: 361548398439-1ffipw9ane3vct19rbs2vphiu1qqea9@developer.gserviceaccount.com
    P12 Certificate Location - Location on the web server where the OAuth private key associated with the SA Client Email is stored. C:\path\to\certificates\33a0755ee75064539512752055dd5bef52355555-privatekey.p12

Event Type Source Configuration

The event type source for a Google Calendar Adapter defines the name of the connection for the calendar events, and one required configuration parameters.

On the event type configuration page, we saw that the source configuration property was dependent on the adapter used by the connection. The Google Calendar Adapter requires one additional property, "Calendar ID".

"Calendar ID" is a configuration option that specifies the Google Calendar you wish to view. The service account (e.g. 361548398439-1ffipw9ane3vct19rbs2vphiu1qqea9@developer.gserviceaccount.com) the connection uses must have access to this calendar in order to view it. You may need the owner of the calendar to share the calendar with the service account with at least the 'See all events detail' permission.

The way Google Calendar ID's work is for the primary calendar of a user the Google Calendar ID will be their e-mail address. If you want to view a different calendar a user has created then you'll need to get the unique calendar ID assigned to that calendar. You can find this ID by going to the calendar settings page, find the 'Calendar Address:' section, and to the right it will say for example: 'Calendar ID: yourdomain.com_b35553v250g2j5c5552u156e55@group.calendar.google.com'

Calendar ID configuration example

"source": {
  "connectionName": "Google Calendar",
  "configuration": {
      "Calendar ID": "yourdomain.com_b35553v250g2j5c5552u156e55@group.calendar.google.com"
  }
}

Event Type Mappings

Event type mappings create a relationship between Google Calendar appointment or meeting properties, and one of the event properties.

The syntax used to parse Google Calendar properties must be consistent with the rules for mappings, which means that all Google Calendar properties must be enclosed in mustaches (double braces). Currently event type mappings only support a direct mapping to one Google Calendar property. These rules apply to all event type mappings - core mappings, details mappings, and filter mappings.

Core Mappings

Core mappings are not configurable in the Google Calendar adapter.

Detail Mappings

An example of a Google Calendar property mapping:

"detailMappings": {
  "Event Author": "{{Created By}}"
}

In this example, a mapping has been created to add an "Event Author" property to the event details. The value for this property will come from Google Calendars event "Created By" property.

Valid Detail Mappings

  • Body
  • Created At
  • Created By
  • Location
  • Modified At

Filter Mapping Properties

An example of a Google Calendar filter mapping:

"filterMappings": [
  {
    "name": "Event Author",
    "value": "{{Created By}}",
    "values": {}
  },
  {
    "name": "Location",
    "value": "{{Location}}",
    "values": {}
  }
]

In this example, filter mappings have been created allow the calendar events to be filtered by Location and Event Author (which maps to Google Calendar's "Created By" property).

Valid Filter Mapping Properties

  • Created By
  • Location