How to create a portal on an external server where the UiPath Assistant is running

How to create a portal on an external server where the UiPath Assistant is running?

So we have a server that has a http-server running on http://vm-1.site.com/. This page show the process via using the UiPathRobot.js library. That page is available from everywhere.

But today I found out that when I access that page from my PC then it check on my PC for an installed UiPath Assistant, instead of accessing the Server.

So how can I change that? I know that the script runs locally on my pc and that’s the issue.

So how to let the whole scripts directly run on the server? I’m not deep into Node.js so any help helps.

Ok found that, so everything I have done was nonsense as the Robot.Js was not designed for that?

I’m very sad now as it looked to me exactly as a tool that can achieve that.

Sorry to hear that @kwoxer!
The Orchestrator APIs are definitely what you should be looking at here.

Or is it possible to render the page on the server already?

I mean the UiPathRobot.js just needs to be executed on the server. That’s the only issue I have.

Actually this looks really good. Is it worth to try it. WDYT?

UiPathRobot.js is a client side library only. It relies on your having an attended robot available on the same machine that runs the JS client.

But where is the benefit over the Assistant?

I mean the only thing that is different is that you can set input and output arguments.

But all on the same machine. So you do that really for your own needs. Instead you could also easily take the Config.xlsx from the ReFramework.

So if you ask me that tech is really nonsense at all when it stays client side =/ sorry

Great question! Hopefully I can do it justice… UiPathRobot.js allows you to contextually embed attended robots directly into the experience that business users are already interacting with (including those that are web based). This enables a seamless interaction between the applications they already use and robots that can save them time. If you haven’t already, you should check out some of the examples we’ve provided.

It also gives you full control over that end-user experience, so you can extend your existing applications with RPA and make your robot “invisible” to the end user, meaning they don’t have to understand any RPA concepts, be familiar with individual processes, or do any training to use the Assistant.

That’s not to say that this is how you should operationalize all of your robots, it’s just another tool to help you leverage the UiPath platform to deliver the most value to your automation users and your business.

Hope this helps!

But then you should definitely rethink how you offer that feature. That feature means, it just runs on the current device. That device always needs a running license.

I don’t think that’s a good solution. But if that’s your business model, ok, it’s up to you.

I personally really really dislike that feature as I expected a tool that can be used from outside the device as well.

Have you had a chance to look into the Orchestrator APIs I suggested? All of these can be queried server side. There is also a JavaScript library for Orchestrator that can be used server side (“outside the device” as you suggest) to make it easier to interact with these APIs.

Yeah I did some first steps with it already. The auth and getting some roles. All working but now I need to see how to continue and yes maybe with the node package.

1 Like

Alright. I now played around. And the connection worked out with the installed node.js package.

Anyway now I need to implement it in my website.

So I struggle a bit with getting it to run in my current setup. This is how I would like to use it:

index.html:

<html>
  ...
  <button onclick="test()">Do something</button>  
  ...
  <script src="scripts/scripts.js"></script>
  ...
</html>

server.js (I start with node server.js)

var http = require('http'),
    fs = require('fs');
const port = 6543;
const path = require('path');
const server = http.createServer((req, res) => {
  let filePath = path.join(
      __dirname,
      req.url === "/" ? "index.html" : req.url
  );
  let extName = path.extname(filePath);
  let contentType = 'text/html';
  switch (extName) {
      case '.js':
          contentType = 'text/javascript';
          break;
  }
  console.log(`File path: ${filePath}`);
  console.log(`Content-Type: ${contentType}`);
  res.writeHead(200, {'Content-Type': contentType});
  const readStream = fs.createReadStream(filePath);
  readStream.pipe(res);
});
server.listen(port, (err) => {
...
});

scripts.js

function test() {
  ...
  // get the orch object here without defining it here as it contains credentials
  var orchestratorInstance = new Orchestrator({
    tenancyName: string (optional),
    usernameOrEmailAddress: string (required),
    password: string (required),
    hostname: string (required),
    isSecure: boolean (optional, default=true),
    port: integer (optional, [1..65535], default={443,80} depending on isSecure),
    invalidCertificate: boolean (optional, default=false),
    connectionPool: number (optional, 0=unlimited, default=1)
  });
}

This works. So the test function is fired.

But now I would like to get the Orchestrator object (like shown here uipath-orchestrator - npm).

How to do it in the best way?

Maybe just giving that object to the scripts.js file itself?

If you don’t want the credentials exposed on the client side then you can’t consume orchestratorInstance directly from the client. Instead, I’d reccomend adding some additional routes to your server (server.js) with express. Then calling those routes from the client (scripts.js) with whatever data your server needs to execute the Orchestrator APIs you want to consume.

Jap already did this. But I fail with getting the Orch object now.

Or do I need to let the object on server-side and creating some custom rest APIs?

It depends on what you’re trying to build, but without knowing more that’s the approach I’d suggest you should take. A couple of endpoints that expose only the functionality that the client needs.

I just want to be able to start and stop processes from everywhere. Also the possibility of parameters would be nice. And a list about currently running processes.

So the best is creating for all those endpoints. And using parameters via POST method or better via url?

An example for this would be great.

Another could be use RequireJS and load modules client side.

1 Like

Hi Evan.

We are currently working on a process where we have integrated uipath SDK javascript in to the interacting application. User will be invoking the bot from the application. During this process, we have a requirement where we do not want the user to get the uipath consent popup once in every 30 days

  1. Is uipath consent display popup is utilizing cookies & cache in the browser? If yes, what is cookie name?
    2.Anytime if user clears the cache, consent popup may occur again irrespective of 30 days time limit?
    3.Is there a way to remove the uipath 30 days consent display page permanently?
    Any immediate help would be appreciated.
    Thank you

Hi @saitejaswini.anna,

The consent token is stored as a part of the user’s session, if a user clears their browsing history (or has been browsing in Incognito) then they’ll be prompted for consent again. For security reasons there is no way to disable this. While we don’t recommend extending the token expiry time, also for security reasons, this is something that is configurable: via the TokenExpiryInDays variable in the JavaScript Add-on Configuration.

Hope this helps!
Evan