2

I am looking to implement a functionality which is same as that of "Restart conversation from here" in WebChat. I did not found anything relevant which addresses my requirement.

  • Hi and welcome. Please take the [tour] and read [ask]. Can you show some code or other indication of what you have tried so far? – DarkMatter Dec 30 '20 at 12:41
  • I am using the sample from https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/06.recomposing-ui/d.plain-ui in which I want to restart conversation from a specific message. – sanket-thotange Dec 30 '20 at 14:40
  • My next approach is to scavenge through the Bot Emulator Code and find the functionality – sanket-thotange Jan 05 '21 at 06:49

2 Answers2

2

I had a similar requirement which I needed to implement. I implemented it like this:

  1. Get the token of the conversation and saved it inside the state
  2. Pass the token to the WebChat component
  3. User clicks "Restart Conversation button" -> Set the token to null
  4. React then would take care of it, as it would restart the token fetching process and start a new conversation.
Dharman
  • 30,962
  • 25
  • 85
  • 135
Armend Ukehaxhaj
  • 533
  • 6
  • 17
  • Thanks for the reply. I am looking for restarting conversation at specific question rather than starting conversation from the start. Could you provide some info on that? – sanket-thotange Jan 27 '21 at 05:29
  • You can set up a middleware and check when a specific message arrives. Use the official samples from Microsoft on how to implement middlewares: https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/04.api/j.redux-actions. From there you can restart the conversation (using the steps above) after receiving that message. – Armend Ukehaxhaj Feb 01 '21 at 08:11
0

Restarting a conversation using a conversationId usually restarts from the start unless you specify a watermark. In your case you would need to store the watermark with each save point in the conversation.

Hessel
  • 613
  • 1
  • 6
  • 15