Wednesday, August 15, 2018

#648 OIC Integration 101 Part V - Social adapters - Facebook

Just a quick introduction to some of our Social adapters -

Facebook - social media for over 50s

You will need a Facebook account to do this lab.

Essentially, you will create a new page under your Facebook account.
Then you will leverage the OIC Facebook adapter
to retrieve Page details and then retrieve Page posts.

So let's begin - setup

You will need an account at
Simply go in and create one.
Essentially what you do is create an App.
The work that we do via the FB adapter will be in the context of this app.

Note the App ID and App Secret -

they will be needed for creating the OIC connection to Facebook.

you also need to set the callback url for OIC -

Products -- Facebook Login -- Settings 

The url has the format -

You now create a page within the context of your facebook app -

Settings -- Advanced

Ensure you specify the App Page category, when creating the page.
As you can see, my app and page are called OICApp.

OIC setup and development 

First upload the Facebook certificate.
You get this by logging in to and downloading the cert.
This you then import into OIC -

Then click Upload and do the necessary

Create the Facebook Connection 

Configure as follows -

Client ID is set to your Facebook App ID.
Client Secret is set to App Secret.

Note: these are available in the Settings -- Basic screen of your facebook developer account

Now a word about scopes -

The following scopes are discussed in the adapter documentation -

user_posts - Provides access to the posts on a person's Timeline. Includes their own posts, posts they are tagged in, and posts other people make on their Timeline. This permission is restricted to a limited set of partners and usage requires prior approval by Facebook.

user_likes - Grants an app permission to access the list of all Facebook Pages that a person has liked.

publish_actions - this has been deprecated - thanks to Cambridge Analytica

see the following Facebook link

You can check out all the Facebook permissions here

Specify the following scopes for this use case -

You Provide Consent as follows -

Facebook grants access -

Test then Save the Connection

Create a second connection REST -- Trigger

Create the Integration

You will use a REST Trigger for this orchestration.

Drag and Drop your REST Trigger on the Start area.

Configure as follows -

Set the Request to

Now drop the Invoke - Facebook Connection, after GetFBPageData

Configure as follows -

Note that we are using the facebook graph api under the hood.

Now drop the Facebook connection again, after GetPageDetails and configure as follows -

Map as follows -

Now map the return values -

Set Tracking then Save and Close

Activate -

Test -

We need the page id - simply open your new FB page in a browser -

What I've blacked out in the URL above is the page id.

You will need this when testing.

Add a Post to the page, before you test - this is what we will retrieve via OIC.

I just added a simple - "Hi There".

I use Postman for testing -

Tuesday, August 14, 2018

#647 OIC Insight REST API

I have already done some introductory posts on Insight.
I suggest you review them now, if you are unfamiliar with this component of OIC.

Introduction to Insight in OIC - click here

Introduction to Insight - click here

The first post mentioned covers instrumenting an OIC Integration for Insight.
Essentially, I map certain Invokes in the integration to Insight Milestones.

But what happens I want to instrument a business process for Insight?
Currently Oracle does not provide such a mapper.

What we can use though is the Insight REST API.

Here is a simple example -

My integration processes an order and then calls a business process to do the necessary human approvals.

The integration is as follows -

The processing logic is very simple -
1. Check if the customer exists
2. If the customer does not exists, send the order for fraud investigation
3. If the customer is kosher, then create the Order in the ERP system and call a business process
to do the human approvals necessary.

The business process is as follows -

Bear with me for a while on the black boxes!

The logic is very simple -
1. Orders for €100 or less are auto-approved.
2. Larger orders are sent for human approval
3. Rejected orders are reviewed by a manager

So now to the model that will give us insight in to what is going on here -

Milestones 1 to 3 will be set via the integration.
Milestones 4 to 8 will be set via the business process.

The business process will call a separate integration that will leverage the Insight API
to update the milestones for a particular order.

Let's look at how simple it is -

I just checked the checkbox.
I see the actual url and payload, when I click on the info icon.

So we have this generic event operation -
The payload is as follows -

  "modelId" : "NCOrderProc_i4dFFzz8",
  "correlationValue" : "",
  "milestoneId" : "OrderAutoApproved",
  "eventTime" : ""

You see the modelId value, which specifies the Insight model I want to use.
The correlationValue is a unique key that can be used to identify this order as it moves through the
integration and business process. In my case, the orderNr field.
The milestoneId identifies the milestone I want to update for this particular order.

The eventTime is optional, so I will let Insight take care of that.

I now test this REST request using Postman -

Note the response -

    "type": "ok",
    "message": ""

I now create a new integration that calls this service -

The REST trigger request payload is as follows -

  "modelId" : "NCOrderProc_i4dFFzz8",
  "correlationValue" : "",
  "milestoneId" : "OrderAutoApproved"

I now return to my Process and "import" the integration -

I now leverage this in my process -

The black boxes are revealed.
Let's look at one of these tasks -

I now test, by executing the first integration -

Firstly, a look at the Insight dashboard before the test -

Now to the test - order nr 123011

I approve the order -

great stuff!

One can drill down from the Milestones summary to the individual orders -

We can also get a detailed view on individual order progress -

And while we're here...

Note the Last 5 Days timeframe.
How can we change this?

One can also define which milestones should be shown -