Mobile SDK - Prefilling Lead Data

This page describes how to prefill any user data you already have in your Mobile SDK implementation

Here is the standard setup for implementing the Mobile SDK into your app:

<EngineSdk
bearer="{your_token}"
endpoint="https://api.engine.tech"
primaryColor=”#11aa34”
secondaryColor=”#444444”
prefilledData={/* any data you don't want to ask for again */}
clientTags={{ “userTrackingId”: [“80”] }}
onInitialize={(savedLeadUuid, savedLeadData) => { /* handler */ }}
onCreate={(leadUuid, leadData, page, editingPage) => { /* handler */ }}
onUpdate={(leadUuid, leadData, page, editingPage) => { /* handler */ }}
onNavigate={(leadUuid, leadData, page, nextPage, editingPage) => { /* handler */ }}
onSubmit={(leadUuid, leadData) => { /* handler */ }}
onExit={() => { /* handler */ }}
/>

the prefilledData object should be structured with any fields you want the user not to have to answer themselves, if you already have that info available. Here is an example of prefilledData as a Javascript Object:

PrefilledData example

{
  "firstName": "Bob", // required
  "lastName": "Dylan", // required
  "email": "bobdylan@gmail.com", // required
  "loanAmount": 7500, 
        // you can instead use "defaultSliderLoanAmount", if you want to suggest a default loan amount but still allow the user to edit it.
        // if "loanAmount" is prefilled, "defaultSliderLoanAmount" will be ignored
  "purpose": "credit_card_refi",
  "dateOfBirth": new Date("1990-01-01"),
  "address": {
    "street": "1600 Pennsylvania Avenue",
    "city": "Washington",
    "state": "DC",
    "zip": "20500"
  },
  "primaryPhone": "2325624852",
  "creditRating": "good",
  "propertyStatus": "own_with_mortgage",
  "educationLevel": "associate",
  "employmentStatus": "employed",
  "annualIncome": "20000",
  "hasDirectDeposit": false,
  "ssn": "512-54-7862"
}

PrefilledData type validations

The data should follow a type schema, described here in Typescript notation:

interface PrefilledLeadData {
    firstName: string;
    lastName: string;
    email: string;
    loanAmount?: number; // whole numbers only
    defaultSliderLoanAmount?: number | string; // if you want the loan amount slider to default to something other than 5000 but want to allow the user to edit the amount, enter it here
    purpose?: LoanPurpose; // enum below
    dateOfBirth?: Date;
    address?: AddressData; // enum below
    primaryPhone?: string; // leading 1 is fine, but no "+" or "-" chars allowed
    phoneConsent?: boolean;
    ssn?: string; // 9 digits with or without hyphens
    creditRating?: CreditRating; // enum below
    propertyStatus?: PropertyStatus; // enum below
    educationLevel?: EducationLevel; // enum below
    employmentStatus?: EmploymentStatus; // enum below
    annualIncome?: AnnualIncomeBracket; // enum below
    hasDirectDeposit?: boolean;
}

interface AddressData {
/** Primary street address */
    street?: string;
    /** (Optional) Apartment Suite */
    apartment?: string;
    city?: string;
    state?: string; // must be a valid 2-letter abbreviation
    zip?: string;
}

defaultSliderLoanAmount

By default, the requested loan amount slider defaults to a $5,000 loan amount. You may prefill the loanAmount if you know how much the user is requesting. If you do not know the exact amount but want to specify any other default amount (e.g. $7,500 instead of $5,000), use the defaultSliderLoanAmount attribute.

You may prefill both loanAmount and defaultSliderLoanAmount, for cases where you know the desired request amount for some users but not others. E.g. for Lead A, you know they want to request $10,000, but for Lead B, you do not know their desired loan amount, and want to default to $7,500. In this case, you can specify both loanAmount: ${loanAmountWhenAvailable} and defaultSliderLoanAmount: 7500. This will prefill the loanAmount if provided by your code, and otherwise will show the lead the default request amount in the slider during that step.

Enums / accepted values for certain fields

Certain fields, although strings, must be within a predetermined list of accepted values. Here are those values:

type LoanPurpose = "debt_consolidation" | "credit_card_refi" | 
"home_improvement" | "large_purchases" | "other";

type CreditRating = "excellent" | "good" | "fair" | "poor" | "limited";

type PropertyStatus = "own_with_mortgage" | "rent";

type EducationLevel = "high_school" | "associate" |  "bachelors" |  "masters" |
"other_grad_degree" |  "other";

type EmploymentStatus = "employed" | "self_employed" | "not_employed" | "retired" | 
"military" | "other";

type AnnualIncomeBracket = "20000" | "40000" | "60000" | "100000" | "120000" | "121000";

PrefilledData sanitization

Prefilled Data must align with the type validations above, and any fields with an accepted value enum must be within that enum. If you (the partner) prefill user data, and any type/value is invalid, that attribute will be stripped, and the lead will have to enter it again manually.

Prefilled values cannot be edited

Prefilled values cannot be edited by the user on the final confirm-details screen (before submitting the form). If the user's info is incorrect (e.g. Address is incorrect outdated), the user should edit the info in your app directly.

Last updated