Skip to content
Last updated

SAP Marketing Cloud Export Integration

SAP Marketing Cloud (previously Hybris Marketing) is a marketing solution that provides real-time, context-based data about individual customers and anonymous visitors by unifying user data into a centralized hub. This allows brands to deliver consistent, contextual, and relevant experiences throughout a customer journey, regardless of the marketing channel or device. Some of the features of this solution are

  • Data Management — provides a 360 degree view of people interacting with your brand, enabling you to target them in the right context in real-time.
  • Recommendations — deliver timely and highly relevant recommendations to your customers, helping you translate customer interest into conversion.
  • Segmentation — offers high-performing audience segmentation in real-time enabling you to personalized campaigns across multiple channels.

What can you do with this Integration?

As SAP Marketing Cloud strictly follows the Open Data Protocol (OData) principles with multiple services in their ecosystems, you can build a flexible solution which can

Prerequisites

  • Basic Knowledge of Treasure Data™.
  • Basic Knowledge of SAP Marketing Cloud.
  • Basic Knowledge of Open Data Protocol.

Requirements and Limitations

  • SAP communication user account

Static IP Address of Treasure Data Integration

If your security policy requires IP whitelisting, you must add Treasure Data's IP addresses to your allowlist to ensure a successful connection.

Please find the complete list of static IP addresses, organized by region, at the following link:
https://api-docs.treasuredata.com/en/overview/ip-addresses-integrations-result-workers/

Use the TD Console to Create a Connection

In Treasure Data, you must create and configure the data connection prior to running your query. As part of the data connection, you provide authentication to access the integration.

Create a New Authentication

  1. Open TD Console.

  2. Navigate to Integrations Hub > Catalog.

  3. Search for SAP Marketing Cloudand select it.

  1. Select Create Authentication.

  1. Enter the credentials to authenticate:

image2022-7-21_5-12-0.png

ParameterDescription
UsernameYour SAP Marketing Cloud communication username
PasswordYour SAP Marketing Cloud communication user's password
Tenant IDYour SAP Marketing Cloud tenant id
  1. Select Continue.

  2. Enter a name for your connection.

  3. Select Done.

Define your Query

  1. Navigate to Data Workbench > Queries.

  2. Select New Query.

  3. Enter your query.

  4. Select Run to perform the query and to validate the result set.

Specify the Result Export Target

  1. Select Export Results.

  1. You can select an existing authentication or create a new authentication for the external service to be used for output. Choose one of the following:

Use Existing Integration

Create a New Integration

Field Description
Service NameTarget SAP Marketing Cloud service name
Service VersionThe version of service you would like to use

Target Type

Target Type you would like to use:

  • Entity name
  • Custom path

This will affect how the URL is built for the chosen action. See the Appendix for more detail.

Entity NameEntity which you would like to export data to
Custom Path URLCustom Path URL template for resource.
This is required for complicated paths which could not be handled by a standard OData entity. This option follows the format of screen-shot{{name}}—screen-shot which means that the name will be replaced by the actual data row you transferred to the integration.
For example, screen-shotTargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContactsscreen-shot
ActionThe action will be applied to data
  • Create
  • Full Update
  • Partial Update
  • Delete
  • Upsert
Batch SizeNumber of records to egest per API call.

(Optional) Schedule Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

Treasure Data's scheduler feature supports periodic query execution to achieve high availability.

When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.

For example, if the cron schedule is '0 0 1 * 1', then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.

Scheduling your Job Using TD Console

  1. Navigate to Data Workbench > Queries

  2. Create a new query or select an existing query.

  3. Next to Schedule, select None.

  4. In the drop-down, select one of the following schedule options:

    Drop-down ValueDescription
    Custom cron...Review Custom cron... details.
    @daily (midnight)Run once a day at midnight (00:00 am) in the specified time zone.
    @hourly (:00)Run every hour at 00 minutes.
    NoneNo schedule.

Custom cron... Details

Cron ValueDescription
0 * * * *Run once an hour.
0 0 * * *Run once a day at midnight.
0 0 1 * *Run once a month at midnight on the morning of the first day of the month.
""Create a job that has no scheduled run time.
 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)

The following named entries can be used:

  • Day of Week: sun, mon, tue, wed, thu, fri, sat.
  • Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.

A single space is required between each field. The values for each field can be composed of:

Field ValueExampleExample Description
A single value, within the limits displayed above for each field.
A wildcard '*' to indicate no restriction based on the field.'0 0 1 * *'Configures the schedule to run at midnight (00:00) on the first day of each month.
A range '2-5', indicating the range of accepted values for the field.'0 0 1-10 * *'Configures the schedule to run at midnight (00:00) on the first 10 days of each month.
A list of comma-separated values '2,3,4,5', indicating the list of accepted values for the field.0 0 1,11,21 * *'Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month.
A periodicity indicator '*/5' to express how often based on the field's valid range of values a schedule is allowed to run.'30 */2 1 * *'Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. '0 0 */5 * *' configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month.
A comma-separated list of any of the above except the '*' wildcard is also supported '2,*/5,8-10'.'0 0 5,*/10,25 * *'Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month.
  1. (Optional) You can delay the start time of a query by enabling the Delay execution.

Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination.

Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.

(Optional) You can delay the start time of a query by enabling the Delay execution.

Activate a Segment in Audience Studio

You can also send segment data to the target platform by creating an activation in the Audience Studio.

  1. Navigate to Audience Studio.
  2. Select a parent segment.
  3. Open the target segment, right-mouse click, and then select Create Activation.
  4. In the Details panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
  5. Customize the activation output in the Output Mapping panel.

  • Attribute Columns
    • Select Export All Columns to export all columns without making any changes.
    • Select + Add Columns to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select + Add Columnsto add new columns for your activation output.
  • String Builder
    • + Add string to create strings for export. Select from the following values:
      • String: Choose any value; use text to create a custom value.
      • Timestamp: The date and time of the export.
      • Segment Id: The segment ID number.
      • Segment Name: The segment name.
      • Audience Id: The parent segment number.
  1. Set a Schedule.

  • Select the values to define your schedule and optionally include email notifications.
  1. Select Create.

If you need to create an activation for a batch journey, review Creating a Batch Journey Activation.

(Optional) Configure Export Results in Workflow

Within Treasure Data Workflow, you can specify the use of this integration to export data.

Learn more at Using Workflows to Export Data with the TD Toolbelt.

(Optional) Export Integration Using the CLI

You can also use the TD Toolbelt for Result Export to SAP Marketing Cloud. You need to specify the information for export to SAP Marketing Cloud as screen-shot--resultscreen-shot option of screen-shottd queryscreen-shot command. For more information about screen-shottd queryscreen-shot see Query Commands.

The format of the option is JSON and the general structure is as follows.

{
  "type": "sap_marketing_cloud",
  "username": "user",
  "password": "pass}HrNAJE",
  "tenant_id": "mytenant",
  "service_name": "API_MKT_INTERACTION_SRV",
  "target_type": "entity_name",
  "api_version": null,
  "entity_name": "InteractionTags",
  "action": "create",
  "batchSize": 1000
}

Parameters

Name Description Value Default Value Required
usernameYour SAP Marketing Cloud communication usernameN/AYes
passwordYour SAP Marketing Cloud communication user's passwordN/AYes
tenant_idYour SAP Marketing Cloud tenant idN/ANo
service_nameTarget SAP Marketing Cloud service nameN/AYes
api_versionThe version of service you would like to useN/AYes
target_typeTarget Type you would like to use
  • entity_name
  • custom_path
entity_nameNo
custom_path_urlCustom path URL template for resource required complicated pathFor example:
  • TargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContacts
Yes if target_type is custom_path
entity_nameEntity which you would like to export data toN/AYes if target_type is entity_name
actionThe action will be applied to data
  • create
  • update
  • partial_update
  • delete
  • upsert
Yes
batch_sizeNumber of records to flush per API call1000No
skip_invalid_recordsIndicates whether invalid records should be ignored
  • true
  • false
trueNo
retry_limitMaximum retry times for each API callNumeric value5No
initial_retry_waitWait time for the first retry (in seconds)Numeric value60No
max_retry_waitMaximum wait time for an API call before it gives up (in seconds)Numeric value120No
connection_timeout_secsMax connection timeout per API call (in seconds)Numeric value120No
read_timeout_secsMax read timeout per API call (in seconds)Numeric value120No
write_timeout_secsMax write timeout per API call (in seconds)Numeric value120No

screen-shotentity_namescreen-shot Case

The following example uses entity_name as target_type.

td query \
  --result '{
    "type": "sap_marketing_cloud",
    "username": "user",
    "password": "pass",
    "tenant_id": "mytenant",
    "service_name": "API_MKT_INTERACTION_SRV",
    "api_version": null,
    "entity_name": "InteractionTags",
    "action": "create",
    "batchSize": 1000
  }' \
  -d sample_datasets \
  "SELECT * FROM interactiontags" \
  -T presto

screen-shotcustom_pathscreen-shot Case

The following example uses custom_pathas target_type.

td query \
  --result '{
    "type": "sap_marketing_cloud",
    "username": "user",
    "password": "pass",
    "tenant_id": "mytenant",
    "service_name": "API_MKT_TARGET_GROUP_SRV",
    "action": "create",
    "target_type": "custom_path",
    "custom_path_url": "TargetGroups(guid'\''{{TargetGroupUUID}}'\'')/TargetGroupInteractionContacts",
    "batch_size": 1000
  }' \
  -d sample_datasets \
  "SELECT * FROM targetGroupinteractioncontacts" \
  -T presto

Appendix

How To Determine Entity Name

Entity Namecan be retrieved in various ways. Here are two examples

  • Using Integration APIs Document
  • Using Integration APIs

In this example, API_MKT_CONTACT_SRV is used as the target service.

integrations APIs Document

To retrieve data using Integration APIs Document:

  1. Go to SAP Marketing Cloud - Integration APIs to find public APIs available.
  2. Go to OData Service Structure for the corresponding service (e.g. Structure of OData Service API_MKT_CONTACTS).

Related information about the structures, entity sets, and supports operations is available here.

Integrations APIs

To retrieve data using Integration APIs:

  1. Call the screen-shot$metadatascreen-shot endpoint of target service.
curl --location --request GET \
  'https://{tenant}.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV/$metadata' \
  --header 'x-csrf-token: Fetch' \
  --header 'Authorization: Basic {encode_base_64(username:password)}'
  1. From the response documents, find the screen-shotEntityContainer Name="{TARGET_SERVICE}_Entities"screen-shot . In this example, this will be screen-shotEntityContainer Name="API_MKT_CONTACT_SRV_Entities".screen-shot

    <EntityContainer
      Name="API_MKT_CONTACT_SRV_Entities"
      m:IsDefaultEntityContainer="true"
      sap:supported-formats="atom json xlsx pdf">
      <EntitySet
        Name="MarketingAreas"
        EntityType="API_MKT_CONTACT_SRV.MarketingArea"
        sap:creatable="false"
        sap:deletable="false"
        sap:content-version="4"/>
      <EntitySet
        Name="MarketingLocations"
        EntityType="API_MKT_CONTACT_SRV.MarketingLocation"
        sap:creatable="false"
        sap:deletable="false"
        sap:content-version="4"/>
      <EntitySet
        Name="Contacts"
        EntityType="API_MKT_CONTACT_SRV.Contact"
        sap:creatable="false"
        sap:updatable="false"
        sap:deletable="false"
        sap:content-version="4"/>
      <EntitySet
        Name="ContactOriginData"
        EntityType="API_MKT_CONTACT_SRV.ContactOriginData"
        sap:creatable="false"
        sap:deletable="false"
        sap:content-version="4"/>
    </EntityContainer>
  2. Choose the screen-shotEntitySetscreen-shot you would like to ingest.

  3. Copy the text inside the screen-shotName=screen-shot quotations marks.
    This name will be used in the GUI: e.g. Contacts, MarketingAreas, MarketingLocations, ContactOriginData, etc.

Target Type

Target types affect how the URL is built for chosen action. There are two options for Target Type:

  • Entity name
  • Custom path.

Using the entity name option, the prefix of the URL will be built based on screen-shottenant_idscreen-shot, screen-shotservice_namescreen-shot, and screen-shotentity_namescreen-shot with following template:

https://{{tenant_id}}.s4hana.ondemand.com/sap/opu/odata/sap/{{service_name}}/{{entity_name}}

Using the custom path option, the prefix of the URL will be built based on screen-shottenant_idscreen-shot, screen-shotservice_namescreen-shot, and screen-shotcustom_path_urlscreen-shot, and exported data*.* The custom path is built by expanding tags in a screen-shotcustom_path_urlscreen-shot using values provided from the exported data. Then, it is combined with the common prefix.

https://{{tenant_id}}.s4hana.ondemand.com/sap/opu/odata/sap/{{service_name}}/{{custom path}

For example, with the following custom_path configuration:

target_type: custom_path
tenant_id: my_tenant
service_name: API_MKT_CONTACT_SRV
custom_path_url: TargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContacts

And using the following exported data:

InteractionContactUUID,TargetGroupUUID
00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001

The URL endpoint for the custom path would be:

https://my_tenant.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV/TargetGroups(guid'00000000-0000-0000-0000-000000000001')/TargetGroupInteractionContacts