Events

This document explains how to handle events emitted by the onboarding process using window.postMessage().

Onboarding Event Codes

Here is the table with descriptions:

EVENT
DESCRIPTION
DETAIL

STEP_STARTED

General event to every begin of step of onboarding flow. (GENERICAL DETAIL)

{ "stepName":"INSTRUCTIONS", "stepIndex":0 }

STEP_COMPLETED

General event trigger when setp finish. (GENERICAL DETAIL)

{ "stepName":"INSTRUCTIONS", "stepIndex":0 }

GET_CAMERA_PERMISSIONS

The user clicked the button to enable camera access but has not yet granted permission.

{}

SDK_CAMERA_DENIED

The user denied camera access, preventing further progress until permissions are granted.

{ "StepName":"LIVENESS_IPROOV" }

LIVENESS_CAPTURE

The user clicked the button to start the liveness detection capture. After capture, the liveness count will indicate the number of attempts.

{ "livenessCount": X }

SDK_CAPTURE_DENIED

The user denied motion access, preventing the system from verifying their identity.

{ "assuranceType":"liveness" }

SDK_CAPTURE_FAILED

The liveness capture failed due to an issue such as poor lighting or improper movement, requiring the user to retry.

{ "assuranceType":"liveness","reason":"Try again","passed":false }

LIVENESS_IPROOV_ERROR

An error occurred while performing liveness verification. Contact the SDK team for further assistance.

{}

SDK_CAPTURE_INVALID

The liveness capture was invalid, possibly due to improper user positioning or lighting issues.

{"assuranceType":"liveness","reason":"error_device_motion_unsupported"}}

SDK_CAPTURE_RESULT

The result of the liveness capture, indicating whether the user is deemed alive or not.

{ "isAlive":true/false }

LIVENESS_PREVIEW_RETRY

The user opted to retry the selfie capture, restarting the liveness verification process.

{}

DOCUMENT_TYPE_SELECTED

The user selected a document type (e.g., CNH) to proceed with document verification.

{ "type":"CNH" } '

TERM_ACCEPTED

The user checked the checkbox to accept the terms of use. If unchecked, an event with false is emitted.

{ "term":"DocumentType_0_Terms of Use and Privacy Policy","checked":true }

SELECT_DOCUMENT_TYPE

The user checked the checkbox to accept the terms of use. If unchecked, an event with false is emitted.

{ "option":upload/picture }

SDK_FRONT_CAPTURE_STARTED

The front document image capture started

{ "assuranceType":"document_detector"}

SDK_BACK_CAPTURE_STARTED

Theb back document image capture started

{ "assuranceType":"document_detector"}

SDK_UPLOAD_INVALID

The event is trigger when sdk retorns failed on the document upload

{"assuranceType":"document_detector","eventId":"DOCUMENT_NOT_SUPPORTED"}

DD_CAPTURE_FINISH

The user canceled the document capture step.

{}

DD_PREVIEW_RETRY

The document capture was successful.

{ "assuranceType":"document", "stepName":"DOCUMENT_CAPTURE" }

SDK_CAPTURE_FAILED

The document capture failed due to image quality issues.

{ "assuranceType":"document", "reason":"Blurred Image", "passed":false }

FIELD_CHANGE

The event is triggered when the user edits or enters a value in the text field

{"field":"email"}

FAILED_PHONE_CODE

Incorrect code entered

{}

RESEND_PHONE_CODE

The event is triggered when the user ask to resend the phone code

{}

FAILED_EMAIL_CODE

Incorrect code entered

{}

RESEND_EMAIL_CODE

The event is triggered when the user ask to resend the email code

{}

ONBOARDING_FINISHED

The onboarding process was completed successfully, and the user is now onboarded.

{ "executionId":"67b27030a0e08600085f0c0f" }


The STEP_STARTED and STEP_COMPLETED events are indicators of the beginning and completion of various stages within the onboarding process. These events help to track the user's progress through each step.

  • The STEP_STARTED event signifies that a particular step has started. It contains two key parameters:

    • stepName: The name of the step, which could be one of several predefined stages in the onboarding process. Examples of possible values include:

      • INSTRUCTIONS

      • CAMERA_ACCESS

      • LIVENESS_CAPTURE

      • DOCUMENT_TYPE

      • DISPATCH_ADDRESS

      • DOCUMENT_REUSE

      • SEND_DOCUMENT_TYPE

      • COMPANY_ADDRESS

      • COMPANY_DATA

      • COMPANY_LISTING

      • COMPANY_SEARCH

      • COMPANY_LOCATION

      • BUSINESS_ADDRESS

      • INCOME

      • EMPLOYEE_DATA

      • PHONE_NUMBER_VALIDATION

      • EMAIL_VALIDATION

      • UPLOAD_DOCUMENT

      • WELCOME

      • NEW_ACCESS

      • FLOW_CHOICE

      • CUSTOM

      • QSA_CONTACT

      • QSA_CONTACT_INFO

      • QSA_NUMBER

      • PFL_PREVIEW

      • LIVENESS_CLEAR_SALE_PREVIEW

      • FA_PREVIEW

      • CUSTOM_FORM

      • DONE

      • USING_TERMS

      • DOCUMENT_ISSUED_COUNTRY

      • DD

      • PFL

      • LIVENESS_CLEAR_SALE

      • FA

      • FACE_AUTH_IPROOV

      • FACE_AUTH_FACETEC_3D

      • FACE_AUTH_FACETEC_2D

      • LIVENESS_IPROOV

      • LIVENESS_FACETEC_3D

      • LIVENESS_FACETEC_2D

      • DD_PREVIEW

      • FACE_AUTH_IPROOV_PREVIEW

      • LIVENESS_IPROOV_PREVIEW

      • LIVENESS_FACETEC_3D_PREVIEW

      • LIVENESS_FACETEC_2D_PREVIEW

      • and others.

    • stepIndex: The index of the current step, which provides a numerical reference to the user's position within the overall onboarding flow. This allows for precise identification of which step is in progress.

  • The STEP_COMPLETED event signifies that a particular step has been completed successfully. Like the STEP_STARTED event, it includes:

    • stepName: The name of the completed step.

    • stepIndex: The index of the completed step, which marks the successful progression to the next step in the process.

These events are crucial for monitoring the flow of the onboarding process, providing both the name of the current step and its index to help determine where the user is in the onboarding journey.


The Onboarding process communicates with an iFrame or WebView by emitting events through window.postMessage(). Event support is currently available for iFrame, Flutter*, and React Native.

window.addEventListener(
  "message",
  function (e) {
    console.log(e.data);
  },
  false
);

Example of a Returned Message:

{
  "code": "ONBOARDING_FINISHED",
  "detail": {
    "executionId": "xxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}

Always listen to the "message" event, as communication with the onboarding link through an iFrame utilizes the postMessage API.

Using a Specific Event Code from Onboarding:

To handle specific event codes emitted by Onboarding, you can check the code property in the event data:

window.addEventListener(
  "message",
  function (e) {
    if (e.data.code === "SDK_BACK_CAPTURE_STARTED") {
      console.log("The capture was started");
    }
  },
  false
);

If using Web Message Listeners with Flutter, then InAppWebView should be used, with jsObjectName set as FutterOnboardingChannel

The events that can be issued by Onboarding are as follows:

  • SDK_CAPTURE_INVALID: Will be triggered when capture is invalid, such as an incorrect document or poor image quality. (Document Detector and Passive Face Liveness)

  • SDK_CAPTURE_FAILED: Some other failure in the capture. (Document Detector and Passive Face Liveness)

  • SDK_CAPTURE_RESULT: Result of the capture. (Liveness and FaceAuthenticator)

  • SDK_BACK_CAPTURE_STARTED: Started capturing the backside of the document (Document Detector)

  • SDK_FRONT_CAPTURE_STARTED: Started capturing the front of the document (Document Detector)

  • DD_CAPTURE_FINISH: Document Detector capture step in onboarding completed (If it has both sides, it will only be triggered when both sides are captured) in fact it is only triggered when you are already moving on to the next step, if everything is ok with the capture

  • ONBOARDING_FINISHED: Onboarding finished

Last updated

Was this helpful?