Reputation: 31
I am trying to implement Blob transcript storage(https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-storage?view=azure-bot-service-4.0&tabs=csharp#blob-transcript-storage-implementation). I am able to implement and see the stored transcripts in Azure blob storage under container as json files. Now the issue I am facing is how do I display them properly. If I use SendActivityasync then it displays both bot and user messages as if bot is typing it (on the bot side-left side).
Is there a way to dump the transcript in one go? Just to display the whole conversation or is it supposed to be done one by one? Is there a function that allows this?
Since these transcripts are saved using conversation ids, how do I use this sample to get only the user who's using the bot and not all? If the conversation ids are new for each conversation and user ids according to sample is generated using 'Guid.NewGuid()' it will be random everytime. Are these being saved to keep track of users? Is there any sample to see the whole thing?
I have seen a lot of samples mentioning this being used for debugging. Has anyone implemented this and if so what samples are you following?
Thanks
Upvotes: 1
Views: 1482
Reputation: 7241
This is answered in this GitHub Issue. The original issue is pretty old, but there's an updated answer in the linked comment.
Basically, you need to:
createStore()
methodrenderWebChat()
method. For example:// This is just an example. You'll want to populate history with
// an array of activities from your storage.
const history = [
{
type: "message",
id: "******************",
timestamp: "2020-10-30T20:45:52.7120529Z",
channelId: "webchat",
from: {
id: "******************",
name: "******************",
role: "bot",
},
conversation: {
id: "******************",
},
locale: "en-US",
text: "THIS IS A PREVIOUS MESSAGE",
inputHint: "acceptingInput",
attachments: [
],
entities: [
],
replyToId: "******************",
}
]
[...]
const store = window.WebChat.createStore({ activities: history}, ({ dispatch }) => next => action => {
return next(action);
});
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ secret: token }),
store
},
document.getElementById('webchat'));
[...]
Upvotes: 1