Integrating MuleSoft with RPA and IDP for Enhanced Business Automation

MuleSoft with RPA and IDP
Integrating MuleSoft with RPA and IDP for Enhanced Business Automation

Ali Akthar

Middleware Practice Head 

August 24, 2024

Fastrack Your Journey to Complete Automation with MuleSoft

Introduction: Why Companies Need MuleSoft with RPA and IDP

Integrating MuleSoft with RPA and IDP can significantly enhance business automation, enabling organizations to streamline processes, reduce manual effort, and improve efficiency. MuleSoft’s API-led connectivity approach, combined with the automation capabilities of MuleSoft RPA and the advanced data extraction capabilities of MuleSoft IDP, creates a powerful synergy for modern enterprises.

MuleSoft with RPA and IDP

Key Concepts of MuleSoft with RPA and IDP

Before we explain how users can utilize MuleSoft with RPA and IDP to boost business automation, we need to clarify some key concepts.

  • MuleSoft: MuleSoft is a leading integration platform that provides tools for building application networks. Its API-led connectivity approach allows for seamless integration of applications, data, and devices, enabling businesses to create a unified and connected ecosystem.
  • RPA: Robotic Process Automation (RPA) involves using software robots (bots) to automate repetitive and rule-based tasks. RPA can mimic human actions to interact with digital systems and applications, performing tasks such as data entry, transaction processing, and report generation.
  • IDP: Intelligent Document Processing (IDP) leverages AI technologies like machine learning (ML) and natural language processing (NLP) to extract and process information from structured and semi-structured documents automatically. IDP can handle documents such as invoices, purchase orders, and contracts, converting them into structured data. Enterprises can achieve business automation by seamlessly integrating these three advanced technologies through MuleSoft with RPA and IDP integration solutions.

Benefits of MuleSoft with RPA and IDP Integration

  • Improved Efficiency: Integrating MuleSoft with RPA and IDP automates end-to-end business processes, reducing the time and effort required for manual tasks. This leads to faster processing times and increased operational efficiency.
  • Enhanced Accuracy: By automating data extraction and processing, the MuleSoft with RPA and IDP integration reduces the risk of human error, ensuring higher accuracy and reliability of data.
  • Scalability: The MuleSoft with RPA and IDP solution can quickly scale to handle increased volumes of transactions and documents, supporting business growth without a proportional increase in manual effort.
  • Flexibility: MuleSoft’s API-led approach enables flexible and modular integration for MuleSoft with RPA and IDP, allowing businesses to quickly adapt to changing requirements and integrate with new applications and systems.

Implementation Strategy for MuleSoft with RPA and IDP

Step 1: Define Use Cases

Identify the business processes that will benefit the most from automation. Everyday use cases include invoice processing, customer onboarding, order management, and compliance reporting.

Step 2: Design the Architecture

Design an integration architecture that leverages MuleSoft’s capabilities for connecting applications and data sources, MuleSoft RPA for automating repetitive tasks, and IDP for extracting information from documents.

Step 3: Develop APIs and Integrations

Use MuleSoft to create APIs and integrations that connect various systems and applications. Ensure that the APIs are designed to facilitate easy interaction between MuleSoft with RPA and IDP solutions.

Step 4: Implement RPA Bots

Develop RPA bots to automate repetitive tasks identified in the use cases. Use RPA tools like UiPath, Automation Anywhere, or Blue Prism to create and deploy the bots.

Step 5: Integrate IDP Solutions

Implement IDP solutions to extract and process data from documents automatically. Integrate these solutions with MuleSoft to ensure seamless data flow between IDP, RPA, and other systems.

Step 6: Test and Optimize

Conduct thorough testing to ensure the MuleSoft with RPA and IDP solution works as expected. Optimize the workflows and integrations to achieve maximum efficiency and accuracy.

Example Use Case of Integrating MuleSoft with RPA and IDP: Invoice Processing

  • Document Ingestion: Use an IDP solution to ingest and extract data from incoming invoices. The IDP system captures vital information such as invoice number, date, vendor details, and line items.
  • Data Integration: MuleSoft APIs facilitate the flow of extracted data from the IDP system to an ERP system for further processing. MuleSoft ensures that the data is transformed and mapped correctly to the ERP system’s data model.
  • Automation with RPA: MuleSoft RPA bots automate invoice data validation and entry into the ERP system. The bots can also handle exceptions and discrepancies, such as missing or incorrect information, by interacting with other systems or triggering human intervention if necessary.
  • Approval Workflow: MuleSoft with RPA and IDP manages the integration with the approval workflow system, ensuring that invoices are routed to the appropriate approvers based on predefined business rules.
  • Payment Processing: Once approved, the payment processing is automated using MuleSoft RPA bots, which handle the creation of payment records and initiate the payment process through the banking system.

How to get started with MuleSoft IDP

Before analyzing documents with MuleSoft IDP, you must create and publish document actions and configurable schema definitions containing the necessary instructions for processing your documents.

Once a document action is published to Anypoint Exchange, you can programmatically call the MuleSoft IDP API to execute the action and extract data from a document. This process involves the document action analyzing the provided document and returning a JSON response with all the extracted fields. Additionally, you can query the IDP API at any time to check the status of an execution.

Document Processing

A document action is a multi-step process that utilizes multiple AI engines to scan a document, filter out fields, and return a structured response in JSON format. Each document action specifies the types of documents it expects as input, the fields to extract, and the fields to exclude from the response. You can hide fields, mark fields as required, set a minimum confidence score for each field to extract and configure Prompts to enhance and refine the data extraction process by asking questions in natural language.

MuleSoft IDP offers preconfigured templates for Invoices and Purchase Orders to assist in creating custom document actions. Each template provides a set of expected fields to extract from the document into a structured response. When creating a new document action, select the type that best matches the document to be processed. For example, the Invoice type can handle invoices, receipts, and similar documents. If none of these types fit your documents, use the Generic type to fully customize the fields to extract by using natural language questions.

Once you create a document action, publish it to Anypoint Exchange to make it available for consumption by RPA and through the MuleSoft IDP API.

Review

Document actions return a JSON response containing the extracted fields and their detected values. Each value has a confidence score that determines its accuracy during the extraction.
A document is queued for review if any of the following conditions is met:
  • At least one non-hidden field shows a confidence score lower than the configured threshold.
  • After a reviewer verifies and approves the result, the execution status changes to SUCCEEDED.

MuleSoft IDP API

You can initiate executing any published document actions to analyze the provided documents and query the results using the IDP API. Ensure you have a configured connected app to call the IDP API.

MuleSoft with RPA and IDP Integration

You can execute your published document actions and query the results using the Submit Document to MuleSoft IDP and Retrieve Results from MuleSoft IDP action steps from MuleSoft RPA. You must configure a connected app to call IDP and publish your document actions to make them available to MuleSoft RPA.

Integrating MuleSoft IDP with Anypoint Studio

Execute a published document action and retrieve the results from Anypoint Studio using that document action’s IDP Runtime Service API connector. This connector generates automatically when you publish a document action to Anypoint Exchange. Then, you can download it as a Mule connector from Exchange.

Each document action version generates a different connector. For example, when you publish a document action for the first time, it generates a connector in Exchange that executes version 1.0.0 of this document action. Then, suppose you modify the document action and republish it as version 1.1.0. In that case, it generates a different connector, which you must download and install in Studio to execute this new document action version. Consider this behavior when building your integrations.

The IDP Runtime Service API connector has the following operations:
  • getDocumentActionExecution Retrieves the result of a document action execution.
  • postDocumentActionExecution Submit a document to IDP for processing.

Before You Begin

Ensure you have the following MuleSoft Anypoint permissions:

Execute Published Actions

Enables a user to execute a published document action and retrieve the execution results.

Configure Connected Apps

Enables a user to configure a connected app to communicate with IDP. If you already have a connected app configured for IDP, you don’t need the Configure Connected Apps permission, and you can use your existing connected app instead of creating a new one.

Create a Connected App

To communicate with the IDP API, create a connected app with the following details:
  • Type: App acts on its behalf (client credentials)
  • Scopes: Execute Published Actions after you create the connected app, copy its ID and Secret for further use when you obtain the access token.

Obtain the Access Token

After you configure the connected app, use the following curl command to get the token: curl –location –request POST ‘https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token’ \ –header ‘Content-Type: application/json’ \ –data-raw ‘{ “grant_type”: “client_credentials”, “client_id”: “<connected-app-client-id>”, “client_secret”: “<connected-app-client-secret>” }’
If you are in the EU region, use the eu1.anypoint.mulesoft.com domain. Replace <connected-app-client-id> with the client ID from your connected app. Replace <connected-app-client-secret> with the client secret from your connected app. Use the access token when calling the IDP API.

Configure the IDP Runtime Service API Connector

Before using its operations, configure the connector by providing the following values, either manually or through a Global Configuration Element:
  • Host: Anypoint endpoint URL
  • For example: https://idp-rt.{region}.anypoint.mulesoft.com
  • port: HTTP port for the connection
  • For example: 443
  • basePath: The base path of the URL to call, without the protocol
  • protocol: Protocol for the call, in uppercase
  • For example, HTTPS
  • Response timeout: Response timeout for this operation
  • clientId: Client ID of the connected app to call IDP
  • clientSecret: Client Secret of the connected app to call IDP
  • accessTokenUrl: URL to obtain the access token for your connected app
  • For example https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token

Configure the IDP Runtime Service API Connector

Before using its operations, configure the connector by providing the following values, either manually or through a Global Configuration Element:
  • Host: Anypoint endpoint URL
  • For example: https://idp-rt.{region}.anypoint.mulesoft.com
  • port: HTTP port for the connection
  • For example: 443
  • basePath: The base path of the URL to call, without the protocol
  • protocol: Protocol for the call, in uppercase
  • For example, HTTPS
  • Response timeout: Response timeout for this operation
  • clientId: Client ID of the connected app to call IDP
  • clientSecret: Client Secret of the connected app to call IDP
  • accessTokenUrl: URL to obtain the access token for your connected app
  • For example https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token

Submit a Document to IDP

Use the postDocumentActionExecution operation to send a document to IDP and execute the corresponding document action version. Specify the details of the request in the Postdocumentactionexecution request data field of the connector. The following is a sample request:
				
					%dw 2.0

output multipart/form-data

---

{

parts: {

callback : {

headers : {

"Content-Type" : "text/plain"

},

content : '{"noAuthUrl": "https://{yourCallbackURL}.com"}'

},

file : {

headers : {

"Content-Disposition" : {

"name": "{fileName}",

"filename": "{myFile.jpg}",

"subtype": "form-data"

},

"Content-Type" : "image/jpg"

},

content : payload

}

}

}
				
			
The response from this operation contains the execution ID that you must use to retrieve the execution results.

Retrieve the Results of the Execution

Use the getDocumentActionExecution operation to get the results of a document action execution by specifying its execution ID. The following is a sample response from this operation, shortened for better readability:
				
					{

"id": "d68e099e-8d37-4188-905a-0eac68b7bf61",

"documentName": "invoice-1.jpg",

"status": "SUCCEEDED",

"pages": [

{

"page": 1,

"fields": {

"invoiceDate": {

"value": "1 June, 1983"

},

"invoiceNumber": {

"value": "8248"

}

...

},

"tables": {

"table1": [

{

"unitPrice": {

"value": ""

},

"price": {

"value": "$ 198.00"

}

...

}

]

},

"prompts": {

"business": {

"prompt": "what is the company main business",

"source": "document",

"answer": {

"value": null

}

}

}

}

]
				
			

Processing Documents and Retrieving Results With MuleSoft RPA

You can execute your published document actions with MuleSoft RPA by using the Submit Document to MuleSoft IDP and Retrieve Results from MuleSoft IDP action steps in your automation projects. After you publish a document action to Anypoint Exchange, it becomes available for consumption in RPA. You must create a connected app and obtain the access token before using the IDP action steps in RPA.

Before You Begin

Ensure you have the following Anypoint permissions:
  • Execute Published Actions: Enables a user to execute a published document action and retrieve the execution results.
  • Configure Connected Apps: Enables a user to configure a connected app to communicate with IDP.

Create a Connected App

To communicate with the IDP API, create a connected app with the following details:
  • Type: App acts on its behalf (client credentials)
  • Scopes: Execute Published Actions
After you create the connected app, copy its ID and Secret for further use when you obtain the access token.

Obtain the Access Token

After you configure the connected app, use the following curl command to get the token:
				
					curl &#8211; location &#8211; request POST 'https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"grant_type": "client_credentials",
"client_id": "&lt;connected-app-client-id&gt;",
"client_secret": "&lt;connected-app-client-secret&gt;"
}'

				
			
Replace <connected-app-client-id> with the client ID from your connected app. Replace <connected-app-client-secret> with the client secret from your connected app. Use the access token when calling the IDP API.

Execute the Published Document Actions

Use the Submit Document to MuleSoft IDP action step in MuleSoft RPA to execute the published document actions. This step lets you browse and execute your published document actions by providing an Execution ID and the path to the file to process. Use the Execution ID when configuring the Retrieve Results from MuleSoft IDP action step to pull the results from the execution.

The Submit Document to MuleSoft IDP action step executes document actions by impersonating a user in your organization. Therefore, you must use a user’s authentication credentials with the Execute Versioned Actions permission in the MuleSoft Anypoint Platform.

Leverage the MuleSoft with RPA and IDP Solution Successfully with Royal Cyber

Integrating MuleSoft with RPA and IDP provides a comprehensive solution for automating complex business processes. Organizations can significantly improve efficiency, accuracy, and scalability by leveraging MuleSoft’s integration capabilities, RPA’s task automation, and IDP’s advanced data extraction. This integrated approach enables businesses to navigate the challenges of digital transformation and stay competitive in a rapidly evolving landscape.

Companies can find this task overwhelming when integrating MuleSoft with RPA and IDP. Therefore, consulting experts who have worked on such enterprise projects is best. And that’s where Royal Cyber comes in. Contact our team for more information on ensuring a successful implementation of MuleSoft with RPA and IDP by emailing us at info@royalcyber.com.

Author

Priya George

 

Recent Blogs
  • How to Write Test Cases: Introduction and Best Practices
    Learn to write effective test cases. Master best practices, templates, and tips to enhance software …
    Read More »
  • MuleSoft Admin Co-Pilot: Revolutionize Integration Management
    In today’s fast-paced digital landscape, seamless data integration is crucial for business
    Read More »
  • Revolutionizing Customer Support with Salesforce Einstein GPT for Service Cloud
    Harness the power of AI with Salesforce Einstein GPT for Service Cloud. Unlock innovative ways …
    Read More »