npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tiledesk/helpcenter-query-client

v0.1.8

Published

Javascript SDK for Tiledesk HelpCenter query REST APIs

Downloads

796

Readme

Full NodeJS API reference is hosted on Github

Introduction

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

Before you can add Tiledesk Helpcenter npm lib to your Node.js app, you need a Tiledesk account and a Tiledesk 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 Tiledesk 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 Tiledesk 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('@tiledesk/helpcenter-query-client');

The HelpCenterQuery class

To interact with Tiledesk 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 Tiledesk 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 TiledeskClient 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 TiledeskClient, 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
});