Plugin: Google Calendar gatherer

Other versions of this plugin may exist. Please ensure you are viewing the documentation for the version that you are currently using. If you are not running the latest version of your plugin we recommend upgrading. See: list of all available versions of this plugin.

Purpose

This plugin is used to index content from Google calender.

Usage

Prerequisite

Before you start the following steps must be completed to configure your Google Calendar for use with the plugin:

  • Create a Google Cloud project with the Calendar API enabled. See: Create a service account - Steps 1 and 2

  • Configure a Google service account with a JSON private key. See: Create a service account - Step 4

  • Configure the Google Calendar permissions to be either:

    • a public calendar, or

    • have read permission assigned to both the service account and to any users that will be accessing the non-public calendar.

Create a custom data source

This plugin must be used in conjunction with a custom data source. Before using this plugin ensure you have created a custom data source, then enable the plugin on this data source.

Enable the plugin

Enable the Google calendar gatherer plugin on your data source from the Extensions screen in the administration dashboard or add the following data source configuration to enable the plugin.

plugin.google-calendar.enabled=true
plugin.google-calendar.version=1.0.0

Enable the JSONToXML filter

This plugin requires the JSONToXML built-in filter to be added to the filter chain.

filter.classes=<OTHER-FILTERS>:JSONToXML:<OTHER-FILTERS>
The plugin will take effect after a full update of the data source.

Plugin configuration settings

The following options can be set in the data source configuration to configure the plugin:

  • plugin.google-calendar.encrypted.private-key (Required): The Google service account private key file context. Please copy and paste the JSON private key file downloaded from Google Cloud. Console.

  • plugin.google-calendar.config.calendar-id (Required): Google Calendar ID, which can be found in the settings section for each calendar in Google Calendar. Note: the plugin can only gather content from a single Google calendar.

  • plugin.google-calendar.config.from-days-back (Optional, *integer* value only): Specifies the number of days, relative to the current date, in the past to include in the index. A negative value means disable this feature. Default value is -1.

  • plugin.google-calendar.config.to-days-ahead (Optional, *non-negative integer* value only): Specifies the number of days, relative to the current date, in the future to include in the index. Setting the value to 0 disables this feature. Default value is 0.

If from-days-back or to-days-ahead is disabled, then the Google Calendar API default behaviour will determine what is returned in relation to the dates range of events. All the calculation of the dates are based on the server time and timezone.

Google Calendar event JSON

The following fields are returned by the Google Calendar API for each event.

{
  "kind": "calendar#event",
  "etag": etag,
  "id": string,
  "status": string,
  "htmlLink": string,
  "created": datetime,
  "updated": datetime,
  "summary": string,
  "description": string,
  "location": string,
  "colorId": string,
  "creator": {
    "id": string,
    "email": string,
    "displayName": string,
    "self": boolean
  },
  "organizer": {
    "id": string,
    "email": string,
    "displayName": string,
    "self": boolean
  },
  "start": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "end": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "endTimeUnspecified": boolean,
  "recurrence": [
    string
  ],
  "recurringEventId": string,
  "originalStartTime": {
    "date": date,
    "dateTime": datetime,
    "timeZone": string
  },
  "transparency": string,
  "visibility": string,
  "iCalUID": string,
  "sequence": integer,
  "attendees": [
    {
      "id": string,
      "email": string,
      "displayName": string,
      "organizer": boolean,
      "self": boolean,
      "resource": boolean,
      "optional": boolean,
      "responseStatus": string,
      "comment": string,
      "additionalGuests": integer
    }
  ],
  "attendeesOmitted": boolean,
  "extendedProperties": {
    "private": {
      (key): string
    },
    "shared": {
      (key): string
    }
  },
  "hangoutLink": string,
  "conferenceData": {
    "createRequest": {
      "requestId": string,
      "conferenceSolutionKey": {
        "type": string
      },
      "status": {
        "statusCode": string
      }
    },
    "entryPoints": [
      {
        "entryPointType": string,
        "uri": string,
        "label": string,
        "pin": string,
        "accessCode": string,
        "meetingCode": string,
        "passcode": string,
        "password": string
      }
    ],
    "conferenceSolution": {
      "key": {
        "type": string
      },
      "name": string,
      "iconUri": string
    },
    "conferenceId": string,
    "signature": string,
    "notes": string,
  },
  "gadget": {
    "type": string,
    "title": string,
    "link": string,
    "iconLink": string,
    "width": integer,
    "height": integer,
    "display": string,
    "preferences": {
      (key): string
    }
  },
  "anyoneCanAddSelf": boolean,
  "guestsCanInviteOthers": boolean,
  "guestsCanModify": boolean,
  "guestsCanSeeOtherGuests": boolean,
  "privateCopy": boolean,
  "locked": boolean,
  "reminders": {
    "useDefault": boolean,
    "overrides": [
      {
        "method": string,
        "minutes": integer
      }
    ]
  },
  "source": {
    "url": string,
    "title": string
  },
  "attachments": [
    {
      "fileUrl": string,
      "title": string,
      "mimeType": string,
      "iconLink": string,
      "fileId": string
    }
  ],
  "eventType": string
}

See: Google Calendar API - events resource for details on each of the fields.

The JSON data is processed using the JsonToXml filter. All the fields are available for mapping with the elements being nested beneath a JSON element: /json/, e.g. to map the location field, use the following X-Path when configuring your XML field mapping /json/location

Metadata mappings

Default mapping

Class ID Type JSON fields from Google Calendar API

t

text

/json/summary

c

text

/json/description

author

text

/json/creator/displayName

d

date

/json/start/date

d

date

/json/start/dateTime

endDateTime

text

/json/end/date

endDateTime

text

/json/end/dateTime

Manual metadata mapping

Use the metadata mappings to configure your metadata mappings. Available fields will be listed by viewing the available XML fields.

The -SF query processor option must also be configured on your results page to include these metadata fields in the search response (e.g. -SF=[endDateTime,.....]).

Errors

The Google Calendar API will return a HTTP 404 not found error if

  • the supplied Calendar ID is invalid, or

  • the permissions set on the Google calendar do not allow the service account to access the calendar.

All versions of google-calendar