KustomerCore.getCategories()

Fetches the categories in your Kustomer Knowledge Base

πŸ‘

First, initialize chat

You must initialize with KustomerCore.init() before you can execute any additional Core SDK methods

Examples

// Gets your categories for a certain knowledge base
KustomerCore.getCategories({
  lang: 'en_us',
  knowledgeBaseId: 'SOME_ID'
}, function (callbackResponse, error) {
  console.log('Fetched categories!');
});

Syntax

KustomerCore.getCategories(options, function(callbackResponse, error))

Parameter

Type

Description

options

Object

Required

An object containing details about the categories you want to fetch. A breakdown of the options object is listed below.

function(callbackResponse, error)

Function

Optional

A callback that is run after the method completes.

callbackResponse is an object returned to the callback function. See the callbackResponse section below to see the properties of the object.

error is either undefined or a native JavaScript Error object.

options

Property

Type

Description

knowledgeBaseId

String

Required

The unique ID of the knowledge base.

lang

String

Required

The language code of the categories to fetch.

callbackResponse

Property

Type

Description

categories

Object

Required

An object with its keys being category IDs and values being the category object.

These category objects have the same structure as rootCategory.

rootCategory

Object

Required

The root category object. See below for what the rootCategory looks like.

rootCategory

Property

Type

Description

categoryId

String

Required

The unique ID of the category

title

String

Optional

The category's title.

description

String

Optional

The category's description.

parentCategory

String

Optional

The parent category's ID.

childCategories

Array

Required

An array of child category IDs.


Did this page help you?