Bot not asking for slots in Form

Hi, I don’t know why my bot is not asking for any slots in form. I have in stories:

## 1action send mail
* intent_send_mail
  - ask_send_email_form
  - form{"name":"ask_send_email_form"}
  - form{"name": null}

in actions:

class ActionAskSendEmail(FormAction):
    RANDOMIZE = False

    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        return ["subject", "text_mess", "useremail", "username"  ]

    def name(self):
        return 'ask_send_email_form'

    def submit(self,
               dispatcher: CollectingDispatcher,
               tracker: Tracker,
                domain: Dict[Text, Any]) -> List[Dict]:
        subject = tracker.get_slot("subject")
        text_mess = tracker.get_slot("text_mess")
        useremail = tracker.get_slot("useremail")
        username = tracker.get_slot("username")

        dispatcher.utter_message('/mail {{"fromName":"{}","fromEmail":"{}","toEmail":"{}","subject":"{}","content":"{}"}}'.format(username, useremail, to, subject,  text_mess))
        return [{"event":"followup", "name":"action_renew"}]

and I’m getting the answer: (bot is uttering None):

DEBUG:rasa_core.processor:Received user message 'send email' with intent '{'name': 'intent_send_mail', 'confidence': 0.972303569316864}' and entities '[]'
DEBUG:rasa_core.processor:Logged UserUtterance - tracker now has 2 events
DEBUG:rasa_core.processor:Current slot values: 
	
	form_control: None
	requested_slot: None
	sms: None
	subject: None
	summary: None
	text: None
	text_mess: None
	title: None
	to: None
	useremail: None
	username: None
DEBUG:rasa_core.policies.form_policy:There is no active form
DEBUG:rasa_core.policies.memoization:Current tracker state [None, None, None, {}, {'intent_intent_send_mail': 1.0, 'prev_action_listen': 1.0}]
DEBUG:rasa_core.policies.memoization:There is a memorised next action '38'
DEBUG:rasa_core.policies.ensemble:Predicted next action using policy_2_MemoizationPolicy
DEBUG:rasa_core.processor:Predicted next action 'ask_send_email_form' with prob 1.00.
DEBUG:rasa_core.actions.action:Calling action endpoint to run action 'ask_send_email_form'.
DEBUG:rasa_core.processor:Action 'ask_send_email_form' ended with events '['Form(ask_send_email_form)', 'SlotSet(key: requested_slot, value: subject)']'
DEBUG:rasa_core.processor:Bot utterance 'BotUttered(text: None, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
DEBUG:rasa_core.policies.form_policy:There is an active form 'ask_send_email_form'

why is not asking my utter_ask_subject?

templates:
  
  utter_ask_to:
  - text: "Can you tell me who it is for?"

  utter_ask_text_mess:
  - text: "Can you enter the message please?"

  utter_ask_subject:
  - text: "Can you tell me what is the subject?"

can anyone help me, please? I’m getting desperate

1 Like

I can see that the problem is in the request_next_slot() function in rasa_core_sdk.forms.py. In the

dispatcher.utter_template("utter_ask_{}".format(slot),
                                          tracker,
                                          silent_fail=False,
                                          **tracker.slots)

it’s working if I remove the **tracker.slots, but if I let it there is not sending the utter_ask_slot. It’s working in an other bot for me, but not in this, and I can’t guess why…

I solved it.

It was because I had an slot called “text”, and it appears that this is not allowed. Changed “text” slot to “texto” and worked.

Great debugging! :rocket:

What if i want subjects choice from webservice call? Is there any way to call api with utter_ask_subject and then user select one of them.

utter_ask_subject:

  • text: “Can you tell me what is the subject?”

@vb2vish you would have to overwrite the request_next_slot method so that if the required slot is subject, do some custom code and then dispatcher.utter_message() whatever message you like.

1 Like