Socket
Book a DemoInstallSign in
Socket

@saurabharch/helpcenter-query-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saurabharch/helpcenter-query-client

Javascript SDK for Rollout HelpCenter query REST APIs

0.1.5
latest
Source
npmnpm
Version published
Weekly downloads
106
292.59%
Maintainers
1
Weekly downloads
 
Created
Source

Full NodeJS API reference is hosted on Github

Introduction

Follow this guide to use the Rollout Helpcenter JavaScript SDK in your Node.js application.

Before you can add Rollout Helpcenter npm lib to your Node.js app, you need a Rollout account and a Rollout project. Once you create your project you will have a projectID, a user to play with project APIs. Next you must create your own Helpcenter workspace (in one Rollout project you can create more Workspaces)

Add Helpcenter to your project

Install HelpCenterQuery library with npm command:

npm install @tiledesk/helpcenter-query-client

Alternatively use package.json to import the library in the "dependencies" property, as in the following example:

{
  "name": "Hello Rollout nodeJS",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@tiledesk/helpcenter-query-client": "^0.1.3"
  }
}

Then run

npm install

Once installed you can import HelpCenterQuery() class in your Node.js file using the "require" command:

const { HelpCenterQuery } = require('@saurabharch/helpcenter-query-client');

The HelpCenterQuery class

To interact with Rollout Helpcenter APIs and query your documents you need to create an instance of a HelpCenterQuery() class using his constructor. You MUST supply an APIKEY, an existing Project ID and a valid Workspace ID.

Please refer to the official Rollout Help Center guide to better understand how Help Center works and how to get your Workspace ID.

In the next example we first authenticate using our user credentials, then we create a new RolloutClient instance using a PROJECT_ID and the token we got from authentication:

const helpcenter = new HelpCenterQuery({
  APIKEY: "__",
  projectId: "YOUR_PROJECT_ID",
  workspaceId: "YOUR_HELPCENTER_WORKSPACE_ID",
  log: false
});

Query your Helpcenter Workspace

Once you created your Helpcenter instance you can query your workspace as in the following example:

const helpcenter = new HelpCenterQuery({
    APIKEY: APIKEY,
    projectId: PROJECT_ID,
    workspaceId: WORKSPACE_ID
});
text_to_search = "military";
maxresults = 3;
helpcenter.search(text_to_search, maxresults, (err, results) => {
    console.log("results:", results)
    assert(results[0].title)
    assert(results[0].score)
    assert(results[0].url)
});

Specify the API endpoint in instance methods

If instead you are using instance methods working with an instance of RolloutClient, you must specify the parameter in the constructor config object as config.APIRUL:

const helpcenter = new HelpCenterQuery({
  APIKEY: APIKEY,
  projectId: PROJECT_ID,
  workspaceId: WORKSPACE_ID,
  APIURL: API_ENDPOINT,
  log: true
});

Keywords

rollout

FAQs

Package last updated on 30 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.