이 페이지에서: 사용자 지정 작업에서 반환된 JSON 응답을 캡처하고 해당 필드를 사용하여 여정 결정을 안내하고, 메시지를 개인화하고, 오류를 처리합니다.
응답 페이로드 요구 사항 custom-action-enhancements-notes
-
전체 응답은 JSON 개체여야 합니다. 응답이 지원되지 않는 베어 어레이입니다.
-
배열은 개체 내에 포함될 수 있습니다. Scalar 배열은 지원되며 이기종 배열은 지원되지 않습니다.
지원됨:
{
"body": ["val1", "val2"],
"points": 1290
}
지원되지 않음(베어 어레이):
["val1", "val2"]
지원되지 않음(이기종 스토리지):
{
"values": [20, "aafw", false]
}
사용자 지정 작업 구성 config-response
사용자 지정 작업의 응답을 캡처하려면 엔드포인트가 반환하는 페이로드의 샘플을 정의합니다.
-
사용자 지정 작업을 만들거나 엽니다. 사용자 지정 작업 구성을 참조하세요.
-
응답(성공 응답) 필드 내부를 클릭합니다.
{width="80%"}
-
엔드포인트가 반환하는 성공적인 응답의 예를 붙여넣습니다. 샘플의 필드 유형이 실제 응답과 일치하는지 확인합니다. 이 예에서 로컬 끝점은 충성도 포인트의 수와 프로필의 상태를 전송합니다.
code language-json { "customerID": "xY12hye", "status": "gold", "points": 1290 } {width="80%"}
샘플은 작업이 호출될 때마다 Journey Optimizer이 검색하는 필드를 정의합니다.
-
(선택 사항) 오류 페이로드를 캡처하려면 오류 응답 페이로드 정의를 선택하고 호출이 실패할 때 끝점이 반환하는 페이로드와 일치하는 예제를 제공합니다. 예:
code language-json { "message": "customer not found" }구성된 경우
errorResponse노드에서 실패 페이로드 필드를 사용할 수 있습니다. 샘플의 형태가 실제 고장 반응과 일치해야 한다. -
필요한 요청 매개 변수를 추가합니다. 이 예제에서
customerID은 쿼리 매개 변수입니다. {width="80%"}
-
저장을 클릭합니다.
여정에서 응답 사용 response-in-journey
여정에 사용자 지정 작업을 추가합니다. 그런 다음 조건, 후속 작업 및 메시지 개인화의 응답 필드를 사용할 수 있습니다.
예를 들어 충성도 포인트의 수를 확인하는 조건을 추가할 수 있습니다. 사용자가 레스토랑에 들어오면 로컬 종단점이 프로필의 충성도 정보와 함께 호출을 보냅니다. 프로필이 Gold 고객인 경우 푸시를 보낼 수 있습니다. 또한 호출에서 오류가 감지되면 시스템 관리자에게 알리는 사용자 지정 작업을 보내십시오.
-
이전에 만든 이벤트와 충성도 사용자 지정 작업을 추가합니다.
-
충성도 사용자 지정 작업에서 고객 ID 쿼리 매개 변수와 같은 필수 입력 매개 변수를 프로필 ID에 매핑합니다. 시간 초과 또는 오류 발생 시 대체 경로 추가를 선택하여 이러한 결과를 별도로 처리합니다.
-
성공 경로에서 조건을 추가하고 작업 응답 필드를 사용합니다. 고급 편집기의 응답 필드는 Context 노드에서 사용할 수 있습니다.
-
푸시 또는 다른 작업을 추가하고 응답 필드를 사용하여 메시지를 개인화합니다. 이 예에서 콘텐츠는 충성도 포인트의 수와 고객 상태를 사용합니다. 응답 필드는 컨텍스트 특성 > Journey Orchestration > 작업에서 사용할 수 있습니다.
note NOTE 사용자 지정 작업을 입력하는 각 프로필은 끝점이 모든 프로필에 대해 동일한 응답을 반환하는 경우에도 호출을 트리거합니다. -
시간 제한 및 오류 경로에서 조건을 추가하고 기본 제공 jo_status_code 필드를 사용하여 호출 결과에서 분기합니다. 이 예제에서 조건은 http_400 오류 유형을 확인합니다. 오류 상태를 참조하세요.
code language-none @action{ActionLoyalty.jo_status_code} == "http_400"실패 페이로드를 구성한 경우 해당 필드 중 하나에 분기할 수도 있습니다. 위의 예에서는 다음과 같습니다.
code language-none @action{ActionLoyalty.errorResponse.message} == "customer not found"
-
조직에 알리는 사용자 지정 작업을 추가합니다.
테스트 모드 로그 test-mode-logs
테스트 모드를 사용하여 로그의 actionsHistory 섹션에 있는 작업에서 반환된 페이로드를 검사하십시오. 실패한 호출의 경우 실패 페이로드가 구성된 경우 로그에 포함됩니다. 이 기능은 디버깅에 유용합니다.
오류 상태 error-status
응답 페이로드가 정의되지 않은 경우에도 jo_status_code 필드를 사용할 수 있습니다. 가능한 값은 다음과 같습니다.
http_<code>http_200 또는 http_400 등 API 호출에서 반환된 HTTP 상태 코드timedoutcappedinternalError반환된 HTTP 코드가 2xx보다 크거나 다른 오류가 발생하면 작업 호출이 오류로 간주됩니다. 이 경우 여정은 구성된 시간 초과 또는 오류 분기를 따릅니다.
새로 만든 사용자 지정 작업에만 기본적으로 jo_status_code 필드가 포함됩니다. 기존 사용자 지정 작업에서 사용하려면 작업을 업데이트하고 저장합니다. 예를 들어 설명을 업데이트할 수 있습니다.
오류 응답 페이로드가 구성되어 있지 않으면 errorResponse 노드를 사용할 수 없습니다.
표현식 구문 exp-syntax
응답 필드 참조:
@action{<action name>.<field path>}
예:
@action{ActionLoyalty.status}
기본값을 제공하려면
@action{<action name>.<field path>, defaultValue: <expression>}
예:
@action{ActionLoyalty.points, defaultValue: 0}
@action{ActionLoyalty.points, defaultValue: @event{myEvent.newPoints}}
컬렉션의 경우 currentActionField을(를) 사용하여 현재 항목을 참조합니다.
count(
@action{MyAction.MyCollection.all(
currentActionField.description == "abc"
)}
)
기본 채널 메시지 개인화 response-in-channels
지원되는 기본 채널 개인화 (이메일, 푸시, 모바일 메시지)에서 사용자 지정 작업 응답 필드를 사용합니다. 배열 및 중첩된 데이터의 경우 Handlebars를 사용하여 컨텍스트 데이터 반복을 참조하십시오.
문제 해결 troubleshooting
jo_status_code이(가) 없습니다.errorResponse을(를) 사용할 수 없습니다.jo_status_code을(를) 검사하고 구성된 경우 테스트 모드의 오류 페이로드가 기록됩니다.추가 리소스
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 page explains how to capture the response payload returned by a custom action’s API call and leverage it to orchestrate journeys, personalize messages, and handle errors.
Intents:
- Configure a custom action to capture success and failure response payloads
- Leverage response payload fields in conditions, other actions, and message personalization
- Handle errors and timeouts using the jo_status_code field and the errorResponse node
- Inspect custom action responses through test mode logs
- Use the expression syntax to reference response fields, including default values and collections
Glossary:
- Response payload: The example payload pasted in the Response (success response) field whose fields are retrieved on each call (product-specific)
- Error response payload: The payload captured when a call fails, enabled by selecting Define a failure response payload, exposed under the errorResponse node (product-specific)
- jo_status_code: A built-in field, always available even when no response payload is defined, that carries the call outcome (product-specific)
- actionsHistory: A section shown in test mode logs that displays the payload returned by the external endpoint (product-specific)
- currentActionField: A reference used to access the current item when manipulating collections in a custom action response (product-specific)
- Test mode: The mode through which you access status logs related to custom action responses (product-specific)
Guardrails:
- The response payload must be a JSON object; a bare top-level array as the whole response is not supported, so place the array inside a field (for example body).
- Scalar arrays are supported in the response payload, but heterogeneous arrays are not supported.
- Only newly created custom actions include the jo_status_code field out-of-the-box; to use it with an existing custom action you need to update the action, for example by updating the description and saving.
- An action call is considered in error when the returned http code is greater than 2xx or if an error occurs, and the journey flows to the dedicated timeout or error branch.
- If an error response payload is configured, its fields are exposed under the errorResponse node for failed calls; if none is configured, that node is not available.
- Each profile entering the custom action triggers one call, even if the response is always the same.
Terminology:
- Canonical name: API call response in custom actions — Acronym: n/a — variants: custom action response, response payload
- Synonyms: “success response” = “Response field”
- Do not confuse: “Response” (success response payload) ≠ “Error Response” (failure response payload defined via Define a failure response payload)
- jo_status_code values: http_
(for example http_200 or http_400), timedout (timeout error), capped (capping error), internalError (internal error)``
`FAQ:
Q: Can the whole custom action response be an array? — No; the response payload must be a JSON object, so place the array inside a field (for example body). A bare top-level array as the whole response is not supported. Q: Which array types are supported in the response payload? — Scalar arrays are supported; heterogeneous arrays are not supported. Q: Why does an existing custom action not expose the jo_status_code field? — Only newly created custom actions include it out-of-the-box; update the existing action, for example by updating the description and saving, to add it. Q: When is an action call considered in error? — When the returned http code is greater than 2xx or an error occurs, after which the journey flows to the dedicated timeout or error branch. Q: Where can the returned payload be inspected? — Through test mode logs, in the actionsHistory section that displays the payload returned by the external endpoint. Q: Can response payload fields be used in native channels? — Yes, response payload fields from custom actions can be used in native channels (email, push, mobile messages) for message personalization.
Personas:
developer: Can leverage API call response payload fields in conditions, other actions, and message personalization. Can reference action response fields using the expression syntax, for example @action{ActionLoyalty.status}. Can use currentActionField to access the current item while manipulating a collection in a custom action response. Where: “Expression syntax”. admin: Can configure the custom action by pasting an example payload into the Response field to capture fields returned by the call. Can enable an error response payload by selecting Define a failure response payload in the custom action configuration. The page states that only newly created custom actions include the jo_status_code field out-of-the-box. Where: “Configure the custom action”.
Onboarding:
Level: Experienced First minimal step: Paste an example of the payload returned by the call. Success check: Each time the API is called, the system retrieves all the fields included in the payload example. Previous: Before configuring the response payload, create the custom action: Configure a custom action (action/about-custom-action-configuration.md) Next: To iterate over arrays and nested data from the response in messages: Iterate over contextual data (personalization/iterate-contextual-data.md)`
``