KustomerCore.searchArticles()

Searches for articles in your knowledge base

πŸ‘

First, initialize chat

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

Examples

// Searches for articles based on a search term
KustomerCore.searchArticles({
  term: 'returns and refunds',
  lang: 'en_us',
  knowledgeBaseId: 'SOME_ID'
}, function (callbackResponse, error) {
  console.log('Searched for articles!');
});

Syntax

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

Parameter

Type

Description

options

Object

Required

An object containing details about the articles you want to search. 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.

term

String

Required

The search term you want to search for.

callbackResponse

Property

Type

Description

articles

Array

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.

Property

Type

Description

articleId

String

Required

The unique ID of the article.

htmlBody

String

Required

The article's html body.

title

String

Required

The article's title.

description

String

Required

The article's description.

updatedAt

String

Required

The article's last updated at timestamp.

lang

String

Required

The article's language code.

slug

String

Required

The article's slug for its url.

version

String

Required

The version of the article.

hash

String

Required

The article's hash code.

kbUrl

String

Optional

The article's knowledge base URL.

knowledgeBaseId

String

Optional

The article's knowledge base ID.


Did this page help you?