OpenDialog Docs
OpenDialog 2023.1

Contextual restart / chat end

This pattern allows the user to break out of the current conversational flow or restart the interaction.
The webchat widget provides two options to end a conversation: restart or end.
This functionality is not activated by default; it must be activated in the Interface Settings page:
Restart and Chat End buttons can be turned on in Interface Settings
Webchat widget with End Chat and Restart buttons turned on
In the flow of a conversation, if the user clicks on the Restart button, a intent.core.restart intent is generated. Clicking on the End Chat button generates a intent.core.end_chat intent.
Both of these intents are dealt with slightly differently to a standard user intent from the webchat as they are escalating - this means that if no local match is found, the conversation engine will work its way up through the current Turn, Scene and Conversation until looking for a top-level match.
The pattern is similar to the Contextual No Match pattern with the intent name being updated for each level of the conversation.
Restart Intents:
intent.core.TurnRestart -> intent.core.SceneRestart -> intent.core.ConversationRestart -> intent.core.restart
Chat End Intents:
intent.core.TurnEndChat -> intent.core.SceneEndChat -> intent.core.ConversationEndChat -> intent.core.endChat

Conversation Structure

When you create a new scenario, a Trigger Conversation is created for you that handles the WELCOME event from webchat as well as the global restart
Global Restart intent in the Trigger Conversation
With this in place, any time a user clicks the restart button, they will hit the Trigger Conversation and this intent will transition them to the Welcome Turn in the Welcome Conversation. You should update this to suit your needs.
Note the End Chat is not handled out of the box and you will need to set this up as required

Contextual Restarts

Individual turns, scenes and conversations can handle restarts however they need.
Consider a scene in which we are trying to gather information about a user. Our conversational flow will be a question from the app, followed by an answer from the user.
It's easy to consider a situation where the user would want to restart this flow - if they've entered some wrong information for example.
A scene for this might look something like the one below
A scene to gather user information
Notice that there is a Turn named Scene Restart - the idea of this turn is to handle the user restarting the flow and contextually at this point.
In this case, if the user restarts the flow at any point in this scene, we would want to route them back to the Get Name Turn. We can set up 1 intent with a transition to do this for us
The Scene Level Restart
Notice the intent is named intent.core.SceneRestart as we want to capture all restarts within this scene
Now, if the user clicks the restart button at any point in within this scene, they will be routed straight back to the start.