cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Real-Time Sales Data Integration with Emarsys Predict Using SAP Integration Suite

Ankit_Kanungo_057
Discoverer
743

This blog explores how SAP Integration Suite can be used to send real-time sales data from a commerce system to Emarsys Predict Data Source, enabling Smart Insights to function seamlessly. We'll walk through the integration flow, highlight key and payload structures.

Business Scenario

Let’s consider a retail brand, which wants to send real-time online sales data to Emarsys for Smart Insights. The goal is to capture customer purchase behavior immediately after a transaction and feed it into Emarsys Predict.

Architecture Overview

The integration flow involves:

  1. Source System: Commerce platform generating sales orders.
  2. SAP Integration Suite: Middleware to transform and route data.
  3. Emarsys Predict API: Destination for real-time transactional data.

Ankit60_0-1753336342476.png

Integration Flow:

Ankit60_1-1753336525813.png

In our integration flow (iFlow), we implemented a real-time sales data pipeline to Emarsys Predict using SAP Integration Suite. Here's a high-level overview of the steps involved, which can be customized based on specific business requirements:

  1. JSON to XML Conversion:
    We began by adding a JSON to XML Converter, setting the root element as "salesOrder" to structure the incoming data appropriately.

    Ankit60_2-1753342762948.png
  2. Message Mapping:
    A Message Mapping step was introduced where we:

    • Uploaded the input.XSD (representing the incoming XML structure).
    • Uploaded the output.XSD (representing the desired XML format for Emarsys).
    • Applied necessary node functions and custom functions to transform the data.
    • Mapped key fields such as Email and Order ID, using "one as many" logic to loop through order items.Ankit60_3-1753342807964.png
  3. XML to CSV Conversion:
    The transformed XML was then passed through an XML to CSV Converter.

    Ankit60_4-1753342837440.png
  4. Content Modifier & API Call:
    We used a Content Modifier to add the required CSV headers, followed by a Request-Reply step to send the final payload to the Emarsys Sales API.

    Ankit60_5-1753342908637.png

    Request Reply - HTTP Adapter Configuration:

    Ankit60_6-1753342998193.png

Emarsys Sales API Details: Uploading your sales data 

 Sample Input Payload:

{
    "user": "RetailStore",
    "id": "403509910",
    "transType": "SALES_ORDER",
    "transDate": "20230524",
    "transTime": "12:41:56+00:00",
    "marketingArea": "STORE",
    "storeId": "store_gb",
    "totalSalesAmount": 208.0,
    "salesCurrency": "GBP",
    "customerId": "uk.user3@gmail.com",
    "discountPercent": 0.0,
    "discountAmount": 0.0,
    "totalDiscounts": 0.0,
    "promotionDiscounts": 0.0,
    "communicationMedium": "Online",
    "deliveryCost": 0.0,
    "deliveryType": "",
    "deliveryPostalCode": "",
    "deliveryCity": "",
    "deliveryCountry": "",
    "items": [
        {
            "productId": "PROD001",
            "totalPrice": 160.00,
            "unitPrice": 20.0,
            "quantity": 8,
            "discountLineAmount": 0.0,
            "discountLinePercent": 0.0,
            "promotionName": "SAMPLECODE-100-200-300-400-500",
            "promotionCode": "SAMPLECODE-100-200-300-400-500",
            "salesAmount": 160.00
        },
        {
            "productId": "PROD001",
            "totalPrice": 0.00,
            "unitPrice": 0.0,
            "quantity": 1,
            "discountLineAmount": 0.0,
            "discountLinePercent": 0.0,
            "promotionName": "SAMPLECODE-100-200-300-400-500",
            "promotionCode": "SAMPLECODE-100-200-300-400-500",
            "salesAmount": 0.00
        }
    ]
}

This setup ensures seamless and real-time data flow from your source system to Emarsys Predict. The iFlow can be easily modified to accommodate different data structures or business logic as needed. 

Accepted Solutions (0)

Answers (0)