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.

This topic includes:

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


  • 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

The static IP address of Treasure Data is the access point and source of the linkage for this Integration. To determine the static IP address, contact your Customer Success representative or Technical support.

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 Cloud and select it.

4.  Select Create Authentication.

5. Enter the credentials to authenticate:


UsernameYour SAP Marketing Cloud communication username
PasswordYour SAP Marketing Cloud communication user's password
Tenant IDYour SAP Marketing Cloud tenant id
6. Select Continue
7. Enter a name for your connection.
8. 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.

2. 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

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 Name

Entity which you would like to export data to

Custom Path URL

Custom 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 {{name}} — which means that the name will be replaced by the actual data row you transferred to the integration. For example,  TargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContacts


The action will be applied to data

  • Create
  • Full Update
  • Partial Update
  • Delete
  • Upsert

Batch Size

Number 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.

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 Value


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.
5.  (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 imported to the specified container destination.

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

(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.

  database: td.database
  td>: export_{skjdhfglksjfhlkjdshflkgjhsflkgjhslfjdhgkljdshfkjsdhgkf}.sql
  database: ${td.database}
  result_connection: {dkfjheskrjhfljfhgdfhgldhflghdf}

(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 --result option of td query command. For more information about td query 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


NameDescriptionValueDefault ValueRequired


Your SAP Marketing Cloud communication username




Your SAP Marketing Cloud communication user's password




Your SAP Marketing Cloud tenant id




Target SAP Marketing Cloud service name


The version of service you would like to use



Target Type you would like to use
  • entity_name
  • custom_path
  • entity_name


Custom path URL template for resource required complicated path

For example:

  • TargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContacts

Yes if target_type is custom_path


Entity which you would like to export data to

N/AYes if target_type is entity_name


The action will be applied to data
  • create
  • update
  • partial_update
  • delete
  • upsert



Number of records to flush per API call


Indicates whether invalid records should be ignored
  • true
  • false


Maximum retry times for each API callNumeric value5No


Wait time for the first retry (in seconds)Numeric value60No


Maximum wait time for an API call before it gives up (in seconds)Numeric value120No


Max connection timeout per API call (in seconds)
Numeric value120No


Max read timeout per API call (in seconds)

Numeric value




Max write timeout per API call (in seconds)

Numeric value



Example for Usage 

entity_name 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

custom_path Case

The following example uses custom_path as 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


How To Determine Entity Name

Entity Name can 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 $metadata endpoint of target service.

    curl --location --request GET 'https://{tenant}$metadata' \ 
    --header 'x-csrf-token: Fetch' \ 
    --header 'Authorization: Basic {encode_base_64(username:password)}'
  2. From the response documents, find the EntityContainer Name="{TARGET_SERVICE}_Entities" . In this example, this will be EntityContainer Name="API_MKT_CONTACT_SRV_Entities".

    <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"/>
  3. Choose the EntitySet you would like to ingest.
  4. Copy the text inside the Name= 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 tenant_id, service_name, and entity_name with following template:


Using the custom path option, the prefix of the URL will be built based on tenant_id, service_name, and custom_path_url, and exported data. The custom path is built by expanding tags in a custom_path_url using values provided from the exported data. Then, it is combined with the common prefix.

https://{{tenant_id}}{{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:


The URL endpoint for the custom path would be:'00000000-0000-0000-0000-000000000001')/TargetGroupInteractionContacts

  • No labels