Can a rule be conditioned to an intent?

My bot start a conversation postind an intent. I would like to have a rule to fill a form but if there is the intent. In the steps the rule doesn’t take two consecutive intents.

For example : the bot start the conversation asking if the user wants to register (intent=“register”) if the user answer “ok” (intent=“affirm”) a rule should activate the registration_form but only if the intent=“register” + intent=“affirm” Is there a good way to do it? After many days of studying I still in the high waters…:slight_smile: Thanks for help !

A little unsure of what you mean. So if the user wants to register (/register), you want the bot to confirm this from the user (“Are you sure you want to register?”) and only if the user says yes (/affirm), you want to trigger the registration form?

@drindrin This is demo code for your use case, do update the code, as per your requirement.

rules:
  - rule: Activate registration form 
    steps:
    - intent: schedule_registration_form
    - action: registration_form
    - active_loop: registration_form

  - rule: Submit registration_form
    condition:
    # Condition that form is active.
    - active_loop: registration_form
    steps:
    - action: registration_form
    - active_loop: null
    - action: utter_submit


Then, you’ll have a rule or story that prompts your question on if they’d like to fill the registration or not. You’ll need two to cover the affirm + deny scenarios:

 - rule: offering registration, affirm
    steps:
    # you have the user doing something, then offer the registration form:
    - action: utter_registration_request
    - intent: affirm
    - action: registration_form
    - active_loop: registratioon_form

  - rule: offering registration, deny
    steps:
    # you have the user doing something, then offer the registration form:
    - action: utter_registration_request
    - intent: deny
    - action: utter_registration_deny

I hope this will solve you query. If this solve please close this thread for others.Good Luck!

Thanks ! It seems that it’s exactly what I need …so my bot have to start the conversation requesting the action “utter_registration_request” ?How am I going to do that ?

@drindrin Did you tried the above code or understand the logic?

Not yet …I will be back after I tried.

Sorry but I don’t really know how to request the action “utter_registration_request”…any hint ? (I’m really a beginner )

@drindrin will you able to write form action code in action.py?

yes

yes

yes

@drindrin then where you stuck?

I though I don’t need an action for the form…let me review the docs…sorry

Thanks everything it’s ok !

@drindrin you are welcome. If you further need help do let me know please.

Yes Nik I need your help …sorry. I understood that my bot should start the conversation with “utter_registration_request” but rasa starts expecting an input form user…how am I going to have the bot starting ? (silly question but I can’t figure out :woozy_face: ) PS:Should I start another topic?

@drindrin Any front end you are using or you are using rasa-x?

I’m using rasa opensource

@drindrin create a new thread for rasa open source bot integration, this thread is not related to this topic.

ahhahaha I understood now your question on my previous topic about front end …sorry