How to import Contact Data via OData Services to S...
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.
Welcome to the blog post of the Expert Services Marketing Practice.
We are happy to share our experience with you around Marketing Integration, Analytics, and Business Technology.
You want to see more blogs from Expert Services? Click here
Overview
With this blog post we'll provide a step-by-step configuration guide on how to setup SAP Hybris Marketing Cloud to receive messages from SAP Cloud Platform Integration.
We'll go through the basic configuration steps and basic Iflow design and help you to understand how to use the available APIs on SAP Hybris Marketing Cloud.
This blog post does extend the existing documentation providing a examples and use cases, but does not replace or repeat information already documented in the official SAP API documentation.
Product version
For this Blog Post following product release version has been used.
SAP Hybris Marketing Cloud
Release: 1802
SAP Cloud Platform integration
Build number: 2.37.6
Note: Since we have short release cycles, the content in this blog post might look different from what you find on your SAP Hybris Marketing Cloud and SAP Cloud Platform Integration system. SAP Hybris Marketing Cloud: Quarterly release cycles SAP Cloud Platform Integration: Monthly release cycles
Scope (Contact API, Scenario)
In this blog post we cover E2E scenarios maintaining contact data using the Contact OData API described in the API documentation listed below.
Before using any API, read through the documentation and pay attention to the Notes and Caution callouts in the documentation on help.sap.com.
Review the supported HTTP Methods for the Entity Set you are planning to use.
Retrieve Contact Best Record from SAP Hybris Marketing
Entity Path - Contacts
The /Contacts entity allows us to retrieve Contact Best Records (or Golden Records) from the yMKT system.
Let's assume that the connected system, what is simulated with Postman, request a set of contacts from yMKT.
Get Contacts using OData Parameters
You can use the Odata Parameters supported by the Contact API as Query Strings as described in the help documentation.
For detailed information how to use Query Strings, refer to the Odata documentation.
From the Odata Service metadata you can see that the ContactUUID is a key and the type is Edm.Guid.
To form a successful GET request to retrieve a specific contact from the Contact API you need to provide the ContactUUID.
Configure a SAP Cloud Platform Integration IFlow
Logon to CPI and create a new Iflow.
Create a HTTP sender channel and configure the HTTP sender channel.
We did disable CSRF Protection to make testing easier.
Demo:
This demo shows the first steps to create a new custom Iflow and test receiving messages for processing.
Next, add a Request-Reply integration pattern and connect the Request-Reply service call to a receiver block.
Configure the receiver communication channel as Odata.
Note: The Integration Developer must make sure to from a valid query string. This highly depends on the implementation project and requirements, what parameters are used to pull contacts from the Contact API. We have selected a subset of the available query parameter and added the dynamic values using simple expressions.
When using Basic Authentication to connect to the Odata service, create a new credential artifact the holds the username and password.
Example IFlow
SAP Cloud Platform Integration Request Message
E-Mail with attachment
Example Requests and Replies
This section contains a couple example request and replies for:
/API_MKT_CONTACT_SRV;v=0002/Contacts
Get a specific contacts using the contact entry's UUID
Request
GET /sap/opu/odata/SAP/API_MKT_CONTACT_SRV;v=0002/Contacts?
$filter=Country eq 'DE' and DepartmentName eq 'Sales'
&$select=ContactUUID,FirstName,LastName,EmailAddress,PhoneNumber,MobileNumber,CorporateAccountName
&$top=10
&$format=json HTTP/1.1
Host: my000000.s4hana.ondemand.com
Create and Update a Contact Record on SAP Hybris Marketing Cloud
Entity Path - ContactsOriginData
The ContactsOriginData entity allows us to create or update contact data from a defined source system. Further, retrieve Contact data from a specific Contact Origin from the yMKT system.
An external system can create a new Contact on SAP Hybris Marketing using a defined Contact Origin
An external system can update an existing Contact on SAP Hybris Marketing using a defined Contact Origin
An external system can call the API to retrieve contacts data stored on Hybris Marketing for a specific Contact Origin like ERP Customer data, Hybris Consumer Data, or Twitter contact data.
Configure a SAP Cloud Platform Integration Iflow
We have built an example Iflow to cover the following scenarios:
The Iflow setup it pretty simple, most effort goes into defining the message mapping, to ensure we send a valid request message to SAP Hybris Marketing.
Demo: How to get the XML Schema file for the Message Mapping from the OData Adapter.
When to use what method?
When you implement your integration scenario you need to evaluate when to use what HTTP verb and provide a valid message.
Use PATCH/MERGE when you want to partially update contact record.
Use PUT when the contact record is a updated version of the existing contact record and you need to replace it.
Contact update with PATCH/MERGE
Next, we update the Contact with PATCH/MERGE.
Here, the sender system only provides the information to be updated on SAP Hybris Marketing.
Note: The examples shown here are describing the technical setup on how to import permission and subscription data and are performed on a test/demo system .
Example Iflow
Again, the main chuck of building the integration scenario is in the message mapping.
The configuration steps are same as for the other entities.
Example Requests
This section contains a couple example request and replies for:
API_MKT_CONTACT_SRV;v=0002/MarketingPermissions
Create Marketing Permission
The Contact must already exist in SAP Hybris Marketing to create/update Marketing Permissions or Subscriptions.
In this example the contact opts-out for being contacted via E-Mail.
Request
POST /http/esmkt/MarketingOdataApi/ContactMarketingPermission HTTP/1.1
Host: XXXXX-iflmap.avtsbhf.eu1.hana.ondemand.com
Content-Type: application/json
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The APIs provided provide a rich set of functionality and can be extended easily. Make sure to review the documentation before using the API and make yourself familiar using the APIs.
Useful documentation is referenced at the beginning of this blog post.
If you are still facing issues, you can always reach our to our Product Experts on the SAP Community.
the message mapping is not mandatory but most common in a scenario like this. Usually the sender systems provides the message in a different structure which needs to mbe mapped to the target structure.
In this scenario I simulated a sender system with Postman what provides a message different to the message structure expected form SAP Hybris Marketing.
If the sender provides the message in the correct structure the message can be send directly or just pass-through CPI.
Thanks for the nice blog!! . I have an upcoming project on hybris marketing cloud which will be integrated with hybris commerce. We need to push the customer master from hybris commerce to hybris marketing. Business will be using CPI as a integration between two hybris systems. Can you please let me know what all relevant settings needs to be done on CPI side for the success integration? Its a bit urgent if anyone can assist,
Thanks for the nice blog!! . I have an upcoming project on hybris marketing cloud which will be integrated with hybris commerce. We need to push the customer master from hybris commerce to hybris marketing. Business will be using CPI as a integration between two hybris systems. Can you please let me know what all relevant settings needs to be done on CPI side for the success integration? Its a bit urgent if anyone can assist,
I am working on a Hybris system on AWS provisioned through CAL. There is no data in the system. Since we are just trying to set up some test scenarios, is there some test data load files that are available?
Also, I am trying to create a contact in the system - I am using your example but I get the error:
When sending the request directly to the Contact API, the request payload needs to be presented in the accepted format by the service. When using CPI, the OData Adapter does the transformation in the adapter.
You find couple example on sap help documentation.
Once again - thanks for your excellent BLOG and help. It definitely helps to ensure that the SAP Hybris system has HTTPs set up correctly so that the csrf token functionality works as expected.