Instnt Core JavaScript Library

Overview

The Instnt Core JavaScript library workflows the core functionality for the Instnt web SDKs (React, Angular, and Vanilla JavaScript SDK).The JS library helps Instnt maintain a common codebase across its web SDKs to avoid duplications and overhead maintenance.

The library does not bundle with web SDKs. It streams from the server-side during the initial Instnt SDK setup (aka begin transaction). To enable smoother enhancement and upkeep without the customers needing to update the Instnt web SDKs frequently.

The Instnt React and Angular SDKs provide framework-specific components that create easier integrations using the apps developed within the frameworks. We encourage you to use the SDK components when applicable.

The Core JS library functions wrapped in the Instnt object, made available to access after the Instnt SDK initialized successfully. The properties and functions associated with the object are accessed to execute various operations like performing document scans on the client-side and interacting with Instnt's API.

The library provides a set of events used across the three Instnt web SDKs.Below are the details and events generated by the Instant object functions and web SDK components.

 

Instnt object

Property

Type

Description

instnttxnid

UUID

Instnt Transaction ID

formKey

string

Instnt Workflow ID

otpVerification

boolean

Whether Instnt Workflow has OTP verification enabled

documentVerification

boolean

Whether Instnt Workflow has document verification enabled

 

Instnt functions

Method

Sync | Async

Parameters

Events Triggered

Description

onEvent

Async

event

 

An event handler receiving Instnt events.

init

Async

   

Initializes an Instnt signup session.

captureDocument

Sync

documentType,

documentSide,

captureMode = "Auto",

autoUpload = true

document.captured

document.uploaded (if autoUpload = true)

document.capture-cancelled

Captures a document, using device camera such as driver's license, passport.

CaptureSelfie

Sync

captureMode, autoUpload

document.captured

document.uploaded (if autoUpload = true)

document.capture-cancelled

Captures a selfie image using device camera.

uploadAttachment

Async

attachment, documentSide

isSelfie = false

document.uploaded

document.error

Upload a document file to Instnt server.

verifyDocuments

Async

documentType

document.verification-initiated

document.error

Initiate document verification on Instnt server.

submitSignupData

Async

data which is a JavaScript object with key:value pair of user entered data

transaction.processed

transaction.error

Submit the user entered data to Instnt server and initiate customer approval process.

getTransactionStatus

Async

instnttxnid

 

Returns the status of the transaction (instead of triggering an event) that includes the workflow fields verification and document verification status

sendOTP

Async

mobileNumber

otp.sent

otp.error

Sends one-time password to the mobile number provided.

verifyOTP

Async

mobileNumber, otpCode

otp.verified

otp.error

Verifies one-time password to the provided mobile number.

 

Instnt Events

Name

Content

Description

Instnt Initialized

{type: ‘transaction.initiated’,

data: {

instnt: object

}}

This signifies that the Instnt framework has finished initializing and is ready to accept user input.

Instnt object contains a transaction ID and SDK functions.

Document Captured

{type: ‘document.captured’,

data: {

document_type,

document_side

}}

Image capture completed.

Document uploaded

{type: ‘document.uploaded’,

data: {

document_type,

document_side,

error

}}

Captured document has been uploaded.

Capture Cancelled

{type: ‘document.capture-cancelled’,

data: {

document_type,

document_side,

error

}}

Image capture has been cancelled.

Capture onEvent

{

type: 'document.capture-onEvent',

data: {

documentSettings,

statusCode,

statusCodeMessage,

data

}

}

The SDK calls the function you pass to setOnEvent when an image is captured that does not meet the minimum requirements specified in the current capture settings. See the table below for specific detail on handling this event.

Documents verification initiated

{type: ‘document.verification-initiated’,

data: {

instnttxnid,

}}

Indicates that document verification process initiated at Instnt's backend. To get the decision, submit the data by calling appropriate SDK method instnt.submitData()

Document error

{type: 'document.error',

data: {

message,

status,

type

}}

Error processing document verification.

OTP sent

{type: 'otp.sent’,

data: {

mobileNumber,

instnttxnid

}}

OTP sent.

OTP Verified

{type: 'otp.verified’,

data: {

mobileNumber,

otpCode,

instnttxnid

}}

OTP verified.

OTP error

{type: 'otp.error',

data: {

message,

type

}}

Error while OTP verification process.

Application Processed

{type: ‘transaction.processed’,

data: {

decision: string,

instnttxnid: UUID

}}

User approval process completed.

Application processing error

{type: ‘transaction.error',

data: {

decision: string,

instnttxnid: UUID

}}

 

 

Document Capture onEvent

The SDK emits document.capture-onEvent when an image captured does not meet the minimum requirements specified in the current capture settings. When this event triggers, the SDK continues to stream the user camera feed, but the SDK stops evaluating images and responding to user interactions.
The event has three parameters- errorCode, statusCodeMessage, data.

Parameter Name

Type

Description

errorCode

number

A number indicating the reason the image did not pass minimum requirements. Possible Values:

1: A face was not detected in the image but face detection was enabled

2: The image was too blurry and did not fall within the blur threshold specified by the SDK’s current capture settings.

3: The image has too much glare and did not fall within the glare threshold specified by the SDK’s current capture settings.

4: A barcode was not detected in the image but barcode detection was enabled.

errorDescription

string

A string summary of the reason indicated by the errorCode.

data

object

An object containing detailed data about the reason the bad image event was thrown.

data.focusStatus

string

When “Yes”, indicates that the image met the focus threshold. specified in the SDK current capture settings. When “No”, indicates that the image did not meet the focus threshold.

data.focusValue

number

A numerical representation of the amount of focus found in the image. This number must be greater than the capture setting threshold.

data.glareStatus

string

When “Yes”, indicates that the image met the glare threshold. specified in the SDK current capture settings. When “No”, indicates that the image did not meet the glare threshold.

data.faceDetectionStatus

string

When “Yes”, indicates that a face was detected in the image. When “No”, indicates that a face was not detected in the image. This will always be “Yes” if face detection is disabled.

data.barcodeDetectionStatus

string

When “Yes”, indicates that a barcode was detected in the image. When “No”, indicates that a barcode was not detected in the image. This will always be “Yes” if barcode detection is disabled.

data.eventCount

number

The current images number in relation to the captureAttempts specified for this document scan in the capture settings.

data.image

string

A base64 encoded byte array for the captured image. This image does not meet minimum requirements.

 

Recommendations for handling these events: 

  • We recommend presenting an error message to the end-user with details about how the captured image does not meet minimum requirements, and they will need to try again.
  • Key off of errorCode when deciding what to tell the end-user. The event object used shows more granular details about why an image does not meet the requirements.

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request