0

Is it possible to load previous conversation with the bot in web chat using microsoft's azure bot framework? For example: If the user has a conversation with the bot which has 15 messages in total and then the user decides to refresh the page. Can the chatbot automatically load the previous 15 messages of the transcript while maintaining the state.

Currently, I'm trying to save the conversation id as a cookie and load that value of the cookie on to the chat. So every time the directline session loads, I pass the conversationId as well as watermark parameter.

      window.WebChat.renderWebChat(
        {
          directLine: window.WebChat.createDirectLine({
            secret: '{{DLToken}}',
            webSockets: true,
            conversationId: chatId,
            watermark: "0"
          }),
          styleSet,
          store,
          renderMarkdown: markdownIt.render.bind(markdownIt),

        },
        document.getElementById('webchat')
      );

For this I'm getting a 403 error: {code: "BadArgument", message: "Security token not valid for this conversation"}

  • Does this answer your question? [Is there a way to persist chat history in MS Bot Framework Web Chat after a page reload/navigation to another page?](https://stackoverflow.com/questions/56969008/is-there-a-way-to-persist-chat-history-in-ms-bot-framework-web-chat-after-a-page) – Steven Kanberg Oct 05 '20 at 13:26
  • @Hessel I have updated the question with what I've tried doing so far – Aakash Arora Oct 07 '20 at 10:27
  • The solution of that link doesn't make use of the conversation id while implementing CreateDirectline. So it doesn't answer my question and I'm still stuck @StevenKanberg I've updated the question as well. Thanks for the help! – Aakash Arora Oct 07 '20 at 10:28

0 Answers0