Using APIs, you can get your ServiceNow instance to integrate with QuickHelp and help your users help themselves. This support document details the steps needed to complete the search integration.


  1. Follow the steps in the QuickHelp APIs – Getting Access document to access APIs and to get the API keys required to send requests.
    1. The API key from the QuickHelp Admin portal will be used in your API requests as the Authorization header (you will replace it in the template code provided in step 7). Click here to go to the QuickHelp Admin portal.
    2. The key from the Azure API portal will be used in your API requests as the Ocp-Apim-Subscription-Key header. Click here to go to the Azure API portal.
  2. Sign in to your ServiceNow instance (as an Admin), and search for Portals.

  3. Click the active portal that you would like to integrate with QuickHelp search.
  4. Scroll down to Search Sources.
  5. Click New.


  6. In the Search Source config page – enter the name and ID that you would like to give the Search.


  7. In the Data Source section, check Is Scripted Source.


  8. Using the Data fetch script code below, replace the Authorization key with the API key you received from QuickHelp Admin portal and the Ocp-Apim-Subscription-Key with the key from the Azure API portal (found in step 1).
  9. Replace the code in the Data fetch script field with the code below (including your Authorization key and Ocp-Apim-Subscription-Key)
  10. On your Search page template itself, use the Search code below.  NOTE: You can also use HTML to modify the template to suit your own needs.   
  11. Click Submit.
  12. You can test the new search by scrolling down in the Portal configuration and clicking Try It.


  13. Type in search criteria in your search text box (something that relates to QuickHelp content).


  14. Use the QuickHelp filter (or whatever you named the Search Source) at the left to see the QuickHelp results.


Data fetch script


(function(query)


{var results = [];


var url="https://qhapi.quickhelp.com/v1/Search/Results";


var ws = new sn_ws.RESTMessageV2();


// Configuration for the API request

ws.setRequestHeader('Authorization','XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXX');

ws.setRequestHeader('Ocp-Apim-Subscription-Key','XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

ws.setQueryParameter('query', encodeURI(query));

ws.setHttpMethod("get");

ws.setEndpoint(url);


var jsonOutput = ws.execute();


if(jsonOutput) {

var response = new JSON().decode(jsonOutput.getBody());


// Format each result to only contain the information needed

response.forEach(function(result) {

result.url = result.url;

result.target = "_blank";

result.primary = result.description;

results.push({"url": result.url, "target": "_blank", "title": result.title, "description": result.description});

});

console.log("Results: ");

console.log(results);

}

return results;


})(query);


Search code

<div>

<a href="{{item.url}}?utm_source=API&utm_medium=ServiceNow&utm_campaign=Search" target="_blank" class="h4 text-primary m-b-sm block">

<span>{{item.title}}</span>

</a>

<p>

{{item.description}}

</p>

</div>