Teaching how to integrate Google Calendar with ICS

This section shows you how to use the Google Calendar ICS Connector that comes out of the box.

Obtain your Google Calendar Connector in ICS

In order to create a Google Calendar Connector you need to get the client id and client secret of the Google Calendar Account you want to connect to. For this:

  • Enter a name for your project and click Create.

  • Once Google creates your project, it will show it with most of Google’s APIs

  • Click on Calendar API under “Google Apps APIs

  • Click on ENABLE

  • Click on Go to Credentials

  • Select the following information:

    Which API are you using? – Google Calendar API

    Where will you be calling the API from? – Web server (e.g. node.js, Tomcat)

    What data will you be accessing? – User data


  • Then click on “What credentials do I need?” – It will then take you to creating an OAuth 2.0

  • Enter a name for the client, in my case: s2v-iia-workshop
  • Enter the Authorised redirect URIs – It will be of the form:

https://ICS_HOST:ICS_SSL_PORT/icsapis/agent/oauth/callback

    In my case:

https://soa12c.vbox.oracle.com:7002/icsapis/agent/oauth/callback

  • Click on Create Client ID
  • Enter once again the Product name shown to users and any other customisation option.
  • Click Continue

  • Your Client ID will be displayed.

  • Click Download to get a full copy of all your security configuration. Keep this file secured. It contains your Client ID, Secret, etc.
  • Finally click Done. Notice that you can always download your client ID security credentials.

Create a Google Calendar Connection in ICS:

In this section we are going to create a Google Calendar Connection that will simplify the integration

  • Open ICS and go to Connections
  • Click on Create New Connection
  • Select Google Calendar adapter

  • Enter a sensible name and Description.
  • Set the Connection Role to Invoke. Then click on Create

  • Enter a Connection Administration Email if you want
  • Click on “Configure Security

  • From the file you downloaded from your Google project earlier, enter the Client ID, Client Secret that you obtained before:

https://www.googleapis.com/auth/calendar

  • Then, click on “Provide Consent“.
  • It will ask you to authenticate. Enter your ICS admin username and password

  • It will then ask you to enter you Google credentials and click Sign In.

  • Allow” access to manage your calendars.

  • Congratulations, you have granted access to your Google Project to access your Google Calendar on your behalf via the ICS Connection.

  • Go back to ICS (it will still be open in the previous browser window). Your Google Calendar Connection is configured properly.

  • Click on Save, Test and Save to complete the connection.

  • Congratulations your Google Connector is complete

Create a REST connection in ICS

In this section we are going to create a very simple REST connector that will allow us to integrate into LinkedIn via the LinkedIn connector that we just created earlier.

Note: This is a generic REST connector. If you have already completed the other blogs around how to build an integration to either Facebook, LinkedIn, Google Calendar, etc. Then potentially you can simply reuse that REST connector. If not, feel free to create one and enter a different name.

  • Log into ICS and go to Connections.
  • Click on “Create New Connection” – This time select REST adapter.

  • Enter a name for your REST adapter. In my case, I’m calling it “s2v-iia-rest-msg-connector”
  • In this case, I just want it to trigger my post, so I select just Trigger.
  • Enter a description if you want. Then click on Create

  • Enter an email if you want.
  • We are not setting any security for now.
  • Click Save and then Test. Ensure you get a green 100% status. Click save again and “Exit Connection

  • Congratulations, you have created two connectors! One Google Calendar connector and one REST connector. In the next section we are going to build an integration between them.

Schedule an Event in your Google Calendar account using a REST API via ICS

In this section we are going to create a very simple integration to Schedule an event to my Google Calendar account. We will expose this as a REST API using both connectors that we built previously, the Google Calendar and REST connectors respectively.

  • Log into ICS if not already there
  • Go to Integrations.
  • Click on “Create New Integration”

  • For now, let’s just create a simple mapping. Select “Basic Map Data

  • Enter a name for your Integration. In my case, I call it “s2v-iia-rest2googclr-integration
  • Enter a description if you want and then click “Create

  • You will get a clean integration.

  • On the right, find the REST connector that you built earlier. If you have many, you can enter part of the name at the top and the list will be filtered.

  • Once you have your REST adapter on the list of connections, drag and drop it to the “Drag and Drop a Trigger” section
  • It will open the REST connector configuration wizard.

  • Enter the following information:
    • What do you want to call your endpoint: GoogleCalendarScheduleEvent
    • What does this endpoint do? This endpoint will receive an event and the date when it will occurred.
    • What is the endpoint’s relative resource URI? /social/google/calendar/event
    • What action does the endpoint perform? POST
    • Configure a request payload for this endpoint: Ticked
    • Configure CORS (Cross Origin Resource Sharing): Ticked

  • Click Next.
  • Select the Request Payload Type: JSON

  • Click on the <> link and enter a JSON format as you wish to send your POST body payload. Something like:

{“name”:”name”, “description”:”description”, “when”:”when”}

  • Then, click OK.
  • Leave the Media Type to JSON, and click Next.

  • CORS Configuration – Allowed Origins: *

  • Click Next. For the summary, review all and click Done.

  • That’s it, we have configured a REST Trigger, as part of this integration.
  • Now, search for your Google Calendar connection and drag and drop it into the “Drag and Drop an Invoke” droppable area.
  • It will show you the Google Calendar connection wizard. Enter a name and description.

  • Click Next. Select “Insert Event” from the allowed Operations – This will allow to create a new entry in the Calendar. Then click Next.

  • Review the Summary and click “Done“.

  • The integration should look like this:

  • Click on the Map in the middle and then click +

  • In the mapper you will drag the message elements under “request-wrapper” into the target structure. Notice that the structure within “request-wrapper” is the one that you defined when creating freely the JSON payload that you are expecting as input. Pretty cool huh? Follow the next mappings:
  • name -> summary
  • description -> description
  • when -> start/dateTime + “T09:00:00-07:00”
  • when -> end/dateTime + “T17:00:00-07:00”
  • Other configurations on the target that we are fixing for now:
    • calendarId: primary
    • Location: 417 St. Kilda Rd, 3004, Melbourne, Victoria, Australia
    • Start/End timeZone(s)*: Australia/Melbourne
    • recurrence: RRULE:FREQ=DAILY;COUNT=1
    • attendees/Email(s):
      barack.dorman@gmail.com
    • reminders/useDefault: false
    • reminders/overrides/method: email
    • reminders/overrides/minutes: 15

*Note: The time zones need to be according to IANA Time Zone Database names.

  • Notice that you need to use the concatenate function for some fields, such as for “start/end dateTime”. For this, you need to click on the target element that you want to set and on the left search for the operation that you want, drag and drop it into the statement area and finally click on Source to fill the expressions accordingly.

    Note: Do Not enter strings within quotes.

For example:

  • Once you set all these variables, it should look like this:

  • You can Test it by clicking the test icon

You can generate dummy inputs and test the result mapping

  • Click Save on the Mapping window

  • Exit the mapper. The integration should look like this:

  • Click on “Tracking”

  • Drag and drop the name element under “request-wrapper” into the Tracking Field

  • Save your integration.

Notice that it shows a warning because we don’t have any response and fault. In a real scenario we would configure those, but we didn’t select it in this example for simplicity purposes.

  • Exit the Integration. Notice that your integration is still to be “Activated”

  • Click on the green “Activate” label on your adapter.
  • Select to Enable tracing and click Yes.

  • Congratulations! Your integration is complete.

  • Click the “information” icon for your integration and copy the Endpoint URL

Since I am using a test environment, the Endpoint is not connected to the Public Cloud, if you click on it will open up a broken link. If you are using your own ICS account, you will not experience this situation. However, let me tell you how I fixed mine… I just removed the “ics/faces/null/” bit from the URI.

I will end up to something like this:

https://%5Bserver-location%5D
/integration/flowapi/rest/S2V_IIA_REST2GOO_INTEGRAT/v01/metadata?_afrRedirect=8691821266226

  • Try it in a browser and make sure you get the expected metadata:

Notice that it will show you the Metadata descriptor of your REST API endpoint, for example, the Accepted Media Type, A JSON request sample, Allowed methods, CORS configuration, etc.

  • Use POSTMAN, SOAPUI or any other REST Test client to send a REST POST command. In this case I am using SOAPUI.
  • In order to get the Endpoint URL, copy the link below and remove the last bit from “metadata”. Then just copy the API that you designed, you can copy it from the metadata page. In this case: “/social/google/calendar/event

The REST API will be something like this:

https://%5Bserver_endpoint%5D/integration/flowapi/rest/S2V_IIA_REST2GOO_INTEGRAT/v01/social/google/calendar/event

The last bit in red represents the actual URI of your API created in ICS.

  • Make sure to change the method to POST and in the body enter the POST body payload in the structure that you created as part of the ICS integration. You can also copy the entered JSON sample from the metadata page:

  • In my case I entered this:

{“name”:”Speed 2 Value – Integration in Action Workshop”,

“description”:”Welcome to the Integration in Action workshop in your own city”,

“when”:”2016-08-09″}

  • Leave the Media Type as application/json

  • Click the green icon to send the request. You will receive a 202 Accepted response – See that as Raw

  • Finally, confirm that you see the update went through. Login into Google Calendar and validate that the event was created on the day that you mentioned.

How cool is that?

  • Congratulations! You just integrated to Google Calendar via Oracle Integration Cloud Service.
Advertisement

Author: Carlos Rodriguez Iturria

I am extremely passionate about people, technology and the most effective ways to connect the two by sharing my knowledge and experience. Working collaboratively with customers and partners inspires and excites me, especially when the outcome is noticeable valuable to a business and results in true innovation. I enjoy learning and teaching, as I recognise that this is a critical aspect of remaining at the forefront of technology in the modern era. Over the past 10+ years, I have developed and defined solutions that are reliable, secure and scalable, working closely with a diverse range of stakeholders. I enjoy leading engagements and am very active in the technical communities – both internal and external. I have stood out as a noticeable mentor running technology events across major cities in Australia and New Zealand, including various technology areas such as, Enterprise Integrations, API Management, Cloud Integration, IaaS and PaaS adoption, DevOps, Continuous Integration, Continuous Automation among others. In recent years, I have shaped my role and directed my capabilities towards educating and architecting benefits for customers using Oracle and AWS Cloud technologies. I get especially excited when I am able to position both as a way to exceed my customers’ expectations. I hold a bachelor degree in Computer Science and certifications in Oracle and AWS Solutions Architecture.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: