Skip to Content
Technical Articles

Third Party Landing Page Data Integration with SAP Marketing Cloud. Using the extensibility function to inject MarketingAreas to the Contact.

Hello Integrators!

SAP recently published the Third Party Landing Page Data Integration with SAP Marketing Cloud CPI Package. It includes a great Integration Flow with an API that lets you combine new contacts and interactions in the same flow. This is great, because, before, you needed to send several requests to create interactions and contacts from landing pages.

More details and information on how to use the iFlow: https://api.sap.com/package/ThirdPartyLandingPageDataIntegrationwithSAPMarketingCloud?section=Overview

Our use case for this is the integration of newsletters from a third party. We used to use a custom API with the CPI. Unfortunately, we didn’t have the ability to add a MarketingArea in the Payload that connects to the ContactOriginData, so we used the extensibility of the iFlow to add this feature.

Create a new I flow with a Process Direct Input

The path that you choose in the ProcessDirect adapter is the path to this flow and will be needed for the configuration of the SAP provided flow.

There is a header with the name PostedPayload. This is the original payload that came in the Create Landing Page Data in SAP Marketing Cloud Flow. Alternatively you can use the MappedPayload header. This is the Batch Payload that is created from the data. The one you choose depends on your use case.

In our use case I copied the script that creates the batch from the original flow and modified it to add Marketing Areas. You can add this source code:

   //If MarketingAreas are existing iterate over each
    contact.MarketingAreas.each { area ->
        if(area != "") {
            
            //Marketing Area is a mandatory field within the ODATA Metadata. However it could be sent EMPTY which denotes MarketingArea is not enabled in the backend and accepted.
            if (area.InteractionContactMktgArea == null) {
                throw new NullPointerException("No Marketing Area");
               
            }
             marketingArea = area.InteractionContactMktgArea;
            def marketingAreaBatchPart = new XmlSlurper().parseText("<batchChangeSetPart><method>PUT</method><headers><header><headerName>Sap-Cuan-ForceSynchronousProcessing</headerName><headerValue>X</headerValue></header></headers><uri>MarketingAreas(ContactID='${contactID}',ContactOrigin='${contactOrigin}',InteractionContactMktgArea='${marketingArea}')</uri><MarketingAreas><MarketingArea><ContactOrigin>${contactOrigin}</ContactOrigin></MarketingArea></MarketingAreas></batchChangeSetPart>");
            

        
            //marketingAreaBatchPart.MarketingPermissions.MarketingPermission.appendNode(area.getBody());
            contactPermissionBatchPayload.batchChangeSet.appendNode(marketingAreaBatchPart);    
        }
    };
    
     contact.MarketingAreas.replaceNode {};

To this script:

at line 146

Save and deploy!

Configure the Create Landing Page Data in SAP Marketing Cloud Flow to use this additional Flow

You can do this pretty easily in the configuration of this flow:

Choose an Address for the ExtensibilityFlow Receiver and change 0 to 1 under More -> Batch_Payload_Extensibility

 

3. Use Postman to check our results.

This could be an example payload. Don’t forget your Basic Auth Token in the Header.

{
    "Contact": {
        "ContactID": "xxtest8@xxxxx.de",
        "ContactOrigin": "NEWSLETTER_MASPBW",
        "FirstName": "Haino",
        "LastName": "Hallo",
        "BirthDate": "1977-08-12",
        "EmailAddress": "xxtest8@xxxxx.de",
        "PhoneNumber": "+4912312456781231239",
        "MobileNumber": "+4998127654123123321",
        "Country": "DE",
        "CityName": "Walldorf",
        "StreetName": "Dietmar-Hopp-Allee",
        "AddressHouseNumber": "20",
        "GenderCode": "1",
        "ContactPostalCode": "24105",
        "IsConsumer": true,
        "MarketingPermissions": [
            {
                "ContactPermissionID": "xxtest8@xxxxx.de",
                "ContactPermissionOrigin": "EMAIL",
                "MarketingArea": "Area1",
                "CommunicationMedium": "EMAIL",
                "CommunicationCategory": "40",
                "ContactPermission": "Y",
                "PermissionUTCDateTime": "2019-01-11T07:09:35",
                "CommunicationDirection": "O",
                "PermissionSourceSystem": "SYSTEM",
                "PermissionIsExplicit": true,
                "IsConfirmationRequired": true
            }
        ],
        "MarketingAreas": [
            {
                "InteractionContactMktgArea": "Area1"
            }
        ],
        "Interactions": [
            {
                "CommunicationMedium": "WEB",
                "InteractionType": "WEBSITE_VISIT",
                "InteractionTimeStampUTC": "2018-03-06T12:12:26",
                "SourceSystemType": "COM",
                "SourceSystem": "SAP_MERCH_SHOP",
                "MarketingArea": "Area1",
                "InteractionContent": "2018-03-28 Interaction Product Test 01",
                "InteractionInterests": [
                    {
                        "ItemOfInterest": "FUSSBALL",
                        "InteractionIntrstWeightingFctr": 1,
                        "InteractionIntrstSentimentVal": 1
                    }
                ]
            }
        ]
    }
}

You can find the url at Overview -> Manage Integration content.

Find further general details on the HTTP-Adapter *here*

You can see the Customer in the Inspect Contact Tile in SAP Marketing Cloud with the Marketing Area.

All in all the extensibility option of the standard flow is a very good option and I would like to see this more often in Standard SAP flows, because when you change something in the Original IFlows, there is no option anymore to get any updates.

Bcause it would be nice to have this feature native and not as a workaround I added a feature request. It would be nice if you could vote for it if you find it helpful:

https://influence.sap.com/sap/ino/#/idea/225651

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.