Skip to Content
Technical Articles

Integrate your enterprise email inbox with Document Information Extraction Service via SAP Cloud Integration

Introduction 

Many organizations are using generic enterprise mailboxes to receive emails from their customers, suppliers and other parties, such an email address could for example be info@companyname.com . Via those enterprise mailboxes organizations receive different types of emails, like requests, feedback, orders and much more. The received emails also often contain different types of attachments, for example documents which must be processed further within the organization.  

The automation of processing relevant business documents can increase productivity of organizations and reduce manual tasks. To automate the processing of relevant business documents the SAP AI Business Service Document Information Extraction can be leveraged.  

With the newly released SAP Cloud Integration package SAP provides an integration flow, which connects an enterprise email inbox with Document Information Extraction. The integration flow checks the configured email inbox folder for newly received emails every 30 seconds, picks up the unread emails and processes them one after another. During the processing the attachment is extracted and send to the Document Information Extraction service. The extracted information is sent back to an email address which can be configured within the integration flow.

Figure%201%3A%20Process%20overview

Figure 1: Process overview

This integration package can help you to kick-start any scenarios which involve email inbox processing, even when your scenario looks slightly different. One example is the blog post about Handling incoming Orders with SAP Cloud Platform which describes a more complex order entry scenario. This scenario also includes further decision and workflow logic via SAP Cloud Platform Business Rules and SAP Cloud Platform Workflow 

If you are new to Document Information Extraction, you can check out the previous Document Information Extraction blog post; I would also recommend you to check out the official help documentation for Document Information Extraction. 

If you are new to SAP Cloud Platform Integration I would also recommend you to check out the official help documentation forSAP Cloud Platform Integration. 

Let me now explain you how exactly you can setup the integration between your email inbox and Document Information Extraction using SAP Cloud Platform Integration.  

Setting up Document Information Extraction  

In order to use Document Information Extraction, you need to create a service instance and service key.

You can use this booster to create the Document Information Extraction instance and its service key quickly in just a few steps. 

Configuration of the SAP Cloud Integration Flow 

The integration flow which integrates Document Information Extraction Service with the email server is available on SAP API Business Hub. 

In order to activate and use the integration flow you need to have SAP Cloud Platform Integration enabled. In case your SAP Cloud Integration is not setup you can follow this tutorial. 

If this prerequisite is met, you can follow the steps below to configure the SAP Cloud Integration for Document Information Extraction service. 

User Credentials Setup 

You need to access the Manage Security Material section in order to create new user credentials for the Document Information Extraction integration: 

1.) Go to Manage Security Material section in SAP Cloud Integration. 

Figure%202%3A%20Manage%20Security%20Material%20Section

Figure 2: Manage Security Material Section

2.) Click Createand select User Credentials”. 

Figure%A03%3A%A0Select%20User%20Credentials

Figure 3: Select User Credentials

 

3.) Add User Credentials with the following settings and click Deploy”

  • Input Name as DOX_USER 
  • Select Type as User Credentials. 
  • Input User with <clientid> from the Document Information Extraction service key JSON file. 
  • Input Password with <clientsecret> from the Document Information Extraction service key JSON file. 

Figure%204%3A%20Create%A0User%20Credentials

Figure 4: Create User Credentials

Populate an Integration Flow Artifact 

In this step we discover and copy the integration package for Document Information Extraction service into your SAP Cloud Integration tenant 

1.) Enter the “Discover section of SAP Cloud Integration and use the search to search for “SAP AI Business Service Document Information Extraction. 

Figure%205%3A%20Discover%20Package

Figure 5: Discover Package

2.) Copy the package named SAP AI Business Service Document Information Extraction Integration with Email Server”.  

Figure%A06%3A%A0Copy%20Package

Figure 6: Copy Package

 

3.) Once the package is copied, go to the Design view and search for SAP AI Business Service Document Information Extraction Integration with Email Server. Select the displayed entry.  

Figure%207%3A%A0Display%20Package

Figure 7: Copied Package

4.) In the package SAP AI Business Service Document Information Extraction Integration with Email Server you should be able to see one integration flow artifact. 

Figure%208%3A%A0Integration%20Flow

Figure 8: Integration Flow

  1. Select Configure for this integration flow artifact. 

Figure%A09%3A%A0Select%20Configure

Figure 9: Select Configure

 

Integration Flow Configuration for Mailbox 

In this step we configure the email inbox settings of the integration flow in integration package for Document Information Extraction service. 

1.) In the Sender section configure your email inbox settings of the email inbox you want to integrate with Document Information Extraction.

Figure%A010%3A%A0Mail%20Sender

Figure 10: Mail Sender

2.) In the Receiver section configure the receiver entries for FinalStatusEmailUnsupportedAttachmentMail and ProcessFailedMail”. These three receivers should be configured one after another, depending on the processing flow, you can have a different email where the final extraction results are received from the ones which will receive a notification that the processing during the extraction failed or the attachment is in unsupported format. 

Figure%A011%3A%A0Receiver%20Email

Figure 11: Receiver Email

Please check our documentation for detailed configuration options and how you can connect your email server to the Cloud Integration. 

Integration Flow Configuration for Document Information Extraction Service 

In this step we configure the Document Information Extraction Service for  the integration flow in integration package for Document Information Extraction service. 

1.) In the Receiver section configure the OAuth_Server: 

  • Input Address as url from the uaa section of the Document Information Extraction service key JSON file. 
  • Input Query grant_type=client_credentials 
  • Input Credential Name with DOX_USER, the credentials name created. 

Figure%2012%3A%A0Receiver%20DOX

Figure 12: Receiver DOX

 

2.) In the More section configure the Parameters: 

  • Input Client ID as the client ID you would like to use from the Document Information Extraction service. If you have not created a client in the Document Information Extraction service yet, you can create one by using the client API of Document Information Extraction 
  • Input Document Type as the document type you would like to process. Please check the supported document types that Document Information Extraction can process. 
  • Input DOX Service URL as url  from the Document Information Extraction service key JSON file and add /document-information-extraction/v1 at the end.

Figure%2013%3A%A0Configure%20Parameters

Figure 13: Configure Parameters

Integration Flow Deployment

After configuration of the integration package the last step is to deploy the integration flow in integration package for Document Information Extraction service.

Figure%2014%3A%A0Deploy%20the%20integration%20flow

Figure 14: Deploy the integration flow

After the integration flow is started you can send an email to the configured email inbox in Sender part. The extracted results will come back to you. 

Conclusion 

This blog post shows how easy one can consume and combine the SAP Cloud Integration with Document Information Extraction Service as a basis to automatically process received documents from an enterprise email inbox. 

Credit to Tim Nusch, Tomasz Janasz, Jana Wuerth who helped me drafting this blog post.

1 Comment
You must be Logged on to comment or reply to a post.
  • Superb Nina. Glad to see SAP offers such an easy to configure, yet powerful, integration content out-of-the-box for our customers to easily consume the services from SAP Cloud Platform.