vaatsalya
vaatsalya

Reputation: 1

how to restart a connection to the bot using sdk v4 for node js

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.

Upvotes: 0

Views: 748

Answers (1)

Kyle Delaney
Kyle Delaney

Reputation: 12264

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.

Upvotes: 2

Related Questions