Persist chat history with Bot Framework using DirectLine ASE

Viewed 243

we are integrating our chatbot into our website. We got most of it working using Direct Line App Service Extension. I used this sample to implement our bot: https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-directline-extension-webchat-client?view=azure-bot-service-4.0

Part of our code looks like this:

var token = sessionStorage['webchatToken'];
var userId = sessionStorage['webchatUserId'];
var conversationId = sessionStorage['webchatConversationId'];

directLine = await window.WebChat.createDirectLineAppServiceExtension({
  token,
  domain: 'https://ourbot.azurewebsites.net/.bot/v3/directline',
  watermark: "0"
});

window.WebChat.renderWebChat(
  { directLine: directLine },
  document.getElementById('webchat')
);
document.querySelector('#webchat > *').focus();

Now I'm trying to make it so that the bot persists chat history when the user navigates our website. I already store the token, conversationId and userId in sessionStorage.

Basically what I need is some way to pass the conversationId to the createDirectLineAppServiceExtension function. Or maybe some other way to set directLine that fills it with the chat history based on the conversationId.

Any help is appreciated. I would like to mention that Direct Line and Direct Line App Service Extension are 2 different things. Thanks in advance!

PS: I can't find any documentation for the createDirectLineAppServiceExtension method other than the above mentioned link. So if you have documentation for this, I would a link. Most documentation I can find is not about the app service extension.

======= EDIT ======

I decided to use regular DirectLine instead of DirectLine ASE. And I got everything working perfectly. Maybe an answer to this question can still be useful to others. Though I would advise them to do as I did and got with regular DirectLine as it works and is better documented.

0 Answers
Related