Embedded SDK Integration Guide
The Snappt Embedded SDK allows applications to launch Snappt verification as a modal overlay within their applicant flow. No redirects, no popups, just a seamless iframe experience.
Prerequisites
Before integrating, you will need the following from your Snappt account team:
| Credential | Description |
|---|---|
| Client ID | A unique identifier tied to your SDK configuration. Required on every request. |
| Company Short ID | Identifies your company within Snappt. |
| Property Short ID | Identifies the property the applicant is applying to. |
Your Client ID is bound to an API key that controls which companies and properties you can access. Snappt validates every SDK request against this configuration. If your key is scoped to a single property, only that property can be used.
Domain Allowlisting
Your Client ID is configured with a list of allowed domains. The SDK will only load on pages served from those domains. Snappt validates the request Origin and Referer headers against your allowlist.
Allowed domains support:
- Exact origins, for example
https://apply.yourcompany.com - Wildcard subdomains, for example
*.yourcompany.com(matcheshttps://apply.yourcompany.com,https://staging.yourcompany.com, and so on)
Contact your Snappt account team to configure your allowed domains.
1. Add the Script
Add the following <script> tag anywhere in your HTML page. This loads the Snappt SDK and makes the global Snappt object available. No other dependencies are required.
<script src="https://enterprise-api.snappt.com/embedded/v1.0.0.js?iframe=true&clientId=YOUR_CLIENT_ID"></script>| Parameter | Required | Description |
|---|---|---|
iframe | Yes | Must be "true". Configures the SDK for iframe embedding. |
clientId | Yes | Your unique Client ID provided by Snappt. |
The script will not load if the clientId is missing, inactive, or if the page's origin is not in your allowed domains list. Use the Developer Tools > Network panel to inspect the response and get a detailed error message if the SDK fails to initialize.
2. Open the Verification Flow
Call Snappt.portal.show() to launch the applicant verification flow in a modal overlay. You must provide companyShortId and propertyShortId to identify the property.
var instance = Snappt.portal.show({
companyShortId: 'YOUR_COMPANY_ID',
propertyShortId: 'YOUR_PROPERTY_ID',
});Pre-filling Applicant Data (Optional)
You can pass applicant information so they don't have to re-enter it. Providing an email address allows the user to skip the first step of the Snappt flow but still requires them to confirm a one-time code. If the applicant previously opened the portal, you can pass an applicantIdentifier to ensure their submissions are linked together - see Linking Subsequent Sessions below.
var instance = Snappt.portal.show({
companyShortId: 'YOUR_COMPANY_ID',
propertyShortId: 'YOUR_PROPERTY_ID',
email: '[email protected]',
firstName: 'Jane',
lastName: 'Doe',
phone: '5551234567',
applicantIdentifier: // previous Snappt applicantDetailId, if available
});Available Options
| Field | Type | Description |
|---|---|---|
companyShortId | string | Required. Your Snappt company ID. |
propertyShortId | string | Required. The Snappt property ID the applicant is applying to. |
email | string | Applicant email address. Pre-fills the login screen. |
firstName | string | Applicant first name. |
lastName | string | Applicant last name. |
phone | string | Applicant phone number. |
externalId | string | Recommended for webhook integrations. A stable identifier for this applicant or submission in your application. Snappt stores this identifier as an opaque value and includes it in outbound webhook payloads, making it easy to link Snappt applications back to your records in your system. Note: externalId is for attribution only - Snappt does not link or dedupe sessions by externalId, and there are no format constraints on the string value. |
externalMetadata | object | Free-form structured context, 10KB or less when serialized as JSON. Persisted with the applicant and returned on every webhook payload alongside externalId. Useful for attaching context like unit number, lead source, or agent. |
applicantIdentifier | string | A Snappt applicantDetailId UUID (v4) from a previous Snappt modal instance. The applicant identifier links subsequent submissions together and is important if your flow allows users to open the modal to submit multiple times. See Linking Subsequent Sessions below. |
3. Register Event Handlers
The show() call returns an instance object. Use addEventListener('close', callback) to be notified when the modal closes. Your callback receives an event object with a type field indicating what happened, an applicantDetailId identifying the applicant for future Snappt.modal.opencalls, and additional type-specific metadata.
Event Types:
application-complete: The applicant has successfully finished the verification flow and their application is processing.event.payload.applicantId: the SnapptapplicantId- can be used to check application status via the REST API and appears in webhooks.
close: The applicant has closed the modal. If you have not receivedapplication-complete, the user exited the modal without completing the application flow.
instance.addEventListener('close', function (event) {
const applicantIdentifier = e.applicantDetailId;
// If your application allows users to re-open the modal or submit again,
// save this value and pass it back in subsequent calls to `Snappt.portal.show`
saveSnapptApplicantIdentifier(applicantIdentifier);
if (event.type === 'application-complete') {
// The applicant finished the flow! Their application is processing.
// The Snappt applicantId attached to this event can be used to check
// application status via our REST API and appears in webhooks.
const applicantId = e.payload.applicantId;
showConfirmation();
}
if (event.type === 'close') {
// The applicant closed the modal. If you have not received application-complete,
// the user has exited without finishing their application.
}
});Linking Subsequent Sessions (Recommended)
When the Snappt modal closes, the event you receive contains an applicantDetailId. This is a Snappt UUID representing the applicant, separate from their individual application submissions. If your app allows the user to re-open the Snappt modal or submit a second time, you should save this value (either to a cookie or to your database records) and pass it to subsequent calls to Snappt.portal.showin the applicantIdentifier field. This ensures that subsequent applications are linked together, and ensures your flow can benefit from future improvements like resuming partially complete sessionsand ensures your flow can benefit from future improvements like resuming partially complete sessions.
Attaching External IDs (Recommended)
If you have a stable identifier for the applicant or submission in your application, you can provide it as an externalIdwhen calling Snappt.portal.show. Snappt stores this identifier as an opaque value and includes it in outbound webhook payloads, making it easy to link Snappt applications back to your records in your system. You can also query our REST API (GET /applicants) by externalId.
You can also attach arbitrary structured context via externalMetadata, for example unit number, lead source, or internal flags.
Note: externalId is for attribution only - Snappt does not link or dedupe sessions by externalId, and there are no format constraints on the string value. Passing externalId makes debugging and handling webhooks easier.
var instance = Snappt.portal.show({
companyShortId: 'YOUR_COMPANY_ID',
propertyShortId: 'YOUR_PROPERTY_ID',
email: '[email protected]',
externalId: 'YOUR-INTERNAL-APP-ID-12345',
externalMetadata: {
unitNumber: '101A',
leadSource: 'Website',
},
});4. Receive Results Server-Side (Webhooks)
The browser-side close event provides you with a Snappt applicantId if the user successfully completed the application flow. To receive results and link them back to your own records, configure a Snappt webhook.
Your webhook should verify the applicantDetailId or externalId match a record in your system, return a 200 status code, and then update your application state. If your webhook fails to respond in 30s or returns a non-200 status code, it will be retried hourly for 24 hours. (See Webhook Delivery and Retry Behavior)
Every webhook payload includes:
| Field | Description |
|---|---|
applicantId | The Snappt ID of the applicant submission, created when the flow is completed and Snappt has started processing the applicant's data. Results are attached to the applicant record. |
applicantDetailId | The Snappt ID of the applicant's personal details, created when they first open the modal. This ID allows submissions by the same person to be linked together and should be re-used in subsequent submissions by the same applicant. |
externalId | The externalId you passed to Snappt.portal.show(), or null if none was provided. Use this to look up the record in your own system. |
externalMetadata | The externalMetadata object you passed, or null. |
Pass externalId when you launch the modal, then key off it in your webhook handler.
Programmatic Control
You can control the modal directly through the instance:
instance.hide(); // Close the modal
instance.show(); // Re-open the modalYou can also remove event listeners:
function onClose(event) {
console.log('Modal closed:', event.type);
}
instance.addEventListener('close', onClose);
// Later, if you no longer need the listener:
instance.removeEventListener('close', onClose);Full Example
<head>
<script src="https://enterprise-api.snappt.com/embedded/v1.0.0.js?iframe=true&clientId=YOUR_CLIENT_ID"></script>
</head>
<body>
<button id="apply-btn">Start Application</button>
<script>
// In a full implementation, save this to your applicant modal or to a cookie
let applicantIdentifier = undefined;
document.getElementById('apply-btn').addEventListener('click', function () {
var instance = Snappt.portal.show({
companyShortId: 'YOUR_COMPANY_ID',
propertyShortId: 'YOUR_PROPERTY_ID',
email: '[email protected]',
firstName: 'Jane',
lastName: 'Doe',
phone: '5551234567',
externalId: 'YOUR-INTERNAL-APP-ID-12345',
externalMetadata: { unitNumber: '101A', leadSource: 'Website' },
applicantIdentifier: applicantIdentifier,
});
instance.addEventListener("close", (e) => {
applicantIdentifier = e.applicantDetailId;
if (e.type === "close") {
// User exited the modal. If you have not received `application-complete`, the user
// exited without completing their application.
console.log("close")
}
if (e.type === "application-complete") {
// User finished the application and their Snappt application is processing.
// You can query for it using the externalId you provided or using the applicantId
// returned on this event:
const applicantId = e.payload.applicantId;
console.log("applied!", {applicantId})
}
});
});
</script>
</body>Error Handling
If the SDK cannot generate an applicant link (for example, invalid property, disabled property, or access denied), an error message will be displayed inside the modal. Common errors:
| Error | Cause |
|---|---|
Property not found | The companyShortId and propertyShortId combination doesn't match a known property. |
Access denied for this property | Your Client ID's API key is not scoped to access this property. |
The property is disabled | The property exists but is currently disabled in Snappt. |
HTTP 400 on link generation | A field failed validation. Most commonly: applicantIdentifier is not a valid UUID, or externalMetadata exceeds 10KB serialized. |
Troubleshooting
| Symptom | Likely Cause |
|---|---|
| Script returns 403 | clientId is missing, invalid, or inactive. Verify your Client ID with your Snappt account team. |
| Script returns 403 "Origin not allowed" | Your page's domain is not in the allowed domains list for your Client ID. Contact Snappt to update your allowlist. |
Snappt is not defined | The script tag failed to load. Check the Network tab for errors. Ensure the clientId query parameter is present. |
| Modal opens but shows an error | The companyShortId or propertyShortId is incorrect, or the property is disabled. |
Console warning about applicantIdentifier | The value you passed is not a valid UUID v4 and the SDK stripped it before submitting. To correlate with your own ID, use externalId instead. |
Updated 19 days ago