使用自訂動作在 Experience Platform 中編寫歷程事件 custom-action-aep

在此頁面上:​瞭解如何使用自訂動作和已驗證的API呼叫,將自訂歷程事件從歷程寫入Adobe Experience Platform。

此使用案例說明如何使用自訂動作和已驗證的呼叫,將自訂事件從歷程寫入Adobe Experience Platform。

設定開發人員專案 custom-action-aep-IO

  1. 在Adobe Developer Console中,按一下​ 專案 ​並開啟您的IO專案。

  2. 在​ 認證 ​區段中,按一下​OAuth伺服器對伺服器

    具有動作型別下拉式清單的自訂動作設定畫面

  3. 按一下​檢視cURL命令

    Adobe Experience Platform動作型別選擇

  4. 複製cURL命令並儲存client_id、client_secret、grant_type和scope。

curl -X POST 'https://ims-na1.adobelogin.com/ims/token/v3' -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=client_credentials&client_id=1234&client_secret=5678&scope=openid,AdobeID,read_organizations,additional_info.projectedProductContext,session'
CAUTION
在Adobe Developer Console上建立專案後,請務必授予具有正確許可權的開發人員和API存取控制。 在Adobe Experience Platform 檔案中進一步瞭解

使用HTTP API入口設定來源

  1. 在Adobe Experience Platform中建立端點以寫入歷程中的資料。

  2. 在Adobe Experience Platform中,按一下左側功能表中​ 連線 ​下的​來源。 在​ HTTP API ​下,按一下​新增資料

    Adobe Experience Platform 🔗 的沙箱選取下拉式清單

  3. 選取​ 新帳戶 ​並啟用驗證。 選取​連線至Source

    串流資料的資料集選擇介面

  4. 選取​ 下一步 ​以及您要寫入資料的資料集。 按一下​ 下一步 ​和​完成

    XDM結構描述欄位對應到動作引數

  5. 開啟新建立的資料流。 複製結構描述承載並將其儲存在記事本中。

{
"header": {
"schemaRef": {
"id": "https://ns.adobe.com/<your_org>/schemas/<schema_id>",
"contentType": "application/vnd.adobe.xed-full+json;version=1.0"
},
"imsOrgId": "<org_id>",
"datasetId": "<dataset_id>",
"source": {
"name": "Custom Journey Events"
}
},
"body": {
"xdmMeta": {
"schemaRef": {
"id": "https://ns.adobe.com/<your_org>/schemas/<schema_id>",
"contentType": "application/vnd.adobe.xed-full+json;version=1.0"
}
},
"xdmEntity": {
"_id": "test1",
"<your_org>": {
"journeyVersionId": "",
"nodeId": "", "customer_Id":""
},
"eventMergeId": "",
"eventType": "",
"producedBy": "self",
"timestamp": "2018-11-12T20:20:39+00:00"
}
}
}

設定自訂動作 custom-action-config

自訂動作設定在此頁面上詳細說明。

在此範例中,請遵循下列步驟:

  1. 開啟Adobe Journey Optimizer,然後按一下左側功能表中​ 管理 ​下的​組態。 在​ 動作 ​下,按一下​管理,然後按一下​建立動作

  2. 設定URL並選取Post方法。

    https://dcs.adobedc.net/collection/<collection_id>?syncValidation=false

  3. 請確定已設定標題(Content-Type、Charset、sandbox-name)。

    歷程畫布中的自訂動作(使用設定窗格)

設定驗證 custom-action-aep-authentication

  1. 選取​ Type ​做為​Custom,並包含下列承載。

  2. 貼上client_secret、client_id、scope和grant_type (來自以前使用的IO專案裝載)。

    code language-none
    {
    "type": "customAuthorization",
    "authorizationType": "Bearer",
    "endpoint": "https://ims-na1.adobelogin.com/ims/token/v3",
    "method": "POST",
    "headers": {},
    "body": {
    "bodyType": "form",
    "bodyParams": {
    "grant_type": "client_credentials",
    "client_secret": "********",
    "client_id": "<client_id>",
    "scope": "openid,AdobeID,read_organizations,additional_info.projectedProductContext,session"
    }
    },
    "tokenInResponse": "json://access_token",
    "cacheDuration": {
    "duration": 28000,
    "timeUnit": "seconds"
    }
    }
    
  3. 使用​ 按一下以測試驗證 ​按鈕以測試連線。

    使用運算式編輯器的引數對應介面

設定裝載 custom-action-aep-payload

  1. 在​ Request ​與​ Response ​欄位中,貼上先前使用之來源連線的裝載。

    code language-none
    {
    "xdmMeta": {
    "schemaRef": {
    "id": "https://ns.adobe.com/<your_org>/schemas/<schema_id>",
    "contentType": "application/vnd.adobe.xed-full+json;version=1.0"
    }
    },
    "xdmEntity": {
    "_id": "/uri-reference",
    "<your_org>": {
    "journeyVersionId": "Sample value",
    "nodeId": "Sample value",
    "customer_Id":""
    },
    "eventMergeId": "Sample value",
    "eventType": "advertising.completes,
    "producedBy": "self",
    "timestamp": "2018-11-12T20:20:39+00:00"
    }
    }
    
  2. 將欄位組態從​ 常數 ​變更為​變數,以動態方式填入欄位。

  3. 儲存自訂動作。

歷程

  1. 最後,在歷程中使用此自訂動作來撰寫自訂歷程事件。

  2. 根據您的使用案例填入歷程版本ID、節點ID、節點名稱和其他屬性。

    複雜欄位對應的 進階模式編輯器

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: This use case explains how to configure a custom action in Journey Optimizer that writes journey event data into Adobe Experience Platform using an HTTP API inlet and OAuth Server-to-Server authenticated calls.

Intents:

  • Set up an Adobe Developer Console IO project with OAuth Server-to-Server credentials for AEP API authentication
  • Create an HTTP API inlet source in Adobe Experience Platform to receive streaming journey event data
  • Configure a custom action in Journey Optimizer with the correct URL, headers, and custom Bearer token authentication
  • Map journey fields (journey version ID, node ID, customer ID) dynamically as variables in the custom action payload
  • Use the custom action in a journey to write custom events to an AEP dataset

Glossary:

  • HTTP API Inlet: An Adobe Experience Platform source connector that creates a streaming endpoint for ingesting data via HTTP POST requests (product-specific)
  • OAuth Server-to-Server: An authentication credential type in Adobe Developer Console that generates Bearer tokens for server-to-server API calls without user interaction (product-specific)
  • Custom authorization: A Journey Optimizer custom action authentication type that fetches a Bearer token from a specified endpoint and caches it for a configured duration (product-specific)
  • XDM entity: The data payload structure conforming to the Experience Data Model schema, used as the body when writing events to AEP via the HTTP API inlet (product-specific)
  • cacheDuration: The token cache setting in custom authorization configuration that controls how long the fetched Bearer token is reused before a new one is requested (product-specific)

Guardrails:

  • After creating the Adobe Developer Console project, developer and API access control permissions must be explicitly granted before the credentials can be used
  • The HTTP API inlet source must be created with authentication enabled; the connection endpoint URL and schema payload must be copied and stored for use in the custom action configuration
  • Custom action headers must include Content-Type, Charset, and sandbox-name
  • Fields intended to be populated dynamically at runtime must be changed from Constant to Variable in the custom action payload configuration

Terminology:

  • Canonical name: Custom action — Acronym: none — variants: custom action configuration, Journey Optimizer custom action
  • Canonical name: Adobe Experience Platform — Acronym: AEP — variants: Experience Platform, Platform
  • Synonyms: “HTTP API Inlet” = “streaming endpoint” = “DCS collection endpoint”
  • Do not confuse: “OAuth Server-to-Server” ≠ “OAuth user authentication” (Server-to-Server does not require a user login; it uses client credentials)

FAQ:

  • Q: What type of authentication is used to call the AEP HTTP API Inlet from a Journey Optimizer custom action? — Custom Bearer token authentication using OAuth Server-to-Server client credentials fetched from the Adobe IMS token endpoint.
  • Q: Where do I find the client_id, client_secret, grant_type, and scope values? — From the OAuth Server-to-Server credentials section of your Adobe Developer Console IO project, by clicking “View cURL command.”
  • Q: How do I make journey-specific fields (e.g., journeyVersionId, nodeId) dynamic in the payload? — Change their field configuration from Constant to Variable in the custom action payload setup so they are populated from the journey context at runtime.
  • Q: What permissions are required on the Adobe Developer Console project? — Developer and API access control must be granted with the right permissions after the project is created, as described in the AEP API authentication documentation.
  • Q: What is the purpose of the cacheDuration setting in the authentication payload? — It controls how long the fetched Bearer token is cached and reused (28,000 seconds in the example) before the custom action requests a new token.
recommendation-more-help
journey-optimizer-help