KustomerCore.getArticles()

Fetches the articles in a category in your knowledge base

👍

First, initialize chat

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

Examples

// Gets your articles for a certain category
KustomerCore.getArticles({
  categoryId: 'SOME_ID',
  lang: 'en_us',
  knowledgeBaseId: 'SOME_ID'
}, function (callbackResponse, error) {
  console.log('Fetched articles!');
});

Syntax

KustomerCore.getArticles(options, function(callbackResponse, error))
ParameterTypeDescription
optionsObject

Required

An object containing details about the articles 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

PropertyTypeDescription
knowledgeBaseIdString

Required

The unique ID of the knowledge base.

langString

Required

The language code of the categories to fetch.

categoryIdString

Required

The category ID you want to fetch articles from.

callbackResponse

PropertyTypeDescription
articlesArray

Required

A list of article objects. See articles below for an example.

articles

The following is a breakdown of what an item in the articles array looks like.

PropertyTypeDescription
articleIdString

Required

The unique ID of the article.

htmlBodyString

Required

The article's html body.

titleString

Required

The article's title.

descriptionString

Required

The article's description.

updatedAtString

Required

The article's last updated at timestamp.

langString

Required

The article's language code.

slugString

Required

The article's slug for its url.

versionString

Required

The version of the article.

hashString

Required

The article's hash code.

kbUrlString

Optional

The article's knowledge base URL.

knowledgeBaseIdString

Optional

The article's knowledge base ID.