Integrating Using Robot.JS
Interacting with your personal, locally installed UiPath robot is now easier than ever, thanks to the integration of Robot.JS framework in Druid webchat resources.
Prerequisites
-
Robot.JS resources are built-in for Druid Portal landing page and for Druid web chat widget (using the snipped code from AI Agent Designer menu)
-
If the AI Agent is hosted directly in an external custom web page, then the following Robot.JS resources must be included in the web page script:
<script src="https://download.uipath.com/js/1.1.1/UiPathRobot.js"></script>
The UiPath Assistant must be installed on the same machine where the AI Agent is accessed.
The UiPath Process(es) must be published in the UiPath Assistant.
The Druid entity [[RobotJsInput]] must be defined and must include the following mandatory fields, with fixed names:
- ProcessName
- CallbackUtterance
- You need to have a Callback Flow created.
How triggering an attended process works
Configuration
Triggering a local process and transferring structured data between the AI Agent and the UiPath robot can simply be managed by a dedicated Back Channel (BC) type flow step – RobotJsStartProcess.
No connector actions or internal actions are needed in order to trigger the UiPath process. All configurations are made within the Flow Designer.
Flow Configuration
The Back Channel flow step RobotJsStartProcess is the element which will trigger the UiPath Process via the UiPath Assistant. To do that, the UiPath Process Name and any utterance of the Druid flow used for callback must be provided to the Back Channel flow step, using the [[RobotJsInput]] entity.
A simple flow configuration might look like this:
When the conversation reaches the Back Channel step, the UiPath Assistant will be called (using built-in Robot.JS functionality) to start the Process <ProcessName>.
UiPath Assistant Authorization
The first interaction between the browser and the UiPath Assistant will trigger an authorization process:
Click Open UiPath Assistant. The UiPath Assistant access request pop-up appears.
Click Allow. After the authorization process is complete, the robot will start the UiPath process.
Druid Callback
When the UiPath process ends, Robot.JS notifies the AI Agent hosting web page and will automatically send to the AI Agent the utterance defined in the [[RobotJsInput]].CallbackUtterance entity field.
The flow which is trained to respond to the respective utterance is the triggered in the AI Agent conversation.
Transferring data between the AI Agent and UiPath robot
From AI Agent to robot
[[RobotJsInput]] is the data transporter from the AI Agent to the UiPath process. All the fields defined in the entity will be fed as input arguments to the UiPath process. Apart from the two mandatory fields, ProcessName and CallbackUtterance, you can define as many fields as you need, of any data type available in the Druid Platform.
For example, you can add three more fields to the entity, as below:
[[RobotJsInput]]
.ProcessName
.CallbackUtterance
.FirstName
.LastName
.City
or use the Entity or the Entity List field type to send the whole data structure already used in the AI Agent process configuration:
[[RobotJsInput]]
.ProcessName
.CallbackUtterance
.AccountData
.ContractList
Where:
- AccountData is an Entity type field, referred to the [[Account]] entity.
- ContractList is an Entity List type field, referred to [[Contract]] entity.
The two fields will be sent as Jobject type arguments (not variables) to the UiPath process, where they can be deserialized and mapped to the UiPath data structure accordingly.
From robot to AI Agent
Data that needs to be transferred back to the AI Agent must be placed in the output argument with fixed name – Payload.
The Payload argument (type string) must contain the serialized string of a Druid Entity, having the following definition:
{
"$entityTypeName$":"<Druid Response Entity Name>",
"<Field 1>":"value",
"<Field 2>":"value",
.....
"<Field n>":"value"
}
The entity used for response data mapping can be any existing Druid Entity
The entity fields defined in the UiPath process must exist and have the same names as of the entity defined in Druid Platform.
Collection type data can also be sent back to the AI Agent. The definition of the Druid Entity Json, in this case, is the one presented below:
{
"$entityTypeName$": "Account",
"ManagerName":"John Doe",
"ContractList": {
"$entityTypeName$": "Contract_Collection",
"items": [
{
"$entityTypeName$": "Contract",
"Number": "100",
"Date":"2020-07-01",
"Object":"Personal Loan"
},
{
"$entityTypeName$": "Contract",
"Number": "105",
"Date":"2020-05-21",
"Object":"Investment Loan"
},
{
"$entityTypeName$": "Contract",
"Number": "230",
"Date":"2015-02-03",
"Object":"Morgage"
}
]
}
}
The structure of the [[Account]] entity is as follows:
[[Account]] .ManagerName -- string .ContractList -- Entity List, referred to [[Contract]] entity
When the callback flow is triggered, the [[Account]] entity will be populated with data from the example above.



