How to create a partially rule-based conversation within a chat dialogue

Hey @Remy!

Sorry, that was a miscommunication, you’re totally right, you shouldn’t have to add it to your stories. However this ties into what I mentioned – in order to have it not affect your stories, the action has to return UserUtteranceReverted(). We’re working on making this super easy and intuitive, but in the meantime there is a workaround if you just want to trigger a bot utterance:

The ideal way to do this would be to create a custom action that you map to: e.g.

- greet:
    triggers: action_greet

Then you would create a custom action that dispatches the utterance you want to say, and then reverts everything so that it’s like it never happened. E.g.:

class ActionGreet(Action):
    """Revertible mapped action for utter_greet"""

    def name(self):
        return "action_greet"

    def run(self, dispatcher, tracker, domain):
        dispatcher.utter_template("utter_greet", tracker)
        return [UserUtteranceReverted()]

So in this case you want greet to trigger utter_greet, but use action_greet as the triggered action to do the work of both sending the utterance and reverting the mapped action. Hope that helps!

P.S. We’re going to change the documentation a little to make all of this more clear. Thanks for asking questions :slight_smile:

1 Like