KnowledgeService Plugin error

Hi I am using a headless sdk and global function and I would like to ask what I missed when using KnowledgeService Plugin that it generated an error during execution. I attached the screenshot.

What I did is the following:

  1. Turn on Knowledge Articles in Message Configuration -> Apps -> Knowledge Articles
  2. Selected a Knowledge base.
  3. Coded the following and execute in my UI.

export const getSuggestions = (query: string) => {
Genesys(
'command',
'KnowledgeService.getSuggestions',
{
pageSize: 3,
query,
}
);
};

Hi @IvanDg,

Thanks for reaching out to us.

This error can happen if you are trying to call a plugin command before its loaded and initialized. Please subscribe to KnowledgeService.ready event before calling its command, in this way your command is acknowledged by that plugin.

Genesys('subscribe', 'KnowledgeService.ready', function(){
		Genesys("command", "KnowledgeService.getSuggestions",
			{
				"pageSize": 3,
				"query": "Genesys"
			});
		});

We will add this as a note in our docs so its clear when reading it.

Hi @Ranjith_Manikante_Sa
Thanks for the response. I will try to execute above from now and get back to you. Thank you!

Hello @Ranjith_Manikante_Sa

I tried subscribing to KnowledgeService.ready and it was never invoked. Then I tried Knowledge.ready as well and it was never invoked. Did I miss some other steps?

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.