Journey Service
Journey Service is the main entry point for extending your applications's capabilities with Journeys & Exchanges.
Journey & Exchange Execution
Journey Service lets querying available Journeys & Exchanges that this SDK instance was targeted by (via their Audience selection).
Execution of a Journey (or an Exchange which is a lightweight Journey) requires running its steps. Eeach step can be one of:
- Screen Step: Screens are defined by a JSON structure that contains array of UI elements inside. There are two main types of UI components: view and input oriented.
- View oriented UI elements support
Markdown
for rich text format and allow displayingvariables from Journey Context
that were produced by previous steps in the Journey. - Input oriented UI elements are various and standard set of inputs including single / multiline text input, radio / check boxes, buttons etc are available. Input from these UI elements can be bind to
variables from Journey Context
to be consumed by following steps in the Journey.
- View oriented UI elements support
- Script Step: Contains a script authored in JavaScript. Scripts have access to
Journey Context
, Mobile SDK Services and subset of standard JavaScript APIs such as Fetch API. - MeData Step: These steps allow accesing / collecting MeData via MeData Service and set their value to
Journey Context
to be available for rest of the Journey.
Mobile SDK Provided UI
When Journey / Exchange execution is fully delegated to Mobile SDK; whole UI of the Journey is displayed using WebView. Screens displayed by Screen Steps are fully stylable to match your native screens and design system inplace perfectly.
With Mobile SDK provided UI it is enough for your host application to start the execution with a single function call.
We recommend using Mobile SDK Provided UI and styling screens on DataSapien Orchestrator to match your host application.
Host App Provided UI
If you do not wish to use WebView based UI provided by Mobile SDK, you can choose to do all UI display in your host application. The data underlying a Journey or Exchange is an XML document that describes its steps and step contents in BPMN format.
In case you want to provide your own UI in your host app:
- You must request the
Execution
object from Journey Service which provides access to underlying BPMN XML. - Parse XML according to BPMN spec considering DataSapien extensions, one of those extensions are
JSON based screen definitions
. - For Screen Steps you should develop a mechanism to display UI elements according to JSON screen definition and provide their interactions with
Journey Context
. - Drive execution steps using the
Execution
object functions.
Journey Service Functions
To access JourneyService
functions; get its instance from DataSapien
object: DataSapien.getJourneyService()
.
Journey functions:
- getAvailableJourneys
- executeJourney
- ...
- Documentation pending
Exchange functions:
- getAvailableExchanges
- executeExchange
- ...
- Documentation pending
Execution object functions:
- getSteps
- next
- previous
- ...
- Documentation pending