You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Full [NodeJS API reference](https://tiledesk.github.io/tiledesk-nodejs-libs/TiledeskClient.html) is hosted on Github
2
+
3
+
# Introduction
4
+
5
+
Follow this guide to use the Tiledesk Helpcenter JavaScript SDK in your ``Node.js`` application.
6
+
7
+
Before you can add Tiledesk Helpcenter npm lib to your Node.js app, you need a [Tiledesk account](https://docs.tiledesk.com/knowledge-base/creating-a-tiledesk-account/) and a [Tiledesk project](https://docs.tiledesk.com/knowledge-base/creating-a-tiledesk-account/). Once you create your project you will have a _projectID_, a _user_ to play with project APIs.
8
+
Next you must create your own Helpcenter workspace (in one Tiledesk project you can create more Workspaces)
9
+
10
+
# Add Helpcenter to your project
11
+
12
+
Install ``HelpCenterQuery`` library with *npm* command:
13
+
14
+
```
15
+
npm install @tiledesk/helpcenter-query-client
16
+
```
17
+
18
+
Alternatively use package.json to import the library in the "dependencies" property, as in the following example:
19
+
20
+
```json
21
+
{
22
+
"name": "Hello Tiledesk nodeJS",
23
+
"version": "1.0.0",
24
+
"description": "",
25
+
"main": "index.js",
26
+
"scripts": {
27
+
"test": "echo \"Error: no test specified\" && exit 1",
28
+
"start": "node index.js"
29
+
},
30
+
"keywords": [],
31
+
"author": "",
32
+
"license": "ISC",
33
+
"dependencies": {
34
+
"@tiledesk/helpcenter-query-client": "^0.1.3"
35
+
}
36
+
}
37
+
```
38
+
39
+
Then run
40
+
41
+
```
42
+
npm install
43
+
```
44
+
45
+
Once installed you can import ```HelpCenterQuery()``` class in your Node.js file using the "require" command:
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*.
54
+
55
+
Please refer to the official [Tiledesk Help Center guide](https://gethelp.tiledesk.com/articles/getting-started-with-help-center/) to better understand how Help Center works and how to get your *Workspace ID*.
56
+
57
+
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:
58
+
59
+
```javascript
60
+
consthelpcenter=newHelpCenterQuery({
61
+
APIKEY:"__",
62
+
projectId:"YOUR_PROJECT_ID",
63
+
workspaceId:"YOUR_HELPCENTER_WORKSPACE_ID",
64
+
log:false
65
+
});
66
+
```
67
+
68
+
# Query your Helpcenter Workspace
69
+
70
+
Once you created your Helpcenter instance you can query your workspace as in the following example:
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:
0 commit comments