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))
ParameterTypeDescription
optionsObjectRequired

An object containing details about the categories you want to fetch. A breakdown of the options object is listed below.
function(callbackResponse, error)FunctionOptional

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

PropertyTypeDescription
knowledgeBaseIdStringRequired

The unique ID of the knowledge base.
langStringRequired

The language code of the categories to fetch.

callbackResponse

PropertyTypeDescription
categoriesObjectRequired

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

These category objects have the same structure as rootCategory.
rootCategoryObjectRequired

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

rootCategory

PropertyTypeDescription
categoryIdStringRequired

The unique ID of the category
titleStringOptional

The category's title.
descriptionStringOptional

The category's description.
parentCategoryStringOptional

The parent category's ID.
childCategoriesArrayRequired

An array of child category IDs.