UiPath: Integrating UiPath Studio and Arria NLG Studio
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 CSV file and passes that on as table data to Arria NLG Studio, which then delivers a narrative to be used in subsequent activities.
This documentation is organized as follows:
- What can Arria Connect do for my automation?
- Download and configure the Arria Connect package
- Customize an Arria NLG Studio starter project
- Create the automation workflow
- Configure the Arria Application Scope and the Call NLG Service activity
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.
- You have installed UiPath Studio (Community Edition or the enterprise version).
- You have basic knowledge of using UiPath Studio.
- You have an Arria NLG Studio account. (Get started with a free trial.)
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 see how to:
- Access a CSV file with an example dataset (typical sales data)
- Create a simple Arria NLG Studio project (Describe a Table) to narrate the dataset
- Save the narrative into a text file
Note:In this guide, we focus on the Arria Connect UiPath activities. There are endless ways you can integrate narratives with your existing or proposed automation workflows. For ideas, check our Samples library.
We also do not cover Arria NLG Studio concepts in detail. To learn more, try our comprehensive tutorials.
To download and configure the Arria Connect package:
- Contact Arria to request the Arria Connect package for UiPath Studio.
- Copy the package to a local folder (e.g.
- In UiPath Studio, click Start > New Project > Process.
- Give the new project a name (e.g. Connect with Arria) and click Create.
- In the Design tab, click the Manage Packages icon.
- Add a new package source:
- Click Settings.
- Under User defined package sources, in the Name field, type Arria.
- In the Source field, click the ellipsis (…) to browse for the file location of the Arria Connect package you downloaded.
- Click Add.
- Click All Packages, and select the ArriaConnect package from the list.
- Click Install, and then click Save. The ArriaConnect package is installed into the project. In the Activities pane, under Available, you should see the Arria Connect custom activity in your list.
To get an Arria NLG Studio starter project:
- Download the sample dataset. This typical sales dataset contains sales and profit figures for years, products, and the countries and market segments where these products are sold.
- Download the Arria NLG Studio starter project. You’ll use this NLG Studio project to output a narrative for the dataset.
To set up your NLG Studio project:
- In NLG Studio, import the starter project you downloaded.
- In the top right of the screen, click Import Project.
- Browse to select the starter project you downloaded, then click Open.
- In the dashboard, click the Arria Starter Project for UiPath – Table Type Data card to open the project.
- In the left navigation bar, click Compose to go to the starter project’s scripts.
- In the list of sub-scripts under the Main script, click the ReadMe script.
- Click Preview to check the ReadMe script’s output.
- Click Done to exit the preview.
- In the Main script, delete the call to ReadMe, then copy/paste the following ATL script:
For the [[inflectNoun('year',len(unique(Year)))]] [[unique(Year)]], the total sales were [[formatCurrency(totalVal(Sales),currency,'#.00')]] and the total [[direction(totalVal(Profit) ,'profit','loss' )]] was [[formatCurrency(abs(totalVal(Profit)),currency,'#.00')]]. The best-selling product was [[getKey(topNInstancesbyDimension(Product,Sales,1))]] with a total of [[formatCurrency(getValue(topNInstancesbyDimension(Product,Sales,1)),currency,'#.00')]]. The [[getKey(topNInstancesbyDimension(Segment,Profit,1))]] segment reported the most [[direction(getValue(topNInstancesbyDimension(Segment,Profit,1)), 'profit','loss')]] ([[formatCurrency(getValue(topNInstancesbyDimension(Segment,Profit,1)),currency,'#.00')]]).
- Click Preview. You should see the following narrative:
This section explains how to create your automation workflow in UiPath.
To read the data from the CSV file:
- Find the Read CSV activity (under App Integration > CSV) then drag and drop it into the Main screen.
- Provide the path to the sample data file that you downloaded earlier (
- In the Properties pane, from the FilePath field, copy the CSV file name (the FilePath).
- In the Main pane, select the Read CSV activity, and paste in the FilePath.
You should see the activity and the sequence as shown:
- In the sequence that encapsulates the Read CSV activity, create a new DataTable type variable called inputData. The scope of the variable should be Sequence.
- In the Properties panel on the right of the screen, under Output, set the DataTable property to inputData (the name of the variable you have just assigned the loaded CSV file to). This variable will hold the data read from the activity, which can be passed to the Arria Call NLG Service.
- Add the Arria NLG Application Scope to the sequence. This is where you set the URL and the API key for the published NLG Studio project.
- In the Activities panel, in the Arria Connect group, find the Arria NLG Application Scope activity.
- Drag and drop it into the sequence after the Read CSV activity.
- Bring the Call NLG Service Table activity into the Do activity.
To call your NLG Studio project as part of the workflow:
- In Arria NLG Studio, publish the project you created and generate its API key.
- Click Publish > Run Project.
- Make a note of the published project URL.
- Click Publish > API.
- Make a note of the API key.
- In UiPath, select the Arria NLG Application Scope, then from the Properties pane, copy/paste in the published project URL and the API key. Note: Both strings of text must be wrapped in quotation marks when you enter them in the Properties pane.
To configure the calling of the NLG service:
- In the outermost sequence, create a variable.
- Give it the name outputNarrative.
- Specify the variable type as String.
- In the activity, select the Call NLG Service Table activity.
- In the Properties pane, assign both inputData and outNarrative variables.
To output the narrative using a Message Box activity:
- Add a Message Box activity to the sequence and assign the outputNarrative variable to the Text attribute.
- In the Activities pane, click the arrows beside System > Dialog to find the Message Box activity.
- In the Sequence pane, assign the outputNarrative variable in the Text attribute.
The completed sequence should look like this:
- Click Save. Now you’re ready to run the sequence.
- Click Run to start the process. The narrative is displayed in the Message Box.
- Try changing the Output Type in the Arria NLG Application Scope, and see how the narrative changes.
Here you can create the content that will be used within the module.