UiPath: Integrating UiPath Studio and Arria NLG Studio — JSON-type Projects

Documentation for Arria NLG’s Custom Activity for UiPath Studio

This guide takes you through the process of setting up a UiPath sequence that loads data from a JSON file and passes the data to Arria NLG Studio, which then delivers a narrative to be used in subsequent activities.

The Arria Connect custom activity allows you to seamlessly connect your UiPath implementation to Arria NLG Studio.

Using this activity, you call an NLG service (a published NLG Studio project) with data passed down from an upstream activity. The resulting narrative is then available to be consumed by a downstream activity, for delivery somewhere else.

This document guides you through the process of setting up a UiPath sequence that loads data from a JSON file and passes it on to Arria NLG Studio, which then delivers a narrative.

It is organized as follows:



What can Arria Connect do for my automation?

Let’s assume you want to automate something you write – your daily stock portfolio email, weekly sales summary report, or bespoke customer response. You can make this happen by using Arria Connect activities and Arria NLG Studio. In any situation where you want to generate a narrative describing a dataset and then use that narrative inside your automation workflow, Arria Connect activities make it easy, thanks to collaboration with NLG Studio. In NLG Studio, you design the narrative required for your automation, and then grab it from Arria using the API.

In this example you will:

  • publish a simple NLG Studio sample project (Monthly Sales) to narrate a dataset
  • download a text file containing a sample dataset for the Monthly Sales project (typical sales data), and read it from UiPath Studio
  • from UiPath Studio, call an Arria NLG service, sending it the sample dataset and receiving from it a narrative describing the dataset
  • from UiPath Studio, save the narrative to a text file

Note: In this guide, we provide you with a ready-made sample NLG Studio project and dataset, then focus on describing the Arria Connect custom activities. When you are ready to create your own NLG Studio projects and design your own narrative scripts, get started with our comprehensive tutorials. There are endless ways you can integrate NLG Studio narratives with your existing or proposed automation workflows: for ideas, check our Samples library.


Configure an Arria NLG Studio project and download its sample data

For this example, we’ll use an Arria NLG Studio monthly sales analysis project and sample dataset.

Download the NLG Studio starter project and sample data

1. Download the sample Monthly_Sales_Data dataset and extract the JSON file from the ZIP.

This dataset contains typical monthly sales figures.

2. Download the Monthly_Sales NLG Studio starter project and extract the JSON file from the ZIP.

You’ll use this project to generate a narrative to describe the dataset.

Preview the NLG Studio sample project and publish it

1. In NLG Studio, import the starter project you downloaded.

a. In the top right of the screen, click Import Project.

b. Browse to select the Monthly Sales project you downloaded, the click Open.

2. In the dashboard, open the project.

3. In the left navigation bar, click Compose to go to the starter scripts provided.

4. Click Preview to view the script’s output. You should see the following narrative:

Note: In order for you to be able to generate this preview, the Monthly Sales project comes preloaded with the Monthly Sales Data sample dataset you downloaded. When you later call this project from UiPath Studio, the narrative generated will describe whatever dataset you send to it (providing it is formatted appropriately).

5. Now we’ll publish the project to an API endpoint, secured by an API key, so that we can call it from UiPath.

a. In the left navigation bar, click Publish to go to the Publish view.
b. Go to Publish > Run Project and click Publish.
You’ll need the published project’s URL later, so copy it (you can click the copy icon on the right of the URL box) and paste it to a notepad.
c. Go to Publish > API > API Key and click Generate API Key.
You’ll also need the published project’s API Key later, so copy and paste it in your notepad, too.

Note: To learn about creating NLG Studio projects from scratch and writing your own scripts, get started with a free trial and the Arria NLG Studio documentation and tutorials.


Download and install the Arria Connect package

Add Arria Connect to UiPath Studio

1. Sign up to get the Arria Connect custom activity package on the UiPath Go! website.

2. Copy the package to a local folder (e.g. C:\UiPath\MyPackages).

3. In UiPath Studio, go to Settings in the left navigation bar, then select Manage Sources and add a new user-defined package source.

a. In the Name field, below User defined package sources, type Arria.
b. In the Source field, click the ellipsis (…) to browse for the folder that you saved the Arria Connect package to and click Select Folder.
c. Click Add.

Install Arria Connect in a new project

1. In UiPath Studio, click Start > New Project > Process.

2. Give the new project a name (e.g. ConnectWithArria) and click Create.

3. Open the Main Workflow.

4. In the Design tab, click the Manage Packages icon.

5. Click All Packages, and select ArriaConnect.

6. Click Install, and then click Save.

The Arria Connect package is added to your new project. In the Activities panel, under Available, you will see the Arria Connect custom activity in your list.


Create and run an automation workflow

Add a Read Text File activity to read the sample data from the JSON file

1. From the Activities panel, drag the System > File > Read Text File activity into the Main workflow screen and enter the path to the Monthly_Report_Data.json file you downloaded earlier.

2. Create a variable to store the sample dataset read from the Monthly_Report_Data file.

Select the sequence that encapsulates the Read Text File activity and create a string variable named inputData in the Variables panel. Its scope will be set to Sequence by default.

3. Now select the Read Text File activity and insert the inputData variable in the Output > Content field of its Properties panel.

Note: As long as the dataset passed to the NLG Service is structured appropriately, it can come from any upstream activity and does not need to be saved to a file before assigning to a variable.

Add and configure the Arria NLG Application Scope

This is where you’ll set the URL and API key required to access your published Monthly Report project, then assign variables to send data to it and receive a narrative from it.

1. From the Activities panel, drag the Arria Connect > Arria NLG Application Scope and drop it into the sequence directly after the Read Text File activity.

2. Drag the Call NLG Service JSON activity into the Do container.

3. Select the Arria NLG Application Scope.

Copy the URL and API Key for your published NLG Studio project that you saved earlier and paste them into their corresponding fields in the Properties pane, making sure they’re wrapped in quote marks.

Note: If you do not wrap both strings of text in quotation marks, the Properties pane will report a compiler error:

4. Now select the outermost sequence and create another string-type variable in the Variables panel, this time named outputNarrative.

This will store the returned narrative.

5. Select the Call NLG Service JSON activity.

Assign the inputData variable to the Input > JSON Data field and the outputNarrative variable to the Output > Narrative field.

Add a Message Box activity to output the narrative

1. From the Activities panel, drag the System > Dialog > Message Box activity and drop it into the sequence directly after the Arria NLG Application Scope activity.

2. Assign the outputNarrative variable to the text field of the Properties pane. The completed sequence should look like like this:

Save and run your sequence

1. Click Save and then Run.

The narrative is displayed (in HTML format) in the Message Box:

When the HTML code above is rendered, it will look like this:

2. Try changing the Output Type property of the Arria NLG application Scope activity from HTML to TEXT to see how the narrative changes.