BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

chat persistance and adding header section in webchat

Open Bradrajkumar opened this issue 7 years ago • 4 comments

i am using the latest webchat.js. Feature wanted are:- 1.) i want a chat persistance functonality in it(after page refresh the chat will retain in chat conversation content). i don't want to use Cosmos DB for saving the conversation data(suggest me the better way to save the conversation data). 2.) as in V3 i have customized and added the header section (you can see on attached file). The same way i want to add up in webchat V4(how to accomplish this Capture ).

Bradrajkumar avatar Aug 01 '19 06:08 Bradrajkumar

  1. We suggest you to store the history on server because cleaning up browser data in sessionStorage or localStorage requires manual code. Think about the user sign out on a page that do not have Web Chat on. Compare to server solution, you will need to add clean up code in a few places.
  2. In v4, instead of providing you a way to customize the header, we prefer you to build the header in your HTML code directly. In this way, you would have more freedom on the customization.

compulim avatar Aug 01 '19 09:08 compulim

@compulim in webChat V3 i found that we are creating element like :- "o.createElement" which was easy to render the custom div elements in webchat. can we do this in Webchat V4 without using Html Code? as i was looking for the classes where it is rendering but i didn't find the exact place. please, help me with this.

Bradrajkumar avatar Aug 06 '19 05:08 Bradrajkumar

I am talking something like this. You create your own header in HTML.

<div>
  <header>Your header here</header>
  <div id="webchat"></div>
</div>
<script>
  window.WebChat.renderWebChat({ ... }, document.getElementById('webchat'));
</script>

If you don't prefer HTML, you can write it in JavaScript by manipulating DOM elements.

<div id="webchatContainer"></div>
<script>
  const container = document.getElementById('webchatContainer');
  const header = document.createElement('header');
  const webchat = document.createElement('div');

  container.append(header);
  container.append(webchat);

  window.WebChat.renderWebChat({ ... }, webchat);
</script>

We no longer provide header customization. If dev could do it in HTML naturally, we shouldn't ask developers to learn something new/complicated to achieve what was simple and intuitive.

compulim avatar Aug 06 '19 05:08 compulim

i got it. Thankyou

Bradrajkumar avatar Aug 06 '19 05:08 Bradrajkumar