From Bright Pattern Documentation
onGetKnowledgeBaseFolder
This handler is used to retrieve the contents of an external Knowledge Base (KB) folder for display in the Communicator Widget. The result can include a mix of KB folders and articles.
Note: If you set multiple handlers that all return some data, only the result from the last handler will be used.
Request
Syntax
| on('ON_GET_KNOWLEDGE_BASE_FOLDER', handler: OnGetKnowledgeBaseFolderHandler): void
type KBFolderOptions = { language?: string folderId?: string } type ExternalKBItemData = ExternalKBArticleItem | ExternalKBFolderItem type ExternalKBArticleItem = { id: string type: "article" title: string text: string } type ExternalKBFolderItem = { id: string type: "folder" title: string } |
Parameters
| Parameter | Parameter Values | Data Type | Optional/Required | Description |
| options | object | Required | Request parameters | |
| language | string | Optional | Language selected in Communicator Widget KB. Intended to receive only the content for that language. | |
| folderId | string | Optional | If not provided, the request is for the KB root content. If provided, then Communicator Widget expects to receive the content for the folder with that ID. |
Example Request
adApi.on("ON_GET_KNOWLEDGE_BASE_FOLDER", options => {
// Request KB folder content from external CRM
const kbArticlesAndFolders = externalCrmApi.getKBFolderContent(options.folderId)
// Return results back to your contact center
return kbArticlesAndFolders
})
Return Value
Returns an array which can contain items of 2 types: ExternalKBArticleItem and ExternalKBFolderItem.
| Object | Object Values | Data Type | Optional? (Y/N) | Value Description |
| ExternalKBArticleItem | object | Object represents KB Article | ||
| id | string | Unique ID of the article | ||
| type | string | Always "article" value. Helps to distinguish article item from folder item. | ||
| title | string | KB Article header | ||
| text | string | KB Article content preview (expected to be no more than 100 characters) | ||
| ExternalKBFolderItem | object | Object represents KB Folder | ||
| id | string | Unique ID of the folder | ||
| type | string | Always "folder" value. Helps to distinguish folder item from article item. | ||
| title | string | KB Folder title |