This pattern uses startOnboarding() to run a locally-defined flow from start to finish in a single call. The SDK creates the session, runs every module in the order you specify, and returns aggregated results when the flow finishes.
Use this pattern when you want the simplest integration and the SDK can own the full onboarding experience without your app intervening between modules.
Prerequisite
The SDK must be initialized before you call startOnboarding(). See Installation for the initializeSDK() call and its arguments.
Walkthrough
Define the session configuration, the list of modules to run, and (optionally) session recording settings, then call startOnboarding():
let sessionConfig = {
configurationId: "your-workflow-id", // optional, applies dashboard settings
region: "ALL",
mergeSessionRecordings: false
};
let flowConfig = [
{ module: "addPhone" },
{ module: "addId", showIdTypeChooser: "true", showTutorials: "true" },
{ module: "addDocumentScan", documentType: "ADDRESS_STATEMENT" },
{ module: "addGeolocation", isSkippable: "true" },
{ module: "addSelfieScan", showTutorials: "true" },
{ module: "addFaceMatch" },
{ module: "addSignature" },
{ module: "addVideoSelfie" }
];
let recordSessionConfig = {
recordSession: "false",
forcePermissions: "false"
};
cordova.exec(
function (result) {
console.log("Onboarding completed:", result);
// result contains the aggregated module results
},
function (error) {
console.log("Onboarding error:", error);
},
"Cplugin",
"startOnboarding",
[sessionConfig, flowConfig, recordSessionConfig]
);
Arguments
sessionConfig: session-level configuration. See API Reference for the full list of fields.configurationIdis optional; when provided, the Dashboard-level session settings for that configuration are applied. Module execution order always comes from your localflowConfig.flowConfig: an array of module objects describing which modules to run and in what order. See Modules for every module and its parameters.recordSessionConfig: optional session recording configuration.
Results
The success callback receives an object containing the aggregated results of every module in the flow. The error callback receives a typed error string. See Results for the full structure of the success payload and the list of possible error strings.
Related pages
- Modules: every module available in
flowConfigand its parameters. - Results: the structure of the success payload and the list of error strings.
- API Reference: the full signature of
startOnboarding()and every field onsessionConfigandrecordSessionConfig.