DocAI Power Automate Connector

Introduction

The DocAI Power Platform Connector allows you to easily integrate Zuva’s machine learning technology into your Power Automate flows.

Prerequisites

You will need a Zuva account and a DocAI token. Get started by signing up for a free account.

You will also need a Microsoft account and Power Automate licence.

How to get credentials

Zuva DocAI has multiple regional servers. You will need to create an API token for the specific region that you wish to use.

  1. Create and/or sign into your account at zuva.ai.
  2. Navigate to the DocAI console
  3. Select the region you would like to use.
  4. Copy the base URL for the region to your connection.
  5. Create a token and copy it to use in your connection.

See the DocAI quickstart guide for more information about Zuva accounts and tokens.

Get started with your connector

To use the Zuva DocAI connector, you can create a flow similar to the following:

Step 1: Obtain a file

For testing purposes, you can create an “Instant cloud flow” in Power Automate. Choose “Manually trigger a flow” and create the flow. Add an input, and choose the “File” type.

Step 2: Submit a file

Add a new action to your flow and start typing “Zuva” into the search box. You should see the Zuva DocAI connector and all of it’s actions appear.

Add the Submit a file action, and choose the “File Content” from the previous step as the input.

Note: the file should not be transformed in any way (i.e, no base64 encoding). DocAI only accepts raw binary data.

Step 3: Start processing the file

Choose which service you’d like to use by adding one of the following actions:

  • Create Language Classification Request
  • Create Document Classification Request
  • Create Multi-Level Classification Request
  • Create Field Extraction Request
  • Create OCR Request

Each of these accepts the file ID (returned from the Submit a file action) as input.

The field extraction additionally requires field IDs as inputs. Field IDs can be found in the Field Library (sign-in required), from AI trainer if you have trained custom fields, or programmatically using the Get Field List action.

Step 4: Poll for completion of the request

Use a Do Until block (found in the “Control” section), and add the correct status check action to the inside of the block:

  • Get Field Extraction Request Status
  • Get Language Classification Request Status
  • Get Document Classification Request Status
  • Get MLC request Status
  • Get OCR Request Status

The Get ____ status action takes as input the request ID from its corresponding Create ____ Request action.

You should also add a 10 second Delay block inside the Do until block, to ensure that the file has sufficient time to process.

Set the condition for the Do Until block to Is Finished? is equal to true.

Step 4: Get results

Finally, use one of the Get results Action corresponding to your request, using the Request ID from the original Create operation as input:

  • Get Field Extraction Request Text Results
  • Get Language Classification Request Status
  • Get Document Classification Request Status
  • Get MLC request Status
  • Get OCR Results Text
  • Get OCR Results Images

Note that for Language, Document Classification and MLC, the results are included in the Status response.

You may wish to check the DocAI documentation for more information about the structure of field extraction results.

Example flow

The following flow takes in a file, extracts a single field from it and sends an email with the raw JSON results.

Basic Power Automate Flow

Known issues and limitations

Fields per request

A maximum of 100 fields may be included in a single Create Field Extraction Request action.

Custom fields

The connector does not support any of DocAI’s endpoints related to training custom fields or getting an individual field’s metadata.

Differences with underlying API

Additionally, please note that connector functionality does not correspond one-to-one with the documentation for the underlying API. In particular, the connector:

  1. Exposes an extra is_finished boolean, which can be used to tell if the request is either complete or failed
  2. All requests operate on single files, rather than batches of multiple files.

Common errors and remedies

Be sure to upload raw binary, rather than base64-encoded strings. You can use the OCR service and check that it returns the expected text.