We’ll start by creating a scenario to build the flow that will ingest documents, process them through natif.ai, and add to DocuWare.
natif.ai + DocuWare Template
As a means of simplifying the process we are currently creating a Template with the basic layout pre-configured. You can take this template as a starting point, create a Scenario from it and follow the step-by-step guide quicker.
After connecting your natif.ai and DocuWare accounts, the template scenario is almost ready to successfully run. It will still be required to configure a mapping of tabular output from the natif.ai API to the DocuWare tray, but this Guide will explain this procedure step by step.
How to build our Scenario
1. Adding your data source
To begin, our scenario will require some data source, for our purposes here we’ll use an e-mail watch trigger from the e-mail module provided by Make. For our purposes we’ll configure it to watch our invoices folder.
This trigger will run the scenario for every new mail item that arrives in our invoices folder, forwarding each mail bundle to the successive steps. What we want to process from each of these bundles, are the attachments on each e-mail which contain our invoices.
We can use the Make Iterator Node from the Flow Control Toolbox to process this attachment list and pass each of these files to the natif.ai extraction plugin one-by-one.
Additionally, as the tool group suggests, this will provide control over the rate at which you forward documents to the natif.ai API.
2. Connecting your natif.ai account
Next we’ll configure the Natif.ai plugin by linking it to our account on our platform
To do this we’ll need an API key, which can be generated by navigating to the API keys page, clicking the New API key button, and following the dialog.
We can then select the expected document language and the desired extraction API; for the purposes of this walkthrough we’ll be using the Invoice Information Extraction API.
As an intermediate step, we’ll need to process an actual document through the Make system. This will provide Make with some actual extraction data as provided by natif.ai, and will allow the Make system to understand the output data from the natif.ai api which we will then use as inputs for the succeeding Make steps.
To do so, ensure an unread e-mail that matches our configured trigger exists in the invoice folder and run the Make workflow once. The e-mail watcher will then select any unread e-mails and process the attached invoice files.
Make has now inferred, how the invoice extraction data from natif.ai looks.
3. Connect natif.ai to DocuWare
Finally, we import the invoice file together with the natif.ai extractions into DocuWare using DocuWare’s own Make module.
How we connect our natif.ai module to the DocuWare module depends on what data we wish to extract. If only singular values are desired, we can link the natif.ai module directly to the DocuWare module and map values from the natif.ai module directly to DocuWare Dialog fields.
However, one of the more exciting extractions from the natif.ai Invoice Information Extraction is the tabular listing of line items. To provide this information in a more convient bundle, we’ll utilize a few additional modules, first to iterate over the natif.ai extraction data, and then to create a JSON string to be mapped to the DocuWare module.
The Iterator module is used to process each line item from our extraction and pass it on to the JSON Aggregator to be processed.
Attention: Since data from the module directly before the JSON aggregation module can be lost, we have to make sure that we use the iterator as source.
4. Add a tabular field in DocuWare
In order to receive and display the line-items in your document tray, a respective tabular field has to be created. This can be done by creating a new Database field in your target DocuWare File Cabinet; make not of the Database names as well need to use this in the following step.
You will then want to add this new field to the DocuWare Dialog you’ll use when uploading your document.
5. Define a Data Model
For tabular data to be imported into a DocuWare field it needs to reflect the column names as defined in your DocuWare field. We can leverage Make’s Data Model ability to map the line_items extracted by natif.ai into the column format DocuWare expects.
This data model can now be used by Make’s Extract JSON node to output the desired data format.
The JSON string produced can now be used directly in the Positionen field of the DocuWare Store to File Cabinet module to allow the extracted line_items to be attached as part of the invoice document to be uploaded.
We now have all of the elements needed to map all of the extracted information from the Natif.ai module to the DocuWare module. We’ll use a Store To File Cabinet module as it supports the mapping of the JSON string we just created to our Positionen table field.
Technically, the other store actions indicate they also support providing JSON strings as the value of a Table field, however during our testing this feature was not functional in the other store actions.
In the configuration window we will use the Select option rather than map as this will allow use to select our Storage Dialog ID from our DocuWare account. We’ll then need to map the fields extracted by the natif.ai system to values understood by the Storage Dialog.
In our example, we’re storing to the Eingangsrechnungen Storage Dialog, as such we map the value field of the name field held under vendor of our Extraction information to our Storage Dialog’s Firmenname, the value field of the vat_id field held under vendor of our Extraction information to our Storage Dialog’s Steuernummer, etc.
It is not advised to make any fields which may be mapped to an extraction field required. Since the data extracted is transient and may not always be present in every extraction, your workflow may break if you make such fields required.
For more information about the various fields in Extraction, and other response structures, you can visit the developer documentation.
Your Make workflow, integrating our natif.ai API and DocuWare, is now ready to be used. To test it simply run the scenario, send any number of invoice documents to your Webhook email address, and observe your DocuWare tray.