Manage 2-step fallback on form if value isn't validated

Hi !

I’m looking for a way to manage failure in a form ; my goal is to have a step like :

  • bot: do you have a code ?
  • me: intent_affirm
  • bot: tell me
  • me: 1234-4567
  • → failure detected (bad code)
  • bot: the code seems wrong ; do you want to retry with another ? → user wants to retry
  • me: intent_affirm
  • bot: okay, write it
  • me: intent_deny → alternative, user doesn’t want
  • bot: okay, stop the form

If no failure detected, so the bot stop the form too. But I want to loop on this process’, the bot ask → if wrong, ask if retry → if yes, ask the code another time → loop

At this time I got this :

version: "2.0"
stories:
- story: User has share code
  steps:
  - checkpoint: ask_share_code
  - action: utter_ask_has_share_code
  - intent: affirm
  - action: share_code_form
  - active_loop: share_code_form
  - slot_was_set:
    - requested_slot: share_code
  - active_loop: null
  - action: utter_form_submit

I have a custom action, “validate_share_code_form” with a method “validate_share_code”, that validate the code (indeed) and fill the slot (or not) :

def validate_share_code(self, slot_value, dispatcher, tracker, domain):
    if slot_value.lower() in self.share_code_db():
        return {"share_code": slot_value}
    else:
        return {"share_code": None}

Is it possible to have this kind of process’, only with stories ? Or, if no choice, with custom action ?

Thanks !

EDIT

Here is a model of what I want to achieve