Kustomer.openKbCategory()
Opens a Knowledge Base article based on the article id.
Use Kustomer.openKbCategory()
to open the chat widget and take the customer to a specific knowledge base category based on the category id.
You can find the category ID in Kustomer by submitting a GET request to: <https://orgname.api.kustomerapp.com/v1/kb/categories
First, initialize chat fully
Kustomer Chat must finish initializing fully with
Kustomer.start()
before you can execute any additional Web SDK methods.Tip: Call other methods inside the callback of
Kustomer.start()
to ensure Kustomer Chat always completes initialization before the code tries to run other methods.To learn more, see Troubleshooting: Kustomer method calls won't execute.
Examples
// Go to an category by category id
Kustomer.openKbCategory('SOME_CATEGORY_ID');
// Go to the category and run a callback
Kustomer.openKbCategory('SOME_CATEGORY_ID', (response, error) => {
if (error) {
console.error(error);
} else {
console.log('Successfully opened category.');
}
});
Syntax
Kustomer.openKbCategory(categoryId, function(null, error))
Parameter | Type | Description |
---|---|---|
categoryId | String | Required The category id. You can find the category id in Kustomer when you select a category from the Categories settings page under Settings > Knowledge Base. If invalid, an error will be returned in the callback. |
function(null, error) | Function | Optional A callback that is run after Kustomer.openKbCategory completes.error is either undefined or a native JavaScript Error object. |
Updated 1 day ago