I am developing a bot using sdk v4 for node js and i want to end the current conversation and start new convesation when user click on a button. I tried await this.conversationState.clear(turnContext)
to clear conversation data but there is no change in conversation Id. please suggest how to trigger conversationUpdate activity to restart the connection to the bot.
Asked
Active
Viewed 728 times
0

vaatsalya
- 1
- 3
-
May I ask what you're hoping to accomplish or what you're expecting to happen? Do you want the channel's chat history to be erased from the UI? Do you want to reset the bot's conversationData? Are you just trying to generate a new conversation ID? Could you achieve what you're going for by just clearing the dialog stack and starting a new dialog as though the user is starting a new conversation? – Kyle Delaney Dec 19 '18 at 20:05
-
Are you still working on this? – Kyle Delaney Dec 27 '18 at 03:55
-
@KyleDelaney I am trying to achieve the functionality like "Restart Conversation" in bot Framework emulator where chat history will be erased and new conversation ID will be generated. I am able to erase the chat history in UI. I want to generate new conversation ID when user clicks on a button in bot.js and i am not using botbuilder-dialogs in my bot. – vaatsalya Dec 27 '18 at 06:01
-
Erasing the chat history in the UI is an ability of the channel and not the bot. What channel are you making the bot for? I think this would only be possible in Web Chat or your own custom Direct Line client. – Kyle Delaney Jan 01 '19 at 01:16
-
@KyleDelaney I am using Direct Line. – vaatsalya Jan 02 '19 at 05:29
-
Remember that the [Emulator](https://github.com/Microsoft/BotFramework-Emulator) is open source just like the SDK. Perhaps you can investigate the behavior of the Restart Conversation button and apply it to your own project. – Kyle Delaney Jan 08 '19 at 00:41
-
Are you using Web Chat or your own Direct Line client? – Kyle Delaney Jan 22 '19 at 00:48
-
Are you still working on this? – Kyle Delaney Mar 08 '19 at 00:33
-
@KyleDelaney yes searching for some work around. – vaatsalya Mar 15 '19 at 05:08
-
So are you using Web Chat? Any information you give about your Direct Line client will help – Kyle Delaney Mar 15 '19 at 21:53
-
Is my answer acceptable? – Kyle Delaney May 06 '19 at 20:08
1 Answers
2
Both the Bot Emulator and the Azure Portal Web Chat's contain a sort of restart button that clears the conversation history and generates a new conversation ID. This is accomplished by refreshing Web Chat.
Direct Line generates a new conversation ID every time the secret is exchanged for a token. If you are passing a Direct Line secret to Web Chat directly and letting Web Chat exchange it for a token, then all you must do to generate a new conversation ID is refresh the page or frame.
If you are storing the secret somewhere private (recommended) and exchanging it for a token yourself and passing the token to Web Chat, then just do that again to generate a new conversation ID.

Kyle Delaney
- 11,616
- 6
- 39
- 66