[SOLVED] Compulsory questions

HI Everyone, I am creating a chatbot and I want my bot to ask compulsory questions. For example I want my bot to ask the user his phone number, and it should keeo asking the same question again and again even if the user type something else. The bot should not make any response to any other things until the user gives his phone number. Thank you so much in advance.

You can do this with forms.

Yes I did it , but when I tried to deactivate the form using

  1. self.deactivate()
  2. including action_deactive_form in stories.md

Please tell me how to deactivate forms in actions.py Thank you so much in advance

Hi @technophile_2507

while being in a FormAction on code level, you should be able to call:

return self.deactivate()

Keep a look at the verbose output of the bot - it should show the expected behaviour.

Did that help?

Regards

Thank you @JulianGerhard
I already tried it . It isn’t working in the latest version of Rasa.

Hi @technophile_2507

I just checked. My action server sais:

2019-06-25 14:23:35 DEBUG    rasa_sdk.forms  - Deactivating the form 'feedback_form'
2019-06-25 14:23:35 DEBUG    rasa_sdk.executor  - Finished running 'feedback_form'

And Rasa sais:

2019-06-25 14:23:35 DEBUG    rasa.core.processor  - Action 'feedback_form' ended with events '['BotUttered(text: Okay, gern. Was kann ich sonst für Sie tun?, data: {"elements": null, "quick_replies": null, "but
tons": null, "attachment": null, "image": null, "custom": null}, metadata: {})', 'Form(None)', 'SlotSet(key: requested_slot, value: None)']'
2019-06-25 14:23:35 DEBUG    rasa.core.processor  - Current slot values:
        feedback: None
2019-06-25 14:23:35 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-06-25 14:23:35 DEBUG    rasa.core.policies.memoization  - Current tracker state [None, None, {}, {'prev_action_listen': 1.0, 'intent_start_feedback_form': 1.0}, {'prev_feedback_form': 1.0, 'intent_start_fe
edback_form': 1.0}]
2019-06-25 14:23:35 DEBUG    rasa.core.policies.memoization  - There is a memorised next action '19'
2019-06-25 14:23:35 DEBUG    rasa.core.policies.form_policy  - There is no active form

So imho this works pretty good - doesn’t it? What is your setup and your action if I may ask?

Regards

Thanks @JulianGerhard I want my bot to ask the user email id at the start of chat using form. then i want to deactivate it. Now if I type a hi after entering wrong email , then the chat gets mapped to greeting intent. I want to close the form once the user enters his business email id

Okay. Why do you want to do this with a FormAction? Do you want to validate the address or would it be enough to use a CustomAction which checks if the entity was extracted?

Thank you so much @JulianGerhard. It was a small mistake from my side. Now its working perfectly .I am so grateful for your quick response and expect the same in future. Once again thank you so much. Really it means a lot