How to fetch KG/ Message content from outside Kore system

@yogaramya.mendu
Please help with an example of how to get content from external systems as answer to KG/ a message node.

Hi,

The intent/FAQ detection will be taken care of in the platform and the response will be retrieved from the external service (For example, Drupal or any other content system).

In order to get the response, we would need a common reference id between the platform FAQ’s and the response in the service.

So, we need to add a Qid/MessageId for every FAQ in the platform, and in the external service, the same qid should be added against the respective response.
When we pass the Qid/messageId to the service, the respective response will be retrieved.

Please find the below implementation steps for the scenario:

  • We have set up a ngrok server at our end that returns a response as per the question id.

  • In the bot, we have added FAQ’s and in each FAQ response, the Qid is being passed to the BotUserSession variable so that it can be passed to the service later in order to get the response.

BotUserSession.put(“currentQestionId”,“q002”);
print('Searching… ');

This script would pass the qId to the “currentQestionId” BotUserSession variable.

  • Create a task and in the task, we have created a flow that has a service node configured to call the above service by passing the respective FAQ Qid.

​​

​​

The response is retrieved from the message node
​​

  • In the bot >> Natural language >> Default conversation >> event handlers

Enable the endOfConversation event, by initiating the respective task.

Now, with this configuration the flow will be as below:

Use asks the question --> Bot identifies the FAQ – > In the FAQ response, as per the code, the qid will be passed to the BotUserSession Variable – > the endOf conversation event gets executed calling the dialog task assigned to it – > the service node in this dialog task will call the service and gets the response – > the message node configured in the dialog would show the response to the user.

Notes:

To understand more on the usage of variables, please refer to the following link:

https://developer.kore.ai/docs/bots/bot-builder-tool/dialog-task/using-session-and-context-variables-in-tasks/

Let us know if you need any further clarification on the above.

Courtsey: @swagata.sengupta

Regards,
Yoga Ramya

Regards,
Yoga Ramya