Chapter 8. Connect to Google Calendar

You can add a Google Calendar connection to an integration as its start connection to trigger execution of an integration.. You can add a Google Calendar connection to an integration as its finish connection when you want to add or update an event. In the middle of an integration, you can add a Google Calendar connection when you want to obtain a particular event, add a new event, or update an event.

Details for connecting to Google Calendar are in the following topics:

8.1. Register Fuse Online as a Google Calendar client application

In an integration, to be able to connect to Google Calendar, you must register your Fuse Online environment as a Google client application. During registration, you enable the Google Calendar API and create credentials that Fuse Online uses to access Google APIs that you have enabled.

With registration in place, you can create any number of Google Calendar connections and any number of integrations that connect to Google Calendar. While each Google Calendar connection uses the same registration, each connection can access the calendars that belong to a different Google account.

Note

If you already created a Gmail connection, then you already created the credentials that your Fuse Online environment needs to access enabled Google APIs. You do not need to follow the procedure documented here. To be able to create a Google Calendar connection, you just need to enable the Google Calendar API and then copy Fuse Online settings from Gmail to Google Calendar.

Procedure

  1. In Fuse Online, obtain the callback URL as follows:

    1. In the left navigation panel, click Settings.
    2. On the Settings page, near the top, to the right of the callback URL, click Copy Callback URL to copy the callback URL for your Fuse Online environment to the clipboard. You will need this URL later in this procedure.
  2. In another browser tab, go to https://console.developers.google.com and do the following:

    1. Confirm that you are signed in to the Google account that you want to use to register Fuse Online as a Google client application. Or, choose a different Google account and sign in to that account.
    2. Ensure that you want to use the current Google project to grant authorization to Fuse Online. Or, choose or create another project. If this Google account does not already have a project, you must create one. For information about Google projects and how you might want to organize your use of projects, click the Google help icon in the upper right.
    3. You should see the APIs and Services dashboard. If you do not, then in the upper left corner, click the Navigation menu icon and select APIs and Services > Dashboard.
    4. Enable the Google Calendar API as follows:

      1. At the top of the page, click ENABLE APIS AND SERVICES.
      2. In the page that appears, in the search field, enter Google Calendar.
      3. In the search results, click the Google Calendar card.
      4. In the Google Calendar API page, click ENABLE.
    5. Give your client application a name as follows:

      1. In the page that appears, in the left navigation panel, click Credentials and then on the right, click Credentials in APIs & Services.
      2. Click the OAuth consent screen tab.
      3. In the page that appears, in the Application Name field, enter a name for the Fuse Online client application. For example, enter Fuse Online client application.
      4. Skip the other fields.
      5. Click Save.
    6. Obtain client application credentials as follows:

      1. To the right of Create Credentials, click the down arrow to display a menu and select OAuth client ID.
      2. In the page that appears, select Web application to display more content.
      3. In the Name field, enter a name for the OAuth client ID for your Fuse Online environment. This is different from the name that you entered for the client application itself. For example, enter OAuth client ID for Fuse Online.
      4. Skip Authorized JavaScript origins.
      5. In the Authorized redirect URIs field, paste the callback URL that you copied from your Fuse Online environment at the beginning of this procedure.
      6. Click Create to display the client ID and client secret for your Fuse Online environment.
    7. To the right of the client ID field, click the Copy icon to copy the client ID to your clipboard.
  3. Return to the Fuse Online Settings page, expand the Google Calendar entry, and in the Google Calendar Client ID field, paste the consumer client ID that you just copied.
  4. Return to the Google developers site and to the right of the client secret field, click the Copy icon to copy the client secret to your clipboard.
  5. Return to the Fuse Online Settings page and do the following:

    1. In the Google Calendar Client Secret field, paste the Google Calendar client secret that you just copied.
    2. Click Save. You should get a Registration Successful! notification.
    3. Click Ok to collapse the fields.

Results

You can now create a Google Calendar connection.

Important

The Google client ID and Google client secret contain token refresh information that ensures that your Google Calendar connections and integrations that have Google Calendar connections continuously work correctly. Consequently, you should not obtain new credentials. If you do, then you would need to recreate each Google Calendar connection and re-publish each integration that uses a Google Calendar connection.

8.2. Enable access to the Google Calendar API

To be able to connect to Google Calendar in an integration, you must register your Fuse Online environment as a Google client application. During registration, you enable the Google Calendar API and create credentials that Fuse Online uses to access Google APIs that you have enabled.

If you already created a connection to Gmail, then Fuse Online has the credentials for access to enabled Google APIs. To be able to create a Google Calendar connection, you just need to enable the Google Calendar API and then copy Fuse Online settings from Gmail to Google Calendar.

If you already registered your Fuse Online environment as a Google client application and during registration you enabled the Google Calendar API, then you do not need to follow the procedure provided here. You are ready to create a Google Calendar connection.

Prerequisite

In the Settings page in your Fuse Online environment, the Gmail entry displays Edit and Remove, which indicate that Fuse Online has the credentials to access enabled Google APIs. If Register appears in the Gmail entry, then you must register your Fuse Online environment as a Google client application.

Procedure

  1. In a browser, go to https://console.developers.google.com and do the following:

    1. Confirm that you are signed in to the Google account that you used to register your Fuse Online environment as a Google client. If you are not, sign in to that account.
    2. Ensure that the current Google project is the one you used for registration. If it is not, change to that project.
    3. You should see the APIs and Services dashboard. If you do not, then in the upper left, click Navigation menu icon and select APIs and Services > Dashboard.
    4. At the top of the page, click ENABLE APIS AND SERVICES.
    5. In the page that appears, in the search field, enter Google Calendar.
    6. In the search results, click the Google Calendar card.
    7. In the Google Calendar API page, click ENABLE.
  2. In the Fuse Online Settings page, do the following:

    1. Expand the Gmail entry.
    2. Expand the Google Calendar entry.
    3. Copy the Gmail client ID to the input field for the Google Calendar client ID.
    4. Copy the Gmail client secret to the input field for the Google Calendar client secret.
    5. Click Save,and then click Ok.

Result

You can now create a Google Calendar connection.

8.3. Create a Google Calendar connection

When you create a Google Calendar connection, you authorize the connection to access the Google Calendars that are associated with one particular Google account. After you create a Google Calendar connection, you can add it to multiple integrations.

Prerequisite

You registered your Fuse Online environment as a Google client application as described in Register as a Google Calendar client application.

Procedure

  1. In Fuse Online, in the left panel, click Connections to display any available connections.
  2. In the upper right, click Create Connection to display the available connectors. A connector is a template that you use to create one or more connections.
  3. Click the Google Calendar connector.
  4. In the Configure Connection page, click Connect Google Calendar, which takes you to a Google sign-in page.

    Note

    If Connect Google Calendar does not appear, then your Fuse Online environment is not registered as a Google client application with the Google Calendar API enabled. See Register as a Google Calendar client application. When your environment is not registered with Google, then when you try to create a Google Calendar connection, Fuse Online displays multiple fields that prompt for authorization information. While you can create a Google Calendar connection by entering values in these fields, you should register with Google first, enable the Google Calendar API, and then create a Google Calendar connection.

  5. In the Google sign-in page, select the Google account that you want this connection to access from Fuse Online and click Next.
  6. In response to the openshiftapps.com wants to access your Google Account prompt, click Allow to return to Fuse Online.
  7. In the Fuse Online Connection Name field, enter your choice of a name that helps you distinguish this connection from other connections. For example, enter Google Calendar Work Connection.
  8. In the Description field, optionally enter any information that is helpful to know about this connection. For example, enter Sample Google Calendar connection that uses my Google work account.
  9. In the upper right, click Create to see that the connection you created is now available. If you entered the example name, you would see that Google Calendar Work Connection appears as a connection that you can choose to add to an integration.

8.4. Trigger an integration when polling returns an event from a Google calendar

To trigger execution of an integration upon obtaining events from a Google Calendar that you specify, add a Google Calendar connection to an integration as its start connection. When the integration is running, the Google Calendar connection checks the Google calendar for events at intervals that you control. When the connection finds events that comply with the way that you configured the Google Calendar Get Events action, the connection passes the events to the next step in the integration.

When a Google Calendar connection returns more than one event, Fuse Online executes the integration for each returned event. For example, if the poll returns 5 events then Fuse Online executes the integration five times.

Prerequisite

You created a Google Calendar connection.

Procedure

  1. In the Fuse Online panel on the left, click Integrations.
  2. Click Create Integration.
  3. On the Choose a Start Connection page, click the Google Calendar connection that you want to use to start the integration.
  4. On the Choose an Action page, click the Get Events action.
  5. To configure the Get Events action:

    1. In the Delay field, accept the default of 30 seconds or specify how often you want the integration to check the calendar.
    2. In the Calendar name field, enter the name of a calendar that is accessible from the Google account that this Google Calendar connection is authorized to access.
    3. In the Max Results field, accept the default of 5 or indicate the maximum number of events that the connection can return for each poll.
    4. Select one of the following to indicate the date that you want the connection to use to start checking for events. The connection checks that date and subsequent dates.

      • Consume from the current date ahead starts on the current date.

        For example, if you select this option, and if Max Results is 5, then the Google Calendar connection starts checking for events on the current date and returns no more than the first five events that it finds. It does not matter whether or not these events have been updated or added since the last poll.

      • Consume from the last event update date on the next poll starts on the date of the most recently updated event that was returned in the previous poll.

        For example, if you select this option, and if Max Results is 5, then the Google Calendar connection returns no more that 5 updated or new events. The connection starts checking for new or updated events on the date of the most recently updated event that was returned in the previous poll.

    5. Optionally, in the Query for events field, specify text to filter the events that the poll can return. The connection returns only events that contain the specified text in at least one event field.

      For example, suppose that you specify Standup meeting in the query field. A poll would return only those events that have Standup meeting in an event field.

  6. Click Done to add this Google Calendar connection as the integration’s start connection. The connection appears as the first step in the integration.

8.5. Obtain a particular event from a Google calendar

In an integration, you can obtain a particular Google Calendar event in the middle of an integration. Obtaining a particular event is useful, for example, when you want to:

  • Update the event in a subsequent Google Calendar connection.
  • Announce the event by using a subsequent Twitter connection.

To obtain one event, add a Google Calendar connection in the middle of an integration.

Note

In this release, while obtaining a specific event in an integration’s finish connection is supported, it is not particularly useful. This is expected to change in a future release.

Prerequisites

  • A Google Calendar connection is available and this connection is authorized to access the Google calendar that has the event that you want to get.
  • You are creating or editing an integration and Fuse Online is prompting you to select the connection that you want to add in the middle of an integration.

Procedure

  1. Click a Google Calendar connection that is authorized to access the calendar that you want to connect to.
  2. On the Choose an Action page, click Get a Specific Event.
  3. Specify the name of the caladd a finish connection or add a finish connection or endar that has the event that you want.
  4. Specify the ID of the event to get. To obtain the event ID, do one of the following:

    • Map it from a previous Google Calendar connection.
    • Manually obtain it from the calendar as follows:

      1. In a browser, display the calendar that contains the event you want to get.
      2. Append `?gsessionid=OK&eventdeb=1`to the URL and redisplay the calendar.
      3. In the calendar, click the event that you want to get.
      4. In the event popup, click Options and select Troubleshooting info.
      5. In the popup that Google Calendar displays, copy the string that follows eid=. For example, an event ID looks something like this: p1pva2a4t504gbsha12di9ch6k_20181107T150000Z*.
  5. Click Done to add the connection to the integration. The connection appears in the integration flow in the location where you added it.

8.6. Add an event to a Google calendar

In an integration, you can add an event to a Google calendar in the middle of the integration or to finish the integration. To do this, add a Google Calendar connection to the middle of an integration or as the integration’s finish connection.

Prerequisites

  • A Google Calendar connection is available and this connection is authorized to access the Google calendar to which you want to add an event.
  • You are creating or editing an integration and Fuse Online is prompting you to add a finish connection or select the connection that you want to add in the middle of an integration.

Procedure

  1. Click a Google Calendar connection that is authorized to access the calendar that you want to connect to.
  2. On the Choose an Action page, click the Create Event action.
  3. Configure the Create Event action:

    1. Enter a title for the new event.
    2. Enter the name of the Google Calendar to add the event to.
    3. For the other input parameters, you can enter data or you might want to map values from an event that you obtained in a previous Google Calendar connection.
  4. Click Done to add the connection to the integration. The connection appears in the integration flow in the location where you added it.

8.7. Update an event in a Google calendar

In an integration, you can update an event in a Google calendar in the middle of the integration or to finish the integration. To do this, add a Google Calendar connection to the middle of an integration or as the integration’s finish connection.

Important

In this release, the Update Event action requires a value in each event field. In most if not all cases, this means that you must add a Google Calendar connection that obtains the event that you want to update, then add the Google Calendar connection that updates the event, and then insert a data mapper step between the two Google Calendar connections.

Prerequisites

  • A Google Calendar connection is available and this connection is authorized to access the Google calendar that has the event that you want to update.
  • In the integration, there is an earlier connection to Google Calendar and that connection obtains the event that you want to update.
  • You are creating or editing an integration and Fuse Online is prompting you to add a finish connection or select the connection that you want to add in the middle of an integration.

Procedure

  1. Click a Google Calendar connection that is authorized to access the calendar that you want to connect to.
  2. On the Choose an Action page, click Update Event.
  3. To configure the Update Event action:

    1. Enter the title of the event that you want to update.
    2. Enter content in each event field that you want to update. Do not enter content in an event field when you want the content in that field to remain the same as it was.
  4. Click Done to add the connection to the integration. The connection appears in the integration visualization flow in the location where you added it.
  5. In the integration visualization flow, hover over the plus sign that is just before the connection that you just added and click Add a step.
  6. Click Data Mapper.
  7. In the data mapper, for each event field that remains the same in the updated event, map that field from the Google Calendar connection that obtained the event to the corresponding field in the Google Calendar connection that updates the event.

    Do not map fields that you are updating. If you map a field and also specify an update for that field when you configure the Update Event action, Fuse Online uses the mapped value.

  8. In the upper right, click Done to add the data mapper step.