Web SDK Functions

Initialize

The init function initializes the Alloy SDK by setting up the essential resources and configurations needed for the SDK to operate correctly.

Parameters:
object: A configuration object. The following properties can be specified:

OptionTypeDetails
keystringClient-specific public SDK key that is tied to your Alloy Journey. Required
journeyApplicationTokenstringToken of an application. Required if using Step Up, not required if using device or behavioral plugin.
productionbooleanSetting this to true will make the SDK use the Alloy production endpoints. Required
appURLstringRequired for non-US regions. Reach out to your Alloy rep for the correct value
apiURLstringRequired for non-US regions. Reach out to your Alloy rep for the correct value
journeyTokenstringToken that refers to that particular journey, Required
entityTokenstringPass entity token into init params for multi-entity applications to send each applicant only their portion of the doc verification process. Optional
isSingleEntitybooleanSend each applicant in a joint application only their portion of document process. Optional
showHeaderbooleanShow the header at the top of the SDK with the exit button and entity name. Default is true. Optional
isReactNativebooleanIndicate that it's a react native application. Default is false. Optional

- Prevents script calls to the window object, which is unavailable in the React Native environment.
- Ensures proper communication between the React application and the React Native WebView by handling callbacks for the onComplete event effectively.
colorobjectSpecify different values for the main colors of the SDK. Optional
color.primarystringSpecify hex color for primary color of SDK
color.secondarystringSpecify hex color for secondary color of SDK

Usage:

alloy.init({
  key: "ecfb58b7-a611-4fbd-b727-1b1d2113411a",
  production: false,
  journeyApplicationToken: "JA-hlZa11yUJYkTNzUTl116",
  journeyToken:"J-YCMHdHquF111111eM9"
});  

Returns:

The following values are sample values, and will be specific to your account/application.

{
  key : "ecfb58b7-a611-4fbd-b727-1b1d2113411a",
  journeyApplicationToken : "JA-hlZa11yUJYkTNzUTl116",
  journeyToken : "J-YCMHdHquF111111eM9",
  iovationBlackbox : "113asd1312-asdlkjl-11mmdgfg" // Only applicable if using Iovation
  neuroIdSiteId : "site-123", // Only applicable if using Neuro-ID
  neuroUserId : "8222528f-8657-4bdf-90a3-46779966cd11", // Only applicable if using Neuro-ID
  socureDeviceId : "device-123", // Only applicable if using Socure Device Risk
  socurePublicToken : "e11e126f80-ba23-4113-96aa-3a63d511f311" // Only applicable if using Socure Device Risk
}

Open Modal

The open function displays the SDK modal, allowing users to interact with the SDK's interface.

Parameters:

OptionTypeDetails
callbackfunctionFunction to be executed when the SDK is closed via the Exit button.
parent componentstringThe HTML ID of the HTML element the SDK should mount inside of.

Usage:

alloy.open(callback, "renderComponent");  

This is a sample callback function. It is recommended to parse the application status from the returned object to handle different outcomes appropriately. The callback function will be executed when the Exit button is clicked by the user. For more details on the structure of the returned data object, refer to the following sectioRead more about the data object structure returned here

function callback(data) {  
   console.log(data.journey_application_status)
}  

Returns:
None

Notes: Ensure init has been called before using open.

Close Modal

The close function will close the Alloy SDK interface, terminating any active processes and returning control to the calling application.

Parameters:
None

Usage:

alloy.close();  

Returns:
None

Data Structure Returned in Callback

The following data structure is returned as a parameter in your callback function. Below are the attributes included in this data object.

{
  journey_application_token: string;
  external_partner_id: string | null;
  external_group_id: string | null;
  external_application_id: string | null;
  status: string;
  sandbox: boolean;
  created_at: number;
  updated_at: number;
  closed_at: number | null;
  recent_outcome: string | null;
  complete_outcome: string | null;
  journey_application_status: string;
  is_archived: boolean;
  is_escalated: boolean;
  is_shadow_application: boolean;
  is_part_of_shadow_test: boolean;
  is_rerun: boolean;
  archived_at: number | null;
  terminal_reconciliation_output: Record<string, unknown>;
  _embedded: {
    rerun: Record<string, unknown>;
    child_entities: Array<{
      external_entity_identifier: string;
      name: string;
      token: string;
      type: string;
      entity_application_token: string;
      entity_application_status: string;
      entity_application_outcome: string | null;
      entity_application_branch_name: string;
      created: string;
      sandbox_persona_name: string | null;
    }>;
    entity_applications: Array<{
      entity_token: string;
      entity_application_token: string;
      entity_application_outcome: string | null;
      entity_application_status: string;
      sdk_link: string | null;
      entity_application_status_details: string | null;
      external_entity_identifier: string;
      output: {
        outcome_reasons: Array<{
          name: string;
          type: string | null;
        }>;
        tags: string[];
        output_attributes: Record<string, unknown>;
        matrix_models: Record<string, unknown>;
      };
    }>;
    entity: {
      external_entity_identifier: string | null;
      name: string | null;
      token: string;
      type: string;
    };
    events: Array<{
      journey_application_event_token: string;
      journey_application_token: string;
      type: string;
      journey_type: string;
      timestamp: number;
      entity_token: string;
      entity_application_token: string | null;
      _embedded: {
        node: {
          id: string | null;
          name: string | null;
          type: string | null;
          config?: Record<string, unknown>;
          workflow_name?: string;
        };
      };
      _links: Record<string, unknown>;
      evaluation_token?: string;
      outcome?: string;
      case_token?: string;
      evaluation_tokens_sorted_by_created_dec?: string[];
    }>;
    journey: {
      journey_name: string;
      journey_type: string;
      journey_token: string;
      journey_version_num: string;
      _links: {
        self: {
          href: string;
        };
        callback_by_entity_application_token?: Record<string, unknown>;
      };
    };
  };
  _links: {
    self: {
      href: string;
    };
  };
  sdk: {
    sdkEvent: string;
  };
}

Get Public URL

The getPublicUrl function will return the public-facing URL that displays the SDK. This function is ideal for react-native applications.

Parameters
None

Usage:

alloy.getPublicUrl()

Returns:
A string containing the public URL is returned. This URL includes the parameters that were configured in the init function.

'https://alloysdk.alloy.co/?journeyApplicationToken=JA-hlZa4Ty110YkTNzUTlX26&journeyToken=J-YCMHdH22FYld4x5adeM9&key=ecfb3337-a6eb-4fbd-b727-1b3d2863409a'