Journeys with Document Verification

How to Use DocV within Journeys

If a customer's identification documents need to be verified during the application process, you can use a document verification node.

If a Journey arrives at a document verification node, the application pauses so that the documents may be uploaded and verified before advancing. To upload the documents, you can either directly make a request to the Documents endpoints (see API Reference), or you can use the the Alloy Documents SDK.

Once the documents are uploaded and you have obtained the document token for each document, you can then advance the journey by making a PUT request to journeys/:journey_token/applications/:application_token with the document tokens.

1. Get your SDK Key
Ensure you have your SDK key. If you don't have a key, please contact us.

2. Create a Document Verification Workflow

  • Assign the following input attributes with data type “string”:
    • document_token_back
    • document_token_front
    • document_token_selfie

3. Configure a Journey with a Document Verification Node
Next, configure a Journey with a document verification node, selecting the document verification workflow that you have created.

  • See how to setup a Journey here

Once the new Journey has been created, in its page, set up Journey nodes.

First, choose the type of workflow you would like to add by selecting your choice under the Workflow tab. Then, add DocV to the relevant outcome by clicking the + icon text to that outcome, Navigating to Document Verification and selecting DocV.

This DocV node places the Journey in a “Pending Documents” state, which is what you would see if you were to ping Journeys to check the current state.

Your code should be set up such that when a Journey hits a Pending Documents state, the DocV SDK is then triggered. See the sample code below

Handling an Application for a Journey that Includes a Document Verification node

  • Create an application for the Journey with the document verification node that you have created
  • Verify that the application has successfully advanced along the path that leads to the document verification node by doing either of the following:
    • Verify that the journey_application_status is now pending_documents by making a GET request to /journeys/:journey_token/applications/:application_token (see Get an Application)
    • Verify that this status is displayed in the journey application UI as “Pending” (app.alloy.co/v3/dashboard/journeys/:journey_token/applications/:application_token/)
  • Upload the documents to the Alloy server by using the Alloy Documents SDK, or by directly making a request to the documents endpoints (see Describe a Document Before Uploading
    and Upload Document)
    - For the entity token required by the requests, you must use the entity token of the first child entity of the application. You can find this value either by the entity on the journey application page (app.alloy.co/v3/dashboard/journeys/:journey_token/applications/:application_token/), or in the journey application GET response at the path response.body._embedded.child_entities[0].
    - Once successfully uploaded, you can view these uploaded documents among all uploaded documents for this entity on the entity page (app.alloy.co/entities/:entity_token/?tab=documents)
  • Advance the journey by making a PUT request to journeys/:journey_token/applications/:application_token with the document tokens you obtained in the last step (e.g., POST entities/:entity_token/documents returns a document token)
    • Successful response from this endpoint means that the the evaluation for the specified document verification workflow has started
  • Verify that the application has properly advanced by making another GET request or viewing the appliation in the UI at app.alloy.co/v3/dashboard/journeys/:journey_token/applications/:application_token/

Example PUT Request

curl --request PUT \
     --url https://demo-qasandbox.alloy.co/v1/journeys/:journey_token/applications \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     -u workflow_token:workflow_secret \
     --data '{
     "entities": [
         {
             "data": {
                 "name_first": "Test",
                 "name_last": "Person",
                 "document_token_back": "xyz",
                 "document_token_front": "xyz",
                 "document_token_selfie": "xyz"
             }
         }
       ]
     }'

Example Multi-Entity PUT Request

curl --request PUT \
     --url https://demo-qasandbox.alloy.co/v1/journeys/:journey_token/applications \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     -u workflow_token:workflow_secret \
     --data '{
     "entities": [
         {
             "data": {
                 "name_first": "Test",
                 "name_last": "Person"
                 "document_token_back": "xyz",
                 "document_token_front": "xyz",
                 "document_token_selfie": "xyz"
             },
             "entity_type": "person",
             "branch_name": "persons"
         },
         {
             "data": {
                 "name_first": "Person",
                 "name_last": "Test"
                 "document_token_back": "xyz",
                 "document_token_front": "xyz",
                 "document_token_selfie": "xyz"
             },
             "entity_type": "person",
             "branch_name": "persons"
         }
       ]
     }'

With the advent of Journeys, all events are within one application rather than being separate evaluations!


Did this page help you?