Subscribe Module within Flow

Gaining access to the UiPath features on Humley Studio will, on the creation of a new project, load a number of pre-configured UiPath-specific Variables, and UiPath Integration modules to be used within a Flow.

The UiPath Subscribe module is also made available within Flow, allowing you to wait for and receive event data back from a UiPath process.

Before continuing, you may want to refresh your understanding of how standard Integrations are built by reading About Integrations and how they are called within Flow by reading more About Flow & how to Create a simple Flow.

Overview

Using our pre-built integrations you can control you robots, processes, etc but in order to receiving updates throughout their lifecycle you can use our UiPath Subscribe module found within flow. Add this module to a Flow where you need to subscribe and receive event data back from a UiPath process.

For example, when you start a job, this job may take a few minutes to complete, by using our subscribe module you can inform your users when the job has faulted or completed.

How to use the subscribe module

You can interact with your UiPath processes via a Flow by referencing an Integration :

  • First create an Integration by duplicating, then modifying, one of the pre-built UiPath Integrations

  • Then create a Flow that includes an Integration module that references your modified Request

  • Add a UiPath Subscribe module to your Flow (if you need to receive event data back from a UiPath process asynchronously)

Module Fields

When configuring a UiPath Subscribe module you will be presented with two sections, one section to configure the input details and another to configure the output.

Input Configuration section

Field Description
Module Name A friendly name for the module
Tenancy Name Your UiPath Tenacy Name
Username The unqiue identifier of the newly created job
Password A key that relates to the newly created job
Domain Represents the name or domain\name of the machine on which Orchestrator is installed, or the user account, such as docteam or uipath.local\docteam
Events The events that you wish to subscribe to
Constraints Filters on the result provided from each subscribed event
One-Time Use If the webhook connection should be terminated after first use - checked by default.

Output Configuration section

Field Description
Variable A friendly name to help you recongise the module later
Event Message The full result as returned from UiPath - presented as a JSON Object
Subscription Error Messgae The unqiue identifier of the newly created job

Event Configuration

The event field allows you to subscribe to any number of events using a webhook at UiPath. You can find more information about the different types of events here.

In order to configure multiple events within the configuration field you must comma-seperate them. For example:

job.created, job.started, job.faulted

There is currently a known issue where you must specify a type and cannot have multiple event types in a single subscription

During this stage, we're subscribed to all events of a particular type. In order to filter this down further we'll use the constraints field to show your end-users specific content only. More information on contraints can be found below.

Constraints Configuration

The Constraints Configuration section allows you provide specific filters of what should be shown within your experience. As mentioned previously, in the events field we have subscribed to a number of different events based on their type. In order for us to filter these down further, we can add constraints. This allows you target filters on multiple items that are presented within the JSON provided as an output for event. For example in the event of job.completed, the following response would be provided:

   {
       "Type": "job.completed",
       "EventId": "c61eae1c50c74ab192ba49def7311c65",
       "Timestamp": "2019-07-02T15:24:46.1699691Z",
       "Job": {
           "Id": 10976846,
           "Key": "12345e00-77bd-4283-91c2-d12345ee01ab",
           "State": "Successful",
           "StartTime": "2019-07-02T15:24:39.823Z",
           "EndTime": "2019-07-02T15:24:46.1387195Z",
           "Info": "Job completed",
           "OutputArguments": {
               "ExpenseID": "ID-123456"
           },
           "Robot": {
               "Id": 123456,
               "Name": "Expense Robot",
               "MachineName": "ABC-RPA1"
           },
           "Release": {
               "Id": 155725,
               "Key": "12345e00-77bd-4283-91c2-d12345ee01ab",
               "ProcessKey": "AddExpenseLine"
           }
       },
       "TenantId": 54321,
       "OrganizationUnitId": 12345
   }

For example if we wished to only show messages related to a particular job, we could do this by creating the following constraints:

Type=job.completed,Job.Id=$JobID

where $JobID is the variable used to capture the JobId returned in the response from the UiPath Integration module that ran the UiPath process just previously.

Variable & Event Message

When we configure how our event output should be shown to an end-user, we have to configure three fields - Variable, Event Message & Subscription Error.

Variable

Variables are used to capture the result that is returned by the event. The event response is returned in JSON - we must store this in a variable which allows us to format it as we want later on.

An example of how we can tie the variable and event message together - in the event we configured a subscription to the following event:

job.completed

and then configured the constraints to be:

Type=job.completed,Job.Id=10976846

We are looking for any events that are related to job completions in relation to the job id of 10976846. In the event that we have an event that matches this, the response would look like this:

   {
       "Type": "job.completed",
       "EventId": "c61eae1c50c74ab192ba49def7311c65",
       "Timestamp": "2019-07-02T15:24:46.1699691Z",
       "Job": {
           "Id": 10976846,
           "Key": "12345e00-77bd-4283-91c2-d12345ee01ab",
           "State": "Successful",
           "StartTime": "2019-07-02T15:24:39.823Z",
           "EndTime": "2019-07-02T15:24:46.1387195Z",
           "Info": "Job completed",
           "OutputArguments": {
               "ExpenseID": "ID-123456"
           },
           "Robot": {
               "Id": 123456,
               "Name": "Expense Robot",
               "MachineName": "ABC-RPA1"
           },
           "Release": {
               "Id": 155725,
               "Key": "12345e00-77bd-4283-91c2-d12345ee01ab",
               "ProcessKey": "AddExpenseLine"
           }
       },
       "TenantId": 54321,
       "OrganizationUnitId": 12345
   }

If we use a variable $result we would be setting it with the JSON returned by the event. Once we have set the variable, we can use it in the Event Response field (see below).

Event Response

Let's assume we wanted to create a message that informed the end-user of a job completing, as follows:

Job 10976846 has completed

In order to configure this we would need to add the following in the Event Message response field:

Job $Result.Job.Id has completed

We access items in the variable using standard JSON notation, by first having $Result equal to the entire object returned by the UiPath event. We then dig deeper by targeting an individual key - in the above example, targeting Job.Id within the overall result.

Let's assume we wanted to create a message that informed the end-user of a specific output argument, as follows:

Your expense claim has been recorded under ID-123456

In order to configure this we would need to add the following in the Event Message response field:

Your expense claim has been recorded under $result.Job.OutputArguments.ExpenseID

We access items in the variable using standard JSON notation, by first having $Result equal to the entire object returned by the UiPath event. We then dig even deeper by targeting an individual key - in above example, targeting Job.OutputArguments.ExpenseID within the overall result.

Subscription Error Message

The subscription error message is provided to an end-user when we are unable to subscribe to any given event that was specified within the subscribe module. This is not linked to the Event Message, and is instead related solely to the Subscribe module action.

Further help

Getting Started with UiPath
Pre-built Integrations
Step by Step Example

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