# Set up an identity verification process flow with the Analyze Image step

The Know Your Customer (KYC) process is often used by companies that need to verify a customer’s identity.&#x20;

In this guide, you’ll learn how to set up your KYC process using the **Analyze Image** step in[ Flow Builder](https://dashboard.messagebird.com/en/flow-builder).

We’ll show you how to build a flow that asks the user for a photo of their passport, extracts the relevant KYC data, and stores it in a safe location so that it can be reviewed and verified by you.&#x20;

Before you start, make sure that you’re familiar with the [image quality best practices.](https://docs.bird.com/connectivity-platform/how-to-guides/how-to-automatically-parse-receipts-in-flow-builder#h_01fgs1dhcke0r17h3e07gvrncj)

&#x20;

### Privacy & data protection

If you're extracting sensitive information from an image, such as details from a passport for the purposes of identity verification, you need to make sure that you're following a proper privacy policy.

You are responsible for and must secure all necessary notices, permissions, and consents to collect, use, and share people's content and information, including maintaining a published privacy policy, and otherwise complying with applicable law.

Check out the [WhatsApp Business Policy](https://www.whatsapp.com/legal/business-policy/?lang=en) for specific WhatsApp usage guidelines.

&#x20;

### Requirements&#x20;

* A [MessageBird account ](https://dashboard.messagebird.com/en/sign-up)
* [WhatsApp for Business account](https://www.messagebird.com/whatsapp/) or any other channel from [MessageBird's offering](https://dashboard.messagebird.com/en/channels)
* A workflow to handle the messages—[Flow Builder ](https://dashboard.messagebird.com/en/flow-builder)
* A Google Sheet to store the extracted data
* An [**Inbox account**](https://inbox.messagebird.com/) (optional)

&#x20;

### Step one: Insert the Analyze Image step

1. Go to the flow that you want to use, or set up a new flow.
2. Add the **Analyze Image** step under the flow’s trigger.&#x20;
3. Go to the step’s settings on the right-hand side of the screen.
4. In the **Image URL** field, enter **{{messageImage}}**. When a user sends an image from their smartphone, that image will be made available in the flow at the URL contained in the **{{messageImage}}** variable.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-27fbd6528896e4b10afd9d786eb4ff7ba2220185%2FAnalyze_Image_step.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
5. In the **Image content to recognize** field, select **Document** from the drop-down menu.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-430ce1343db23dcfe738a70c41bbd6a0486f640c%2FImage_content_to_recognize.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
6. In the **Document type** field, select **Passport** from the drop-down menu.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-0785c7256f7ed39ed2d81785f50d984407f1790e%2FDocument_Type.png?alt=media" alt=""><figcaption></figcaption></figure>
7. In the **Output variable** field, enter **image\_content**. This specifies the output variable that will carry the payload that the step recognizes.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-d17ae8af3842c8dab1c60491db2c924b57a1aa46%2FOutput_variable_2.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
8. Click **Save**!

&#x20;

### Step two: Check if the passport extraction was successful

If the Analyze Image step was unable to successfully extract passport data, you’ll probably want the user to upload another image. To do this, follow these steps:

1. Add a **Branch** below the **Analyze Image** step.
2. Go to the branch settings on the right-hand side of your screen. Select **Custom condition** from the drop-down menu.&#x20;
3. Under the **If…** condition that appears, enter **{{image\_content}}**, or drag and drop the **image\_content** parameter into the first field.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-a85b8026a35c29d4279adaa9dd10b54d188a4003%2FScreenshot_2021-02-03_at_15.37.29.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
4. From the drop-down menu below, select **is empty or not set**, then click **Save**.<br>
5. Add a **Reply to channel message** step below the image content branch that you just set up.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-f2d6735c5cfc28752c7de0b6feecc5489068e681%2FScreenshot_2021-02-02_at_16.10.55.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
6. Go to the step settings on the right-hand side. Select **Text** from the **Message type** drop-down menu, then add a helpful message to the **Reply with message** field. This message aims to get the user to send a new photo so that the text can be extracted!<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-4a6064b438d4d66adfb5c7ccddaf803c14a61362%2FScreenshot_2021-02-03_at_15.42.09.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
7. Add a **Wait for a response** step below the **Reply to channel message** step that you just set up.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-7e45dd784afeaa5f9eb13b8e3f6fb110fd1880de%2FScreenshot_2021-02-02_at_16.47.07.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
8. Go to the step settings on the right-hand side. Select how long you want to wait for a response.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-54bdad9497a99564d377a89a60b0dab700d70209%2Ftimeout_duration.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
9. In the **Response variable name** field, enter a recognizable value, such as **passport\_response**, then click **Save.**
10. Add a **Set variables** step below the **Wait for a response** step that you just set up. This step will set the **incoming\_message** variable to be equal to the variable that will store their response.<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-0eb5cbee0ab95f0afca7837f43c17a7d98a8fca4%2FScreenshot_2021-02-02_at_16.53.24.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
11. Go to the step settings on the right-hand side. In the **Name** field, enter **incoming\_message**.
12. In the **Value** field, enter **{{passport\_response}}**, or drag and drop **passport\_response** from the available variables, then click **Save**.<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-4cd96d338df086e1cc312158b2ce9f5514d1df22%2Fvariables_passport_response.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
13. Finally, add a **Jump to** step below the **Set variables** step you just set up. This step will funnel any responses to the **Reply to channel message step** back to the **Analyze image** step so that the flow can try to detect and extract text from the user’s new photo.<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1108d21f892798070f59747521557f8dc05128a6%2FScreenshot_2021-02-03_at_11.00.36.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
14. Go to the step settings on the right-hand side. Click **Pick step to jump to**, then click the **Analyze image** step in your flow.<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-a6986964021816981c44aefb173889756453c655%2FScreenshot_2021-02-03_at_10.56.16.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
15. Optional: Choose how many times you want this jump to be repeated per customer. By default, the number of jumps is set to 250, giving your customer 250 attempts to upload a suitable photo of their passport!<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-d7fd16e9c114c0aea049f2d4b2bc24d5357279a1%2FScreenshot_2021-02-03_at_10.59.55.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
16. Click **Save** to save the step.

&#x20;

### Step three: Store the extracted data in a Google Sheet

1. Create a Google Sheet with the following columns:
   * First name
   * Last name
   * Nationality
   * Gender
   * Personal number
   * Date of birth
   * Passport number<br>

     <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-cc5795bca825e28c7ab62f01e2297e41bafa39da%2Fgoogle_sheet.png?alt=media" alt=""><figcaption></figcaption></figure>

     <br>
2. Add an **Add row in Google Sheets** step under the **Else** branch.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-f8d93fdc697e0a4df38de3104a148d1b5a7122ad%2Fgoogle_sheets_step.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
3. Go to the step settings on the right-hand side. Click on **Select Google Sheet.**\ <br>
4. In the pop-up window, locate your Google Sheet by selecting your Google Account, Google Drive, Google Sheet document, and Tab/Worksheet name.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-e65a14d82301fc694a6b85d3fc7d3a8ef78e2d23%2Fgoogle_sheets_detailed_settings.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
5. Click **Save settings**. The names of the columns in your Google Sheet will appear in the step settings on the right-hand side of your screen.
6. Starting with **Column A - First Name**, or drag and drop the **image\_content** variable into the field.
7. Click on the curly brackets and select **first\_name** from the options that appear. The field should now look like this:<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-e5f6c485a78d989b09187dc47afdeb79cc6c6d2c%2Ffirst_name.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
8. Repeat this step for the other fields in the settings, making sure that you add the corresponding addition to each **image\_content** variable, as shown in the image below.<br>

   <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-a2217c25cf79fb902f17611fd34b76c2a7117e0b%2FScreenshot_2021-02-03_at_12.39.10.png?alt=media" alt=""><figcaption></figcaption></figure>

   <br>
9. Click **Save** to save the step
10. Add a **Reply to channel message** step below the **Add row in Google Sheets** step you just set up.<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-28b44b5918ed1b20d19aad83f812b5cd62c34ff6%2FScreenshot_2021-02-03_at_12.48.55.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
11. Go to the step settings on the right-hand side.  Select **Text** from the **Message type** drop-down menu, then add a message to the **Reply with message** field, letting the user know that their image upload has been successful.<br>

    <figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-1d05f0ce47054061975d191d9f8bd54213bb4a72%2FScreenshot_2021-02-03_at_12.44.04.png?alt=media" alt=""><figcaption></figcaption></figure>

    <br>
12. Click **Save** to save the step
13. Finally, add the **End of flow** step to the end of the flow to complete
14. **Publish** your flow.&#x20;

This is what your completed flow should look like. Go ahead and test your flow! 🎉

<figure><img src="https://675349995-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUJNEE9TMK4fU91VKstBr%2Fuploads%2Fgit-blob-9381e9dd21cc38a44d4d5ae2b64726483dc6345e%2FScreenshot_2021-02-03_at_16.07.12.png?alt=media" alt=""><figcaption></figcaption></figure>
