Need to map dynamic link coming from third party site and need output in Servicenow Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 08:32 AM
Need to map the dynamic link coming from third party site and I need that output to be displayed in Servicenow Virtual Agent chat.
used codes in topic creation in virtual agent :
(function execute() {
var r = new sn_ws.RESTMessageV2('RestMessageName', 'HttpMethodName');
r.setStringParameterNoEscape('{EnterWord}', vaInputs.{});
var response = r.execute();
var responseBody = response.getBody();
var responseObject = JSON.parse(responseBody);
vaVars.answer1 = responseObject.SearchResult[0].Headline;
vaVars.answer2 = responseObject.SearchResult[0].Abstract;
vaVars.answer3 = responseObject.SearchResult[0].TargetUrl;
return true;
})()
Used code in bot link response :
(function execute(header) {
var groupedLinksOutMsg = new sn_cs.GroupedPartsOutMsg();
groupedLinksOutMsg.setHeader(header);
groupedLinksOutMsg.addLinkPart(vaVars.answer1,vaVars.answer3,vaVars.answer2);
return groupedLinksOutMsg;
})(header)
here, am getting the required output but the hyperlink is not redirecting to the proper link which is extracted from 3rd party knowledge site.