# SAP Marketing Cloud Export Integration SAP Marketing Cloud(旧Hybris Marketing)は、ユーザーデータを一元化されたハブに統合することで、個々の顧客と匿名の訪問者に関するリアルタイムのコンテキストベースのデータを提供するマーケティングソリューションです。これにより、ブランドは、マーケティングチャネルやデバイスに関係なく、カスタマージャーニー全体を通じて一貫性のある、コンテキストに沿った、関連性の高いエクスペリエンスを提供できます。このソリューションの機能には以下が含まれます: - Data Management — ブランドとやり取りする人々の360度のビューを提供し、リアルタイムで適切なコンテキストでターゲティングできるようにします。 - Recommendations — 顧客にタイムリーで非常に関連性の高い推奨事項を提供し、顧客の関心をコンバージョンに変換するのに役立ちます。 - Segmentation — リアルタイムで高性能なオーディエンスセグメンテーションを提供し、複数のチャネルにわたってパーソナライズされたキャンペーンを可能にします。 ## この統合で何ができますか? SAP Marketing Cloudは、エコシステム内の複数のサービスでOpen Data Protocol(OData)の原則に厳密に従っているため、以下が可能な柔軟なソリューションを構築できます: - OData Protocolを使用してSAP Marketing Cloud製品にデータをエクスポート、更新、削除します。 - SAP Marketing Cloudが提供するカスタムユースケースをサポートします [SAP Marketing Cloud - Integration APIs](https://help.sap.com/docs/SAP_MARKETING_CLOUD/0f9408e4921e4ba3bb4a7a1f75f837a7/672a497c82154a84bae6f62d63906339.md)。たとえば、以下のことができます: - Interaction Contactを特定のターゲットグループに割り当てる: 例: [SAP Marketing Cloud - Structure of OData Service API_MKT_TARGET_GROUP_SRV](https://help.sap.com/docs/SAP_MARKETING_CLOUD/0f9408e4921e4ba3bb4a7a1f75f837a7/aeff53478fc648ac817e5330e12b44d8.md) - 連絡先関係データを更新または作成する: 例: [SAP Marketing Cloud - Structure of OData Service API_MKT_CONTACTS](https://help.sap.com/docs/SAP_MARKETING_CLOUD/0f9408e4921e4ba3bb4a7a1f75f837a7/95f2c87395bb4dda905010423029c23e.md) - [SAP Marketing Cloud - API Hub](https://api.sap.com/package/SAPS4HANAMarketingCloud/all)にリストされている関連するインタラクションを組み込む ## 前提条件 - Treasure Data™の基本知識 - SAP Marketing Cloudの基本知識 - Open Data Protocolの基本知識 ## 要件と制限事項 - SAP通信ユーザーアカウント ## 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/](https://api-docs.treasuredata.com/en/overview/ip-addresses-integrations-result-workers/) ## TD Consoleを使用して接続を作成 Treasure Dataでは、クエリを実行する前にデータ接続を作成して設定する必要があります。データ接続の一部として、統合にアクセスするための認証を提供します。 ### 新しい認証を作成 1. **TD Console**を開きます。 2. **Integrations Hub** > **Catalog**に移動します。 3. **SAP Marketing Cloud**を検索して選択します。 ![](/assets/image2022-9-27_11-11-55.1582dca8722f3a6cd89167963bf76dfe31eacd3556fcaa6cd88745a4db929c77.e4797ce9.png) 1. **Create Authentication**を選択します。 ![](/assets/image2022-9-27_11-12-44.39756d395b1e53bfa81cf3c33f205e498b4197364d73eb3f660c958d7b1ca68d.e4797ce9.png) 1. 認証するための資格情報を入力します: ![image2022-7-21_5-12-0.png](/assets/image2022-7-21_5-12-0.f1f046ae02457ce5615b5871d68336069a0651061b59733a3b3240b0f43bfe3b.e4797ce9.png) | Parameter | Description | | --- | --- | | Username | SAP Marketing Cloud通信ユーザー名 | | Password | SAP Marketing Cloud通信ユーザーのパスワード | | Tenant ID | SAP Marketing CloudテナントID | 1. **Continue**を選択します。 2. 接続の名前を入力します。 3. **Done**を選択します。 ### クエリの定義 1. **Data Workbench > Queries**に移動します。 2. **New Query**を選択します。 3. クエリを入力します。 4. **Run**を選択してクエリを実行し、結果セットを検証します。 ![](/assets/image2022-9-27_11-21-50.123f940068e5d49a4d72e3600c65ddee494506182c6cfb9e82d94246125e3aa2.e4797ce9.png) ### 結果エクスポートターゲットの指定 1. **Export Results**を選択します。 ![](/assets/image2022-9-27_11-23-9.0ebf8dca9d15729528ea8782bc26c178939fb4e4a4e119418caf17244915781f.e4797ce9.png) 1. 出力に使用する外部サービスの既存の認証を選択するか、新しい認証を作成できます。以下のいずれかを選択します: **既存の統合を使用** ![](/assets/image2021-9-7_15-28-30.d271866c7c3cea4dab234b61bea815a69b186746c80435855b4b86d1f77cc30e.e4797ce9.png) **新しい統合を作成** ![](/assets/image2022-9-27_11-24-10.0a73fe3171b094e28f7eb3a3dce6feae830d49d76089768c845ec18b9ac8bded.e4797ce9.png) ![](/assets/image2022-9-27_11-26-3.73ab0f9461f044bbeaae35e0169cf83631c3d7bf8e3ead636c697ab6b325bb7e.e4797ce9.png) | Field | Description | | --- | --- | | Service Name | ターゲットSAP Marketing Cloudサービス名 | | Service Version | 使用するサービスのバージョン | | Target Type | 使用するターゲットタイプ: - Entity name - Custom path これは、選択したアクションに対してURLがどのように構築されるかに影響します。詳細については、[Appendix](/ja/int/sap-marketing-cloud-export-integration#appendix)を参照してください。 | | Entity Name | データをエクスポートするエンティティ | | Custom Path URL | リソース用のCustom Path URLテンプレート。 これは、標準のODataエンティティでは処理できない複雑なパスに必要です。このオプションは、screen-shot{{name}}—screen-shotの形式に従います。これは、名前が統合に転送された実際のデータ行に置き換えられることを意味します。 例: screen-shotTargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContactsscreen-shot | | Action | データに適用されるアクション- Create - Full Update - Partial Update - Delete - Upsert | | Batch Size | API呼び出しごとにエグレスするレコード数 | ### (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. ![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png) 4. In the drop-down, select one of the following schedule options: ![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png) | Drop-down Value | Description | | --- | --- | | Custom cron... | Review [Custom cron... details](#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. | | None | No schedule. | #### Custom cron... Details ![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png) | **Cron Value** | **Description** | | --- | --- | | `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 Value | Example | Example 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. ![](/assets/ouput.b2c7f1d909c4f98ed10f5300df858a4b19f71a3b0834df952f5fb24018a5ea78.8ebdf569.png) - 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 Columns**to 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**. ![](/assets/snippet-output-connector-on-audience-studio-2024-08-28.a99525173709da1eb537f839019fa7876ffae95045154c8f2941b030022f792c.8ebdf569.png) - 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](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation). ## (オプション)ワークフローでエクスポート結果を設定 Treasure Data Workflow内で、この統合を使用してデータをエクスポートすることを指定できます。 詳細については、[Using Workflows to Export Data with the TD Toolbelt](https://api-docs.treasuredata.com/en/tools/cli/api/#workflow-commands)をご覧ください。 ## (オプション)CLIを使用したエクスポート統合 TD ToolbeltをSAP Marketing Cloudへの結果エクスポートに使用することもできます。SAP Marketing Cloudへのエクスポート情報を、screen-shottd queryscreen-shotコマンドのscreen-shot--resultscreen-shotオプションとして指定する必要があります。screen-shottd queryscreen-shotの詳細については、[Query Commands](https://api-docs.treasuredata.com/en/tools/cli/api/#query-commands)を参照してください。 オプションの形式はJSONで、一般的な構造は次のとおりです。 ```yaml { "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 } ``` ### パラメータ | Name | Description | Value | Default Value | Required | | --- | --- | --- | --- | --- | | username | SAP Marketing Cloud通信ユーザー名 | | N/A | Yes | | password | SAP Marketing Cloud通信ユーザーのパスワード | | N/A | Yes | | tenant_id | SAP Marketing CloudテナントID | | N/A | No | | service_name | ターゲットSAP Marketing Cloudサービス名 | | N/A | Yes | | api_version | 使用するサービスのバージョン | | N/A | Yes | | target_type | 使用するターゲットタイプ | - entity_name - custom_path | entity_name | No | | custom_path_url | 複雑なパスに必要なリソース用のCustom path URLテンプレート | 例:- TargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContacts | | **target_type**が**custom_path**の場合はYes | | entity_name | データをエクスポートするエンティティ | | N/A | **target_type**が**entity_name**の場合はYes | | action | データに適用されるアクション | - create - update - partial_update - delete - upsert | | Yes | | batch_size | API呼び出しごとにフラッシュするレコード数 | | 1000 | No | | skip_invalid_records | 無効なレコードを無視するかどうかを示します | - true - false | true | No | | retry_limit | 各API呼び出しの最大再試行回数 | 数値 | 5 | No | | initial_retry_wait | 最初の再試行の待機時間(秒) | 数値 | 60 | No | | max_retry_wait | API呼び出しが諦める前の最大待機時間(秒) | 数値 | 120 | No | | connection_timeout_secs | API呼び出しごとの最大接続タイムアウト(秒) | 数値 | 120 | No | | read_timeout_secs | API呼び出しごとの最大読み取りタイムアウト(秒) | 数値 | 120 | No | | write_timeout_secs | API呼び出しごとの最大書き込みタイムアウト(秒) | 数値 | 120 | No | ### screen-shotentity_namescreen-shotケース 次の例では、target_typeとして**entity_name**を使用します。 ```bash 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ケース 次の例では、target_typeとして**custom_path**を使用します。 ```bash 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 ``` ## 付録 ### Entity Nameの決定方法 Entity Nameはさまざまな方法で取得できます。ここでは2つの例を示します: - Integration APIs Documentの使用 - Integration APIsの使用 この例では、API_MKT_CONTACT_SRVがターゲットサービスとして使用されます。 ### integrations APIs Document Integration APIs Documentを使用してデータを取得するには: 1. [SAP Marketing Cloud - Integration APIs](https://help.sap.com/docs/SAP_MARKETING_CLOUD/0f9408e4921e4ba3bb4a7a1f75f837a7/672a497c82154a84bae6f62d63906339.md)にアクセスして、利用可能なパブリックAPIを見つけます。 2. 対応するサービスのOData Service Structureに移動します(例: [Structure of OData Service API_MKT_CONTACTS](https://help.sap.com/docs/SAP_MARKETING_CLOUD/0f9408e4921e4ba3bb4a7a1f75f837a7/95f2c87395bb4dda905010423029c23e.md))。 構造、エンティティセット、およびサポートされる操作に関する関連情報がここで利用できます。 ### Integrations APIs **Integration APIs**を使用してデータを取得するには: 1. ターゲットサービスのscreen-shot$metadatascreen-shotエンドポイントを呼び出します。 ```bash 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. レスポンスドキュメントから、screen-shotEntityContainer Name="{TARGET_SERVICE}_Entities"screen-shotを見つけます。この例では、screen-shotEntityContainer Name="API_MKT_CONTACT_SRV_Entities"screen-shotになります。 ```xml ``` 2. 取り込みたいscreen-shotEntitySetscreen-shotを選択します。 3. screen-shotName=screen-shot引用符内のテキストをコピーします。 この名前はGUIで使用されます: 例: **Contacts**、**MarketingAreas**、**MarketingLocations**、**ContactOriginData**など。 ### Target Type ターゲットタイプは、選択したアクションに対してURLがどのように構築されるかに影響します。Target Typeには2つのオプションがあります: - Entity name - Custom path entity nameオプションを使用すると、URLのプレフィックスは、次のテンプレートを使用してscreen-shottenant_idscreen-shot、screen-shotservice_namescreen-shot、およびscreen-shotentity_namescreen-shotに基づいて構築されます: ``` https://{{tenant_id}}.s4hana.ondemand.com/sap/opu/odata/sap/{{service_name}}/{{entity_name}} ``` custom pathオプションを使用すると、URLのプレフィックスは、screen-shottenant_idscreen-shot、screen-shotservice_namescreen-shot、screen-shotcustom_path_urlscreen-shot、およびエクスポートされたデータに基づいて構築されます。custom pathは、エクスポートされたデータから提供された値を使用してscreen-shotcustom_path_urlscreen-shot内のタグを展開することによって構築されます。次に、共通のプレフィックスと組み合わされます。 ``` https://{{tenant_id}}.s4hana.ondemand.com/sap/opu/odata/sap/{{service_name}}/{{custom path} ``` たとえば、次のcustom_path設定を使用する場合: ``` target_type: custom_path tenant_id: my_tenant service_name: API_MKT_CONTACT_SRV custom_path_url: TargetGroups(guid'{{TargetGroupUUID}}')/TargetGroupInteractionContacts ``` 次のエクスポートされたデータを使用する場合: ``` InteractionContactUUID,TargetGroupUUID 00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001 ``` custom pathのURLエンドポイントは次のようになります: ``` https://my_tenant.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV/TargetGroups(guid'00000000-0000-0000-0000-000000000001')/TargetGroupInteractionContacts ```