0

I am developing a microsoft bot, (currently using bot composer, which is linked to QnA maker). The bot will need to be visible on the main website (which is predominantly a store-front type website, showing various products, with each product having its own URL).

The various questions in QnA maker relate to ANSWERS which need to point to specific product pages on the hosting web site.

The typical scenario will be , user will ask a bot a question, and this will result in an ANSWER which has a URL to the relevant page on the main website. When the user clicks the link in the bot, the main website will navigate to the relevant product page, but the bot should still be visible, and should still be in a state which shows the conversation so far (rather than being re-started).

How can this be achieved?

(I have experimented with embedding the bot in an iframe, as per the Azure bot instructions, but of course, as soon as the parent web page changes, this is effectively a new page so the bot becomes invisible).

NOTE - as a secondary issue, It appears that the QnA maker sets all links to use target="_blank" and I suspect I really need to be using a link which follows this technique: " target="_top">Lin or " target="_parent">Link

Does anyone has any advice regarding this secondary issue?

Rajeesh Menoth
  • 1,704
  • 3
  • 17
  • 33
StellarFan
  • 25
  • 4

1 Answers1

0

This is called persistence (i.e. persisting the web chat state). You can find an answer to this question posted in this Stack Overflow response on how to achieve this.

In short, you are using local/session storage (which one depends on your needs) to save the generated token and conversation Id (and stream URL, and watermark, if desired) when a chat session is started. Then build in the necessary functionality that so that when a user refreshes or navigates away and then returns, as the Web Chat component is re-built, it ingests those values when building the Direct Line object.

The result is, rather than creating a new DL object, it recreates the DL object that was used previously and displaying the associated chat history.

Keep in mind that tokens expire after one hour. So, if the user is away longer than an hour, the conversation will be lost. This is true even if they simply step away from their browser with no new interaction for that period.

This can be avoided by building in functionality to refresh the token before it expires while the page is unattended by the user.

Steven Kanberg
  • 6,078
  • 2
  • 16
  • 35