ServiceNow Virtual Agent API Integration

shishirsapkal
Tera Contributor

Hi!

I am trying to run a remote action using ServiceNow Virtual Agent which will return the device health from a third party tool called Nexthink. I have created the required REST Message and HTTP method to invoke the API call. I have also created a topic in Virtual Agent Designer which contains a script to call the REST message and return the response. I will attach the code below. I am able to get correct response through the REST message, but I am not able to parse the response or output through Virtual Agent. Any help would be appreciated. 

 

1 ACCEPTED SOLUTION

@shishirsapkal 

 

Please try replacing 

vaVars.responseBody

 

with 

var responseBody

  in both the codes and retry.


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

13 REPLIES 13

@shishirsapkal 

 

Please try replacing 

vaVars.responseBody

 

with 

var responseBody

  in both the codes and retry.


Please mark this response as correct and helpful if it assisted you with your question.

I used 

var deviceName = health_data .data[0]['diskfreepercentage'
and it worked! Thanks a lot @Amit Verma 

@shishirsapkal , can you please share the final working script which you have parsed in the virtual agent, even I am trying the same and needed help. Thanks. 

goldenjc97
Tera Contributor

@shishirsapkal - I'm having trouble writing the parameter in the 'Content' of the POST command. Would you mine sharing the part you have blacked out (replacing sensitive data)? Following Nexthink's documentation, I keep getting {"message":"Invalid number of named parameters","code":103,"

RAJJYOTI DATTA2
Tera Contributor

The reason is when you trigger a remote action using Nexthink it takes sometime to complete the action ... approx 1min .. for that 1 min you will either get an in progress status or the object "data" will be empty .. so in order to get the execution status we need to leverage some time ... also please check the response body .. generally the api to check the execution status doesnot provide result of executions which are 1 hr before .. please check these filters /conditions in the response body ..