Step by Step Example

Example Overview

For this example, you have a UiPath automation that creates a simple expense record and wish to trigger it via your Humley Studio chatbot service. The following assumptions for this example are as follows -

Process Inputs

The 'hardcoded' inputs passed to the UiPath process in order to authenticate and to select the job & robot -

  • Domain
  • Username
  • Password
  • TenancyName
  • RobotID
  • ReleaseKey

End-user Inputs

The inputs gathered from the end-user and passed to the UiPath process -

  • Date
  • Type
  • Amount
  • Description

End-user Output

The process, when successful, creates the expense claim and returns an output with a wide range of data. The event output we will be returning to the end-user -

  • ExpenseID

In the following step-by-step example, we will :-

Duplicate and Modify a UiPath Integration

We need to duplicate and then modify the POST Start A Job With Arguments UiPath Integration to handle the four inputs.

Duplicate and Rename the Request

From the Integrations list page, find the POST Start A Job With Arguments Request, open the More menu and select Duplicate Request

Duplicate UiPath Request Humley Studio

The Request will be duplicated and appear on the Integrations list page below the original.

UiPath Request Duplicated Humley Studio

Find the duplicated POST Start A Job With Arguments (1) and click to open it. Edit the Request Name e.g to Start Job - Add Expense Line

Rename UiPath Request Humley Studio

Modify the Request

We will modify the Request Body to accept the end-user inputs.

Add the new Input Arguments

In the Body, you will see -

{
  "startInfo": {
    "ReleaseKey": "{ReleaseKey}",
    "Strategy": "Specific",
    "RobotIds": [
      {RobotId}
    ],
    "NoOfRobots": 0,
    "Source": "Manual",
    "InputArguments": "{}"
  }
}

Add four InputArguments to handle the four inputs -

{
    "startInfo": {
        "ReleaseKey": "{ReleaseKey}",
        "Strategy": "Specific",
        "RobotIds": [
            "{RobotId}"
        ],
        "NoOfRobots": 0,
        "Source": "Manual",
        "InputArguments": "{ 
            'date': '{Date}',
            'type': '{Type}',
            'amount': '{Amount}',
            'description': '{Description}'
          }"
    }
}

Input arguments must be strings, and the JSON within must be either escaped e.g. /"date/": /"{Date}/", or wrapped in single quotes (as shown above)

Edit UiPath Request Body Humley Studio

Add the new Request Parameters

Add four new parameters that you are referenced in the new Input Arguments you just added to the request Body.

Click the Request Parameters section to expand it an click Create Parameter

Enter in the sidebar -

  • Parameter Name Name the parameter - e.g. Date

  • Help Text Enter help text - e.g. Incurred date of expense to be passed to the Add Expense Line Job

  • Mandatory Parameter checkbox Keep checked

Add UiPath Request Parameter Humley Studio

In the sidebar, click Create Parameter to save your new request parameter.

Your new request parameter will be shown in the Request Parameters section's list.

UiPath Request Parameter Saved Humley Studio

In the same way as above, add the remaining three Request Parameters for Type, Amount, and Description.

UiPath Request Parameters Saved Humley Studio

Unlike a simple GET method call, we cannot be sure of an immediate response back from an API. We won't configure a response definition in this Request, therefore. The response will be handled asynchronously in the Flow by the UiPath Subscribe module.

Save the Request

Click Save Request

You'll see your new, renamed Request in the list.

UiPath Request Saved Humley Studio

Create the Flow

Create the Flow and set the its basic details.

From the Flow list page, click Create Flow

Enter in the sidebar -

  • Flow Name Name the flow - e.g. Add Expense Line

Add UiPath Flow Details Humley Studio

Click Create Flow in the sidebar to save these details

When the Flow is created, the Flow Canvas will be loaded.

Add UiPath Flow Details Humley Studio

Edit the Intro module

Every Flow starts with an Intro Module where you can inform the end-user that they're in a structured conversation, what's going to happen, and how to break out of it if necessary.

The Intro module will be automatically created.

Enter in the sidebar -

  • Introduction Message Enter the message - e.g. OK, to add an expense item, please enter some details...

Add UiPath Flow Intro Humley Studio

Click Save Module in the sidebar

Add Gather modules

Ask for information and record it in an Entity or a Variable. Set prompt, success, and failure responses.

In this example, we will start with the first required input - Date

Click the Add icon below the last module and select the Add Module option

Choose the Gather module-type in the sidebar

Enter in the sidebar -

  • Name Name the module - e.g. Gather Date

  • Entity/Variable Create an entity named @expenseDate

  • Prompt Enter the prompt to the end-user - e.g. What is the date of this expense? (DD/MM/YYYY)

  • Success Response Enter the response if the input is valid - e.g. Got it, thanks

  • Fail Response Enter the response if the input is invalid - e.g. Sorry, please enter the date of the expense in the following format - DD/MM/YYYY

Add UiPath Flow Gather Module Humley Studio

Add UiPath Flow Gather Module Humley Studio

Click Create Module in the sidebar

The new Gather module will be shown on your Flow's canvas

In the same way as above, add the remaining three Gather modules to capture expenseType, expenseAmount, and expenseDesc.

  • Create entities named @expenseType & @expenseAmount. We will give the three newly-created entities text or pattern values after finishing the Flow.

  • Create a variable named $expenseDesc as this will hold freetext, rather than a be constrained to valid text values or regex patterns.

UiPath Flow Gather Modules Added Humley Studio

Add an Integration module

Add an Integration module to the Flow that will trigger the UiPath Integration that starts the UiPath process.

Click the Add icon below the last module and select the Add Module option

Choose the Integration module-type in the sidebar

Enter in the sidebar -

  • Name Name the module - e.g. Add Expense Line

  • Request The integration Request that you want to run - e.g. Humley UIPath 1.1 / Start Job - Add Expense Line

Add Integration Module Details Humley Studio

When the Request is selected, more sections are revealed with labels relevant to that Request (see below)

Request Configuration section

Specify the entities or variables you are capturing in the flow, or free text, that will populate the UiPath Integration's request parameters.

The number of fields here will match the number of Request Parameters in the selected Request.

Enter in the sidebar -

  • Entity/Variable/Text The entity, variable or static text that you want passed to the corresponding request definition. The field's tool tip should explain the request definition's purpose.

    Start typing in the Search or Create field to either -

    • Create a new entity or unassigned variable (You shouldn't need to create any entities or variables in this module in this example as you've already created them in the Gather modules, above).

    • Select an existing entity or variable

    • Add a free text value

In this example, the method to use depends on the type of information we're passing to the UiPath process i.e. the data provided by the end-user, or the data needed to authenticate with UiPath and identify the job & robot.

Map End-user Inputs to the Request Parameters

In this example, we will pass some end-user information to the process that could be different each time. Therefore we need to use the values gathered earlier & held by entities and/or variables, and map them to the relevant Request Parameters (that you added to the Request earlier).

Click the Search or Create field -

  • Amount Choose the previously-created @expenseAmount entity

Map Amount Parameter Humley Studio

Repeat for -

  • Date Choose the previously-created @expenseDate entity

  • Description Choose the previously-created $expenseDesc variable

  • Type Choose the previously-created @expenseType entity

Map Authentication and Job/Robot to the Request Parameters

In this example, as the some of the information needed by the process will not change, we will 'hardcode' it into the Flow. We will map them to the relevant Request Parameters (that have been pre-configured in the Request that you have already modified).

Type freetext into the Search or Create field -

Map Domain Parameter Humley Studio

Repeat for -

  • Username Type a value - e.g. uipathteam@example.com

  • Password Type a value - e.g. UiPathpassw0rd

  • TenancyName Type a value - e.g. abcTenancy1

  • RobotId Type a value - e.g. 123456

  • ReleaseKey Type a value - e.g. 12345e00-77bd-4283-91c2-d12345ee01ab

Set Variables section

As mentioned previously, we need to wait for a response from the UiPath process. This will be handled by the UiPath Subscribe module, which will need to subscribe to an event linked to the specific Job started by this Flow. So, in this section we need to map the JobId that is returned to the Integration module and hold it in a variable e.g. $JobID which will be used in the Subscribe module to provide a link to the correct job.

Enter in the sidebar -

  • JobId Create a variable named $JobID

Configure Response section

As mentioned previously, we need to wait for a response from the UiPath process. The response to the end-user will be handled by the UiPath Subscribe module, so we don't need to map any fields in the Configure Response section here.

Enter in the sidebar -

  • Return Response checkbox Uncheck this checkbox so that no response is returned

The sidebar should look something like -

Fields Mapped Humley Studio

Fields Mapped Humley Studio

Fields Mapped Humley Studio

Click Create Module in the sidebar

The new UiPath Integration module will be shown on your Flow's canvas.

Integration Module Saved Humley Studio

Add a UiPath Subscribe module

Add a UiPath Subscribe module, to subscribe to UiPath events and asynchronously receive event data back from the UiPath process.

In this example we are interested in Job.OutputArguments.ExpenseID from the job.completed event for the Add Expense Line job that we will trigger in the Flow -

Click the Add icon below the last module and select the Add Module option

Choose the UiPath Subscribe module-type in the sidebar

Enter in the sidebar -

  • Name Name the module - e.g. Subscribe to Job Completed Event

Input Configuration section

Specify the details you are providing for the Events Subscription.

Enter in the sidebar -

  • TenancyName Type a value - e.g. abcTenancy1

  • Username Type a value - e.g. uipathteam@example.com

  • Password Type a value - e.g. UiPathpassw0rd

  • Domain Type a value - e.g. https://platform.uipath.com

  • Events The events you wish to subscribe to (comma separated) - e.g. job.completed

  • Constraints The constraints (comma separated) - e.g. Type=job.completed,JobId=$JobID

  • 'Restrict to first event' checkbox Check to close the subscription after the first response (defaults to checked) The example process will only return results once, so keep this checked

Output Configuration section

Specify the variable that will be populated with all the data passed back from the subscribed events, and the Success and Error Responses

Enter in the sidebar -

  • Variable The variable that will be populated with the data passed back from the subscribed events. Unlike Integration modules, there is only one variable field as this will capture the entirety of the event's output.

    Start typing in the Search or Create field to either -

    • Select an existing variable

    • Create a new variable (If you create a variable from here, it will be unassigned. Once you've finished building your Flow, you may need to Assign the Variable to an Entity).

In this example, we will need to create a new unassigned variable - e.g. $subscriptionResult

  • Event Message The response given to the end-user following a successful response from the subscribed events - e.g. Your expense claim has been recorded under $subscriptionResult.Job.OutputArguments.ExpenseID

  • Subscription Error Response The response given to the end-user following a failed response from the subscribed events - e.g. Sorry, an error occurred so no ExpenseID can be given. Please contact accounts@abc-corp.com about this expense claim.

Add Subscribe Module Details & Inputs Humley Studio

Add Subscribe Module Details & Inputs Humley Studio

Click Create Module in the sidebar

The new UiPath Subscribe module will be shown on your Flow's canvas

Save the Flow

Save your finished Flow to ensure you don't lose your work.

Click Save Flow in the sidebar

Your new Flow will be shown on the Flow list page

Flow Saved Humley Studio

Remember, the Flow has to be triggered by an Intent. You will need to create a Flow-type Intent and then train the knowledge base to recognise that intent before you can test it in the Test Client. If necessary, refresh your understanding of how to Create a Flow Intent.

Modify the new Entities

Consider modifying the @expenseType, @expenseDate, and @expenseAmount entities that were created when the Flow was being built in order to set acceptable ranges for the inputs captured by those entities.

Add Text Values for the @expenseType Entity

For the @expenseType entity, you can set as many valid text values as necessary. In this example, valid expense types are Meals, Travel, and Phone.

From the Entity list page, select the @expenseType entity.

Select Type Entity Humley Studio

Click the Text Value type to create a new Text Value.

Add Text Value Humley Studio

Enter in the sidebar -

  • Value Name Name the value - Meals

  • Alternative Text (optional) Add alternative text values (or synonyms) for the base text Value Name - e.g. Food, Breakfast, Lunch etc. User input that matches this alternative text will be accepted, but the base text Value Name (Meals) will be stored.

Add Text Value Names Humley Studio

Click Create Value

Your new text value will be shown in the value list for the @expenseType entity.

Entity Text Value Saved Humley Studio

In the same way as above, create Text Values (with Alternative Values if needed) for Travel and Phone. Your new text values will be shown in the value list for the @expenseType entity.

Entity Text Values Saved Humley Studio

Add Pattern Values for the @expenseDate and @expenseAmount Entities

From the Entity list page, select the @expenseDate entity.

Select Date Entity Humley Studio

Click the Pattern Value type to create a new Pattern Value.

Add Pattern Value Humley Studio

Enter in the sidebar -

  • Value Name Name the value - DD/MM/YYYY Date

  • Pattern (optional) Add a regex (regular expression) for this value (the following restricts the input to DD/MM/YYYY) -

    ^([0-2][0-9]|(3)[0-1])(\/)(((0)[0-9])|((1)[0-2]))(\/)\d{4}$

Add Pattern Value Name & Regex Humley Studio

Click Create Value

Your new pattern value will be shown in the value list for the @expenseDate entity

Entity Pattern Value Saved Humley Studio

In the same way as above, add the following Pattern Value to the @expenseAmount Entity -

Enter in the sidebar -

  • Value Name Name the value - Currency Amount (2 decimals)

  • Pattern (optional) Add a regex (regular expression) for this value (the following restricts the input to numbers with 2 decimal places) -

    ^\d+\.\d{2}$

Your three new Entities will appear on the Entity list page once saved.

Entity Pattern Values Saved Humley Studio

Further help

Getting Started with UiPath
Pre-built Integrations
Subscribe Module within Flow

Still need help? Get in touch!
Last updated on 16th Dec 2019