Getting user's computer information in virtual agent

Ryax1
Tera Guru

Hi all,

We're trying to improve our Virtual Agent and would like to be able to capture the user's computer name that they are connecting to Virtual Agent from. 


I am aware of the 'Current Device' field on the sys_cs_conversation table and also aware of the vaContext.deviceType context variable however neither of these (to my knowledge) seem to allow me to get the computer name. 

 

The computers are pool devices and therefore not assigned to an individual user in the cmdb therefore we cannot query the cmdb_ci table to get the user's device.

 

Can anyone think of a way in which we can achieve this without asking the user to manually enter the computer name?

 

Many thanks

 

Rich

5 REPLIES 5

Ratnakar7
Mega Sage
Mega Sage

Hi @Ryax1 ,

 

The deviceType context variable is used to determine from where the interaction has initiated like Slack/MS Team etc.

 

You can include a JavaScript code on your Virtual Agent page to capture the computer name of the user. JavaScript has a built-in object called "navigator" which contains the user agent string.

 

In Virtual Agent Designer, you can use the "Run Script" action to execute JavaScript code and capture the computer name. Here is an example of how to do this:

  1. Create a new "Run Script" action in your Virtual Agent flow.

  2. In the "Script" field, enter the following code:

 

var computerName = window.navigator.userAgent.match(/\\b(\\w+)\\.\\w+\\.\\w+\\b/)[1];

 

 

If my response helps you to resolve the issue close the question by Accepting solution and hit 👍thumb icon. From Correct answers others will get benefited in future.

 

Thanks,

Ratnakar

Hi @Ratnakar7 

Thanks for your response, that sounds really promising as it is exactly what we need. I tried adding a 'Run Script' and setting a global variable vaVars.computerName to the script you provided and then tried calling it in a bot response but it doesn't seem to work (The VA runs into technically difficulties), is there anything else I need to define?

Thanks

Rich

Hi @Ryax1 ,

 

You could capture the IP address of the device that the user is connecting from and store it in a field in the sys_cs_conversation table. This can be done using the gs.getSession().getClientIP() method in a script include or business rule. While this may not be as reliable as capturing the actual computer name, it could still be a useful piece of information for troubleshooting and analytics purposes.

 

Thanks,

Ratnakar

Thanks for the suggestion, unfortunately I don't think the IP option will be possible due to various security constraints in our organisation. I'll wait and see if anyone has any other ideas.

Thanks again

Rich