CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
Showing results for 
Search instead for 
Did you mean: 
Former Member
In Open Channel Campaign with Facebook Messenger Part2 step 3, we defined an integration flow named OC_FBMSG_MU in Hybris Marketing communication agreement Processing sector.

By using this integration flow, we will transform the Hybris Marketing open channel campaign payload(Part2 step7) to facebook messenger send API payload(Part1 step3), and send it to relevant facebook messenger users.

Payload transform image:

Now let's take a deep look at the integration flow.

(1) HTTPS call: Create start message with Hybris Marketing open channel campaign payload

Address: /OC_FBMSG_MU

Authorization: User Role

User Role: ESBMessaging.send

(2) Router: Filter the HTTP call by request method

This integration flow will be called twice from Hybris Marketing side with request method HEAD and POST, only the POST method will contain the necessary payload.

As HCI is based on Apache Camel Framework, we will use header property CamelHttpMethod to condition the route.

・Route POST:

Name: POST

Expression Type: Non-XML

Condition: ${header.CamelHttpMethod} = 'POST'


・Route Other:  Check on Default Route.

(3) Content Modifier1: Create two header properties in order to run the Looping Process Call

At this time there is no build in facebook messenger send API to allow you to send messages to multiple users at a single time, so we have to use Looping Process Call to iterate over the users in open channel campaign payload and call the API multiple times.

In order to accomplish this looping, we have to add two header properties:

endProcess: initiate with value 'false',  a String flag which indicates whether or not the looping should be stopped.

processNumber: Initiate with value '0', a String value which indicates the current processing campaign user position in the payload.

(4) Looping Process Call: Looping local integration process 'Call FB API'

Local Integration Process: Process_11( Local integration process 'Call FB API')

Expression Type: Non-XML

Condition Expression: ${header.endProcess} = 'false'

The looping process call will keep running until endProcess is set to true in Script.

Max. Number of Iterations: Default value 100 in our sample


Local integration Process 'Call FB API'

(5) Groovy script: Core process to transform the payload format

We will use groovy script to tranform Hybris Marketing open channel campaign payload to facebook messenger send API payload, this is the core part of the whole process.

Please contact SAP Hybris Expert Services Marketing Practice team if you need a sample code.

(6) Content Modifier2: Create Content-Type header property

A header property Content-Type with value application/json is mandatory when using the facebook messenger send API, we will add this property here.

This step can also be defined in groovy script in step5.

(7) Request-Reply: Use HTTP adapter to call the facebook messenger send API


Query: access_token={Facebook page access token created in Part1 step2}

Proxy Type: Internet

Method: POST

Authentication: None

Timeout(in ms): 60000 in our sample

Now have a try to start the facebook messenger open channel campaign in Hybris Marketing, you should be able to receive the first campaign message from Hybris Marketing in your facebook messenger app or web UI.

You want to see more? Check out our blogs by searching for the tags assigned to this blog.

Your SAP Hybris Expert Services Marketing Practice team.