I am trying to implement a functionality in my bot which sends a mail when a particular intent is hitted. Currently I can send the mail using Shell Script and Python Connection, but the mail is totally static, i.e. some predefined mail format with fixed Subject,Body.
Our intention is that when the particular mailing_intent is predicted, the user should get the feasibility of writing a free text which is independent of any intent prediction and that is captured using tracker.latest_message[‘text’] and can be used in the body of the mail.
Right now, we can pass the latest message of the mailing intent but I have no idea as how to fetch the free flow text which is independent of any intent prediction
You can use Forms to get free text input. Although a form will fill a slot with the free text input, but I guess that should not be a problem (?)
You can trigger this form on receiving the mail intent, ask the user for free text, and then finally in the submit() method of the form you can send the email.
@saurabh-m523, I get it what you’re trying to say!. But just one clarification I need is that the slot which will be captured has to be defined in nlu file. Without defining the slot, it won’t work. In that case, we have to fill up the slot values with some random data. But free text can go out of the section also.
Or is it possible that we do not define any intent with respect to that slot, and just mention it in domain.yml file and while defining the form, catch an undefined empty slot?
If you have any example regarding this, it would be helpful!!
No need to mention the slot in NLU. Actually NLU does not have slots at all, they are called entities. Slots can be of the same name as entities and are defined in domain.yml file.
So, you can just define an unfeaturized slot in the domain.yml and then fill this slot in your FormAction.
self.from_text(intent=intent_name) will use the next user utterance to fill the text slot slot_name regardless of user intent if intent_name is None else only if user intent is intent_name