Class JourneyNode
-
- All Implemented Interfaces:
public final class JourneyNodeA single node in a journey DAG. Discriminated by
type, with a secondary discriminator on some variants (trigger_typefor trigger,modefor delay,methodfor fetch,scopefor throttle).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceJourneyNode.VisitorAn interface that defines how to map each variant of JourneyNode to a value of type T.
public final classJourneyNode.JourneyBatchNodeCollect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. The first event into a batch owns the run; later contributing events terminate at the batch step. The batch releases when any of
max_itemsis reached, a quiet window ofwait_periodelapses, or themax_wait_periodceiling hits.public final classJourneyNode.JourneyBranchNodeBranch node. Routes to the first entry in
paths[]whoseconditionsmatch, else falls through todefault.nodes.
-
Method Summary
Modifier and Type Method Description final Optional<JourneyApiInvokeTriggerNode>apiInvokeTrigger()Trigger fired when the journey is invoked via the API. final Optional<JourneySegmentTriggerNode>segmentTrigger()Trigger fired by a segment event ( identify,group, ortrack).final Optional<JourneySendNode>send()Send a notification template to the recipient. final Optional<JourneyDelayDurationNode>delayDuration()Pause the journey run for a fixed duration.final Optional<JourneyDelayUntilNode>delayUntil()Pause the journey run untila specific time.final Optional<JourneyFetchGetDeleteNode>fetchGetDelete()Issue an HTTP GET or DELETE request and merge the response into the journey state per merge_strategy.final Optional<JourneyFetchPostPutNode>fetchPostPut()Issue an HTTP POST or PUT request with a bodyand merge the response into the journey state permerge_strategy.final Optional<JourneyAiNode>ai()Invoke an AI step with user_promptand optionalweb_search.final Optional<JourneyThrottleStaticNode>throttleStatic()Throttle the journey by a static scope(userorglobal), allowing at mostmax_allowedinvocations perperiod.final Optional<JourneyThrottleDynamicNode>throttleDynamic()Throttle the journey by a dynamic throttle_key, allowing at mostmax_allowedinvocations perperiod.final Optional<JourneyNode.JourneyBatchNode>batch()Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. final Optional<JourneyExitNode>exit()Terminate the journey run. final Optional<JourneyNode.JourneyBranchNode>branch()Branch node. final BooleanisApiInvokeTrigger()final BooleanisSegmentTrigger()final BooleanisSend()final BooleanisDelayDuration()final BooleanisDelayUntil()final BooleanisFetchGetDelete()final BooleanisFetchPostPut()final BooleanisAi()final BooleanisThrottleStatic()final BooleanisThrottleDynamic()final BooleanisBatch()final BooleanisExit()final BooleanisBranch()final JourneyApiInvokeTriggerNodeasApiInvokeTrigger()Trigger fired when the journey is invoked via the API. final JourneySegmentTriggerNodeasSegmentTrigger()Trigger fired by a segment event ( identify,group, ortrack).final JourneySendNodeasSend()Send a notification template to the recipient. final JourneyDelayDurationNodeasDelayDuration()Pause the journey run for a fixed duration.final JourneyDelayUntilNodeasDelayUntil()Pause the journey run untila specific time.final JourneyFetchGetDeleteNodeasFetchGetDelete()Issue an HTTP GET or DELETE request and merge the response into the journey state per merge_strategy.final JourneyFetchPostPutNodeasFetchPostPut()Issue an HTTP POST or PUT request with a bodyand merge the response into the journey state permerge_strategy.final JourneyAiNodeasAi()Invoke an AI step with user_promptand optionalweb_search.final JourneyThrottleStaticNodeasThrottleStatic()Throttle the journey by a static scope(userorglobal), allowing at mostmax_allowedinvocations perperiod.final JourneyThrottleDynamicNodeasThrottleDynamic()Throttle the journey by a dynamic throttle_key, allowing at mostmax_allowedinvocations perperiod.final JourneyNode.JourneyBatchNodeasBatch()Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. final JourneyExitNodeasExit()Terminate the journey run. final JourneyNode.JourneyBranchNodeasBranch()Branch node. final Optional<JsonValue>_json()final <T extends Any> Taccept(JourneyNode.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final JourneyNodevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static JourneyNodeofApiInvokeTrigger(JourneyApiInvokeTriggerNode apiInvokeTrigger)Trigger fired when the journey is invoked via the API. final static JourneyNodeofSegmentTrigger(JourneySegmentTriggerNode segmentTrigger)Trigger fired by a segment event ( identify,group, ortrack).final static JourneyNodeofSend(JourneySendNode send)Send a notification template to the recipient. final static JourneyNodeofDelayDuration(JourneyDelayDurationNode delayDuration)Pause the journey run for a fixed duration.final static JourneyNodeofDelayUntil(JourneyDelayUntilNode delayUntil)Pause the journey run untila specific time.final static JourneyNodeofFetchGetDelete(JourneyFetchGetDeleteNode fetchGetDelete)Issue an HTTP GET or DELETE request and merge the response into the journey state per merge_strategy.final static JourneyNodeofFetchPostPut(JourneyFetchPostPutNode fetchPostPut)Issue an HTTP POST or PUT request with a bodyand merge the response into the journey state permerge_strategy.final static JourneyNodeofAi(JourneyAiNode ai)Invoke an AI step with user_promptand optionalweb_search.final static JourneyNodeofThrottleStatic(JourneyThrottleStaticNode throttleStatic)Throttle the journey by a static scope(userorglobal), allowing at mostmax_allowedinvocations perperiod.final static JourneyNodeofThrottleDynamic(JourneyThrottleDynamicNode throttleDynamic)Throttle the journey by a dynamic throttle_key, allowing at mostmax_allowedinvocations perperiod.final static JourneyNodeofBatch(JourneyNode.JourneyBatchNode batch)Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. final static JourneyNodeofExit(JourneyExitNode exit)Terminate the journey run. final static JourneyNodeofBranch(JourneyNode.JourneyBranchNode branch)Branch node. -
-
Method Detail
-
apiInvokeTrigger
final Optional<JourneyApiInvokeTriggerNode> apiInvokeTrigger()
Trigger fired when the journey is invoked via the API. The optional
schemafield is a JSON Schema that validates the invocation payload.
-
segmentTrigger
final Optional<JourneySegmentTriggerNode> segmentTrigger()
Trigger fired by a segment event (
identify,group, ortrack).
-
send
final Optional<JourneySendNode> send()
Send a notification template to the recipient. Optionally override the recipient address, delay the send, or attach
data.
-
delayDuration
final Optional<JourneyDelayDurationNode> delayDuration()
Pause the journey run for a fixed
duration.
-
delayUntil
final Optional<JourneyDelayUntilNode> delayUntil()
Pause the journey run
untila specific time.
-
fetchGetDelete
final Optional<JourneyFetchGetDeleteNode> fetchGetDelete()
Issue an HTTP GET or DELETE request and merge the response into the journey state per
merge_strategy.
-
fetchPostPut
final Optional<JourneyFetchPostPutNode> fetchPostPut()
Issue an HTTP POST or PUT request with a
bodyand merge the response into the journey state permerge_strategy.
-
ai
final Optional<JourneyAiNode> ai()
Invoke an AI step with
user_promptand optionalweb_search. Returns a structured response conforming tooutput_schema.
-
throttleStatic
final Optional<JourneyThrottleStaticNode> throttleStatic()
Throttle the journey by a static
scope(userorglobal), allowing at mostmax_allowedinvocations perperiod.
-
throttleDynamic
final Optional<JourneyThrottleDynamicNode> throttleDynamic()
Throttle the journey by a dynamic
throttle_key, allowing at mostmax_allowedinvocations perperiod.
-
batch
final Optional<JourneyNode.JourneyBatchNode> batch()
Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. The first event into a batch owns the run; later contributing events terminate at the batch step. The batch releases when any of
max_itemsis reached, a quiet window ofwait_periodelapses, or themax_wait_periodceiling hits.
-
exit
final Optional<JourneyExitNode> exit()
Terminate the journey run.
-
branch
final Optional<JourneyNode.JourneyBranchNode> branch()
Branch node. Routes to the first entry in
paths[]whoseconditionsmatch, else falls through todefault.nodes.
-
isApiInvokeTrigger
final Boolean isApiInvokeTrigger()
-
isSegmentTrigger
final Boolean isSegmentTrigger()
-
isDelayDuration
final Boolean isDelayDuration()
-
isDelayUntil
final Boolean isDelayUntil()
-
isFetchGetDelete
final Boolean isFetchGetDelete()
-
isFetchPostPut
final Boolean isFetchPostPut()
-
isThrottleStatic
final Boolean isThrottleStatic()
-
isThrottleDynamic
final Boolean isThrottleDynamic()
-
asApiInvokeTrigger
final JourneyApiInvokeTriggerNode asApiInvokeTrigger()
Trigger fired when the journey is invoked via the API. The optional
schemafield is a JSON Schema that validates the invocation payload.
-
asSegmentTrigger
final JourneySegmentTriggerNode asSegmentTrigger()
Trigger fired by a segment event (
identify,group, ortrack).
-
asSend
final JourneySendNode asSend()
Send a notification template to the recipient. Optionally override the recipient address, delay the send, or attach
data.
-
asDelayDuration
final JourneyDelayDurationNode asDelayDuration()
Pause the journey run for a fixed
duration.
-
asDelayUntil
final JourneyDelayUntilNode asDelayUntil()
Pause the journey run
untila specific time.
-
asFetchGetDelete
final JourneyFetchGetDeleteNode asFetchGetDelete()
Issue an HTTP GET or DELETE request and merge the response into the journey state per
merge_strategy.
-
asFetchPostPut
final JourneyFetchPostPutNode asFetchPostPut()
Issue an HTTP POST or PUT request with a
bodyand merge the response into the journey state permerge_strategy.
-
asAi
final JourneyAiNode asAi()
Invoke an AI step with
user_promptand optionalweb_search. Returns a structured response conforming tooutput_schema.
-
asThrottleStatic
final JourneyThrottleStaticNode asThrottleStatic()
Throttle the journey by a static
scope(userorglobal), allowing at mostmax_allowedinvocations perperiod.
-
asThrottleDynamic
final JourneyThrottleDynamicNode asThrottleDynamic()
Throttle the journey by a dynamic
throttle_key, allowing at mostmax_allowedinvocations perperiod.
-
asBatch
final JourneyNode.JourneyBatchNode asBatch()
Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. The first event into a batch owns the run; later contributing events terminate at the batch step. The batch releases when any of
max_itemsis reached, a quiet window ofwait_periodelapses, or themax_wait_periodceiling hits.
-
asExit
final JourneyExitNode asExit()
Terminate the journey run.
-
asBranch
final JourneyNode.JourneyBranchNode asBranch()
Branch node. Routes to the first entry in
paths[]whoseconditionsmatch, else falls through todefault.nodes.
-
accept
final <T extends Any> T accept(JourneyNode.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.courier.core.JsonValue; import java.util.Optional; Optional<String> result = journeyNode.accept(new JourneyNode.Visitor<Optional<String>>() { @Override public Optional<String> visitApiInvokeTrigger(JourneyApiInvokeTriggerNode apiInvokeTrigger) { return Optional.of(apiInvokeTrigger.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final JourneyNode validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofApiInvokeTrigger
final static JourneyNode ofApiInvokeTrigger(JourneyApiInvokeTriggerNode apiInvokeTrigger)
Trigger fired when the journey is invoked via the API. The optional
schemafield is a JSON Schema that validates the invocation payload.
-
ofSegmentTrigger
final static JourneyNode ofSegmentTrigger(JourneySegmentTriggerNode segmentTrigger)
Trigger fired by a segment event (
identify,group, ortrack).
-
ofSend
final static JourneyNode ofSend(JourneySendNode send)
Send a notification template to the recipient. Optionally override the recipient address, delay the send, or attach
data.
-
ofDelayDuration
final static JourneyNode ofDelayDuration(JourneyDelayDurationNode delayDuration)
Pause the journey run for a fixed
duration.
-
ofDelayUntil
final static JourneyNode ofDelayUntil(JourneyDelayUntilNode delayUntil)
Pause the journey run
untila specific time.
-
ofFetchGetDelete
final static JourneyNode ofFetchGetDelete(JourneyFetchGetDeleteNode fetchGetDelete)
Issue an HTTP GET or DELETE request and merge the response into the journey state per
merge_strategy.
-
ofFetchPostPut
final static JourneyNode ofFetchPostPut(JourneyFetchPostPutNode fetchPostPut)
Issue an HTTP POST or PUT request with a
bodyand merge the response into the journey state permerge_strategy.
-
ofAi
final static JourneyNode ofAi(JourneyAiNode ai)
Invoke an AI step with
user_promptand optionalweb_search. Returns a structured response conforming tooutput_schema.
-
ofThrottleStatic
final static JourneyNode ofThrottleStatic(JourneyThrottleStaticNode throttleStatic)
Throttle the journey by a static
scope(userorglobal), allowing at mostmax_allowedinvocations perperiod.
-
ofThrottleDynamic
final static JourneyNode ofThrottleDynamic(JourneyThrottleDynamicNode throttleDynamic)
Throttle the journey by a dynamic
throttle_key, allowing at mostmax_allowedinvocations perperiod.
-
ofBatch
final static JourneyNode ofBatch(JourneyNode.JourneyBatchNode batch)
Collect events arriving at the node into a single batch and fire one downstream step with the aggregated payload. The first event into a batch owns the run; later contributing events terminate at the batch step. The batch releases when any of
max_itemsis reached, a quiet window ofwait_periodelapses, or themax_wait_periodceiling hits.
-
ofExit
final static JourneyNode ofExit(JourneyExitNode exit)
Terminate the journey run.
-
ofBranch
final static JourneyNode ofBranch(JourneyNode.JourneyBranchNode branch)
Branch node. Routes to the first entry in
paths[]whoseconditionsmatch, else falls through todefault.nodes.
-
-
-
-