Skip to main content

JourneyService

Script-engine API for reading journeys and their execution records, and for running a journey from script. Available in Journey Script steps, Rule script actions, and Script-sourced MeData Definitions.

Functions​

getJourneys​

JourneyService.getJourneys(tags, statuses): Promise<Journey[]>

Fetches journeys from local storage with optional filters.

Parameters:

  • tags: [String] — Optional journey tags.
  • statuses: [String] — Optional journey statuses ("sent", "completed", "notStarted").

getJourney​

JourneyService.getJourney(name): Promise<Journey | null>

Returns a journey by name.

Parameters:

  • name: String — Journey name.

runJourney​

JourneyService.runJourney(name, data): Promise<[String: Any] | null>

Executes journey UI and returns the output JSON.

Parameters:

  • name: String — Journey name.
  • data: [String: Any] — Input payload.

getJourneyExecutionRecords​

JourneyService.getJourneyExecutionRecords(name): Promise<JourneyExecutionRecord[]>

Returns all execution records for a journey.

Parameters:

  • name: String — Journey name.

getJourneyExecutionRecord​

JourneyService.getJourneyExecutionRecord(name): Promise<JourneyExecutionRecord | null>

Returns the latest execution record for a journey.

Parameters:

  • name: String — Journey name.

getJourneyStatus​

JourneyService.getJourneyStatus(name): Promise<string>

Returns the current journey status.

Parameters:

  • name: String — Journey name.

Classes​

Journey​

{
id: string;
name: string;
flow: JourneyFlow;
metadata: JourneyMetadata;
tags?: string[] | null;
zpdRequest?: JourneyZPDRequest | null;
createdAt: number;
updatedAt?: number | null;
publishedAt?: number | null;
}

JourneyMetadata​

{
title: string;
description?: string | null;
imageUrl?: string | null;
}

JourneyFlow​

{
xml: string;
data?: JourneyFlowData[] | null;
}

JourneyFlowData​

{
type: string;
name: string;
source: string;
origin?: string | null;
}

JourneyZPDRequest​

{
requested?: JourneyFlowData[] | null;
}

JourneyFlowDataType​

"MEDATA" | "INPUT" | "CALCULATED" | "ANSWER"

JourneyStatus​

"NOT_STARTED" | "COMPLETED" | "SENT"

JourneyStatusFilter​

JourneyStatus[]

JourneyContext​

{
values: { [key: string]: any };
}

JourneyExecutionRecord​

{
id: string;
status: string;
journeyContext?: JourneyContext | null;
date: number;
}

JourneyZPD​

{
data: SharedData[];
}

SharedData​

{
type: string;
name: string;
source: string;
origin?: string | null;
value: string;
}