How to exit a topic and return to topic discovery in Virtual Agent

Sometimes the user might find themselves 1 or 2 steps into a topic and realize it's not the correct topic for their intent. In those cases we want to allow them to exit the topic and do something else, rather than ending the conversation entirely

You can achieve this by using a Script Action and using the switchTopic method to switch to the default Greetings. topic or to a fallback topic.

(function execute() {
	vaSystem.switchTopic('Custom Fallback Topic');