Tech

Publish MuleSoft RPA into Exchange and invoke it from a Mule API

Photo of Leonardo Cassimiro Written by Leonardo Cassimiro,   Aug 22, 2022

Robotic Process Automation (RPA) tools are designed to carry out all human repetitive tasks. Bots can retrieve information from legacy and modern applications and extract data from emails, documents and even web pages. They interact with applications using keyboard and mouse clicks just like we humans do. MuleSoft is a new player in the RPA market. MuleSoft RPA was released only a few weeks ago, and the great news is that it is fully integrated with MuleSoft Anypoint Platform and Composer.

In the first part of this post, I want to demonstrate the step-by-step process of publishing automation from MuleSoft RPA Manager to Anypoint Exchange. Moreover, I will show how to invoke process automation (Bot) from a Mule Application by using Anypoint Studio.

In the second part of this blog, you will learn how to deploy an application to CloudHub and add a callback URL to be executed after a bot completes execution I will also explain how to configure and invoke a bot via Composer.

 

Use case - Hello World

Known as the first example in nearly every programming language, why not start with the two most famous words “Hello World” for my first process automation integration with Anypoint Platform and Composer?

Before publishing the process automation asset to Exchange, we must create a Connected App with RPA Integrator scope configured in Access Management. We also have to connect the MuleSoft RPA Manager with the Anypoint Platform account. These steps are described below:

  1. Create a Connected App in Access Management.
  2. Connect MuleSoft RPA Manager with Anypoint Platform Account.
  3. Publish process automation from MS RPA Manager to Anypoint Exchange.
  4. Create a User API Key.
  5. Add the asset published in Exchange into the API.

 

1. Create a Connected App in Access Management

Below, I have listed the steps required to create a Connected App in the Anypoint Platform.

After you log in MuleSoft Anypoint Platform, open Access Management and click Connected Apps.

  1. Click Create App.

  2. Specify a Name for the Connected App (RPA), and in Type select App acts on its own behalf(client credentials).

  3. Click Add Scopes and enter RPA In the filter box, then select RPA Integrator and click Next.

  4. Select Business Group and click Review.

  5. Click Add Scopes to confirm and click Save.

RPA access management

After creating a Connected App, you need to copy the Id and Secret to configure RPA Manager to connect to the Anypoint platform.

connected apps

 

2. Connect MuleSoft RPA Manager with Anypoint Platform Account.

Once you have configured a Connected App in Access Management, you can connect MuleSoft RPA Manager with your Anypoint Platform account by following the following steps:

  1. Log in to MuleSoft RPA Manager.

  2. Open Organization Management and click Settings.

  3. Select the Anypoint tab.

  4. Click Configure Settings and provide the Connected App values (Id and Secret) for Client Id and Client Secret. For Domain enter the Anypoint Platform URL instance and click Next.

  5. Select the Anypoint Organization to connect to and click Finish.

Connect Mulesoft RPA Manager with Anypoint Platform Account- client details Connect Mulesoft RPA Manager with Anypoint Platform Account RPA Manager is connected with Anypoint Platform

RPA Manager is connected with the Anypoint Platform.

 

3. Publish process automation from MS RPA Manager to Anypoint Exchange

Using MuleSoft RPA Builder, I created simple process automation with a Message Box component to display the “Hello World” message passed by the “message” variable.

hello world automated process

Once the process automation is completed and is in the production phase, we need to create an Invokable production configuration by clicking the create an Invokable run production configuration button.

Provide a Configuration name and a short description and click Next.

automation process detailsSelect a Bot to deploy the process automation and click Save & Publish.

automation process resultProduction configuration is now configured, and the process automation is published in Exchange.

publish bot to MuleSoft Exchange

MuleSoft Anypoint ExchangeAsset published on Exchange.

 

4. Create User API Key

You are required to create a User API Key to integrate the RPA processes with your API.

  1. Log in to MuleSoft RPA Manager.

  2. Open User Management, click User API Keys and Create.

  3. Enter the details for the form Create User API Key and click OK.

Create user API keyCreate User API Key

 

5. Add the asset published in Exchange into the API

Now it is time to find the RPA process published in Exchange to add it to the project and invoke the Bot via my API flow:

  1. On Mule Palette click Search in Exchange

  2. Search by the RPA Process name (hello), click Add and once the dependencies are downloaded, click Finish.

    add dependencies to Mule projectAdd dependencies to project
  3. Drag and drop the startProcess into the flow and configure the Connector Configuration. Also add getProcessesExecutionStatus to the flow and a Transform Message to pass the “message” attribute as a variable to the Bot before startProcess processor as shown in the below example.

    add dependencies

    Add dependencies to Project.

  4. The properties.yaml file has the following values
    properties yaml file

Once the application runs, we can call the application to view the invoked bot.

Bot being invokedBot being invoked

What do you think? Would you agree that the process of publishing a process automation to MuleSoft Anypoint Exchange was quite straightforward? I found it easy to search and add the API dependencies to the project and configure and invoke the Bot deployed in MuleSoft RPA Manager.

 

In the second part of this blog, I will show you how to deploy the application to CloudHub. We will add a callback URL to be called after the bot finishes running and then we will configure and invoke the bot via MuleSoft Composer.

I hope you liked this post and see you in the next one :slight_smile:.

Meanwhile, why not explore how to build a bot? Take a look at our recent blog MuleSoft RPA in action, where we tested MuleSoft RPA by automating a simple process of extracting data from a spreadsheet and creating a new record into Salesforce.

We’d love to hear your opinion on this post