FileMaker OCR Integration with Veryfi

By Cath Kirkland, 18 July 2023

Veryfi OCR

Introduction

Hey there!

Are you tired of spending countless hours manually entering data from documents? 

Check out OCR for a little slice of magic! OCR (Optical Character Recognition) is a fantastic technology that can transform printed or hand-written text into JSON format that can then be easily used to populate FileMaker records. 

In this example we will use the paid web service by Veryfi to read invoice documents but there are many other OCR services available.  Our choice to use Veryfi was mostly based on the standard JSON reponse they return.

Are you ready to get started? Let's dive in! Download the example file below:

Download the example file

 

 

What You Will Need

First, you will need to create an account with Veryfi. 

https://app.veryfi.com/signup

You have 14 days to use this account for free with limitations. After this point you will need to create a paid account, or add billing details to your own.

Next, go to the Settings → Keys page and create a new API key

https://app.veryfi.com/api/settings/keys

 

 veryfi 0

The information you will need to record from this page includes the following: 

 

veryfi 1  

Now you have all the tools you need, create a layout and add a container field for receiving the document you want to read.

 

veryfi 2

The file contents will need to be Base64 encoded to include into the cURL which we will build up and send to Veryfi. 

 

veryfi 6 

Now we have the contents of the file all nicely packaged up into a variable. Veryfi requires two pieces of information to be sent. The file name and the encoded file. Build up your data string like so escaping the quotes as needed.

 

JSONFormatElements (

"{

  \"file_name\": \"" & GetContainerAttribute ( HOME::fileadd_dragdrop ; "filename" )& "\"" & 

  ", \"file_data\": \"application/pdf;base64, " & $file & "\"" &

"}" 

)


End result required: 

 

veryfi 5 

Veryfi supports the following file types  .pdf, .htm, .jpeg, .avif, .heic, .gif, .webp, .txt, .html, .heif, .ofd, .png, .jpg, .zip with a maximum file size of 20mb.

 

 

Sending the Request

Next we want to build up the CURL request.  In this case we are using a POST and sending the authorization details of our API key and account set up earlier.

 

"-X POST" & ¶ &"-H \"Accept: application/json\"" & ¶ &

"-H \"Content-Type: application/json\"" & ¶ &

"-H \"CLIENT-ID: " & $clientid & "\"" & ¶ &

"-H \"AUTHORIZATION: apikey " & $account & ":" & $apikey & "\"" & ¶ &

"--dump-header $responsestatus "   & ¶ & //gets us a response code

"-d @$Data" & ¶ &

"--trace $$trace “ [Optional; used for troubleshooting]



Now use Insert from URL to send the request

 

veryfi 4 

 

In this case we are setting the response into the $Response variable so you can check this for a valid response of 201.

The document will be returned as JSON listing out elements such as but not limited to:

 

veryfi 3

 

 

Want To Know More?

Check out Veryfi's documentation for further information on the JSON response or other details.

https://app.veryfi.com/api/docs/

  

 

Example File

As mentioned, we always include an example file with our articles to help you learn and explore. We spend a lot of time on these so please do check it out.

Click here to download the example file

 

Something to say? Post a comment...

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

Categories(show all)

Subscribe

No Tags