In SAP HCI – Facebook Integration – Part 1 we saw how to obtain Facebook Connectivity artifacts and add it to SAP HCI Secure Parameters. In this blog I will show how to configure Facebook adapter to read post and comments.
I have developed a simple Integration flow to be triggered every one hour. The Request-Reply service call branch will invoke Facebook endpoint and send the Message body as email.
Get Posts Endpoint Configuration:
This producer endpoint will return posts(/feeds) from a User or Page. In the example I will show how to read feed from a User page. Configure the receiver channel as below.
1. Choose Endpoint as Get Posts.
2. User / Page ID: This parameter is filled with the User ID copied from the App created in previous blog Step-6.
3. OAuth Settings parameters in the channels will refer the Secure Parameters artifact names created in the previous steps.
This service call returns result as facebook4j.ResponseList<facebook4j.Post> object as message body.Below is an example payload from demo scenario.
This above message response can be read using a Groovy Script which I will cover in next blog.
Get Post Comments Endpoint Configuration:
This provider endpoint will retrieve all the comments of requested post. It requires a Post ID as Channel Parameter which is retrieved in Get Posts producer endpoint. Below is receiver channel configuration.
1. Select Endpoint as Get Posts Comment.
2. Set the Post ID. (Note: In next blog we will see how to read from facebook4j.Post using Groovy Script and set in the channel)
3. OAuth Settings parameters in the channels will refer to the respective Secure Parameters artifact.
(Note : For Demo purpose Post ID is hard coded to read the comment using the same Integration Flow)
This service call returns result as facebook4j.ResponseList<facebook4j.Comment> object as message body. Below is an example payload from demo scenario.