Truework Apply: Getting Started

This page will show you how to get up and running with Truework Apply in under 10 minutes. With our server and client-side libraries, you can verify any employee.

note

Truework Apply is in Early Access

This section shows an early access version of the Truework Apply feature. Please reach out to Sales if you want to use it.

Step 1: Integrate with backend

First, you will need to install one of our Truework SDKs.

pip install truework

Then, import it into your code and configure it with your API token. You can create and access API tokens from your Truework account settings.

import truework
truework.API_TOKEN = "TOKEN"

Once configured, the Truework library is ready to be used in your application code.

info

To access your Truework account, log in at https://app.truework.com/login.

Step 2: Create a new Verification

Import the Truework library and create a Verification. For convenient integration with Truework Apply, use our convenience methods.

verification = truework.apply.create(
type='employment',
permissible_purpose='risk-assessment',
target = {
first_name:'John',
last_name:'Doe',
"contact_email": "joesmith@example.org",
social_security_number:'123-12-1234',
company: {
'name': 'Truework',
'id': 1234
}
}
)

Alternatively, you can create a Verification with additional verification_options to include support for Truework Apply.

data = {
"type": "employment",
"permissible_purpose": "risk-assessment",
"target": {
"first_name": "John",
"last_name": "Doe",
"social_security_number": "123-12-1234",
"contact_email": "joesmith@example.org",
"company": {
"id": "1234"
}
},
"documents": [
{
"filename": "signed_auth_form.pdf",
"content": "iVBORw0KGgoAAAANSUhEUg......IhAAAAABJRU5ErkJggg=="
},
{
"filename": "verifier_notes.pdf",
"content": "iVBORw0KGgoAAAANSUhEUg......IhAAAAABJRU5FRSJghg=="
}
],
"verification_options": {
"methods": ["APPLY"]
}
}
verification = truework.verification_request.VerificationRequest.create(**data)

Whichever option you choose, hold on to your newly created verification. It contains a token — apply_token — that will be used by Truework Apply on the frontend.

verification.apply_token

Step 3: Integrate the frontend

The easiest method to Truework Apply into your frontend is to include our Truework.js library on all your pages. Insert a <script> tag into each page, before the closing <body> tag.

<script src="https://js.truework.com/truework.js"></script>
note

If you want to leverage Truework’s advanced functionalities, it’s recommended to include the Truework.js script in every page.

Create a Truework.js instance

In your Truework account settings, create a Public Key. Use it to create a Truework.js instance in your frontend.

const truework = window.Truework("tw_pk_123123123");

Create a Truework Apply instance

Retrieve your verification.apply_token from Step 2 — via API request, or another method of your choosing — and instantiate an instance of Truework Apply using your Truework.js instance.

const trueworkApply = truework.apply(applyToken);

Mount Truework Apply to a DOM node

Truework Apply can be mounted to any empty DOM node in your frontend.

trueworkApply.mount(document.getElementById("#truework-mount-element"));

Listen to lifecycle events

Truework Apply emits events to give developers fine-grained control of the application flow. For instance, you can use the complete event to take over when Truework Apply has finished.

trueworkApply.on("complete", function (event) {
if (event.error) {
// Handle issue
}
// Continue the application process, for example show a success message or move to the next page.
});

Step 4: Check the status of your Verification

You’re all set! Truework Apply will automatically handle Verifications of your customers. The status and results of Verifications can be accessed from your Truework account dashboard or by interfacing with the Truework API in your language of choice.

Webhooks

If you have webhooks configured for your application, you can use them to call your application code when the status of the Verification is updated.

Alternatively, using the one of our backend SDKs, you can attempt to retrieve the completed Verification Report. When it’s available it will return successfully.

report = truework.report.Report.retrieve(verification.id)

For more about the API, please click here to read the full documentation.