I have a problem when validating data on forms. So the problem is, whenever, the user inputs data into the form, I wanna validate it from the data from the frontend. I know about custom validation actions, however, I’m not sure how I can get data from the frontend meanwhile I’m in an action. I know about payloads, I can use them to get data from the frontend, but how can I make the action wait until I get data?
For example, the user asks to call a person (let’s call this call_person), this intent activates the form. Now the form asks for the person’s name which is a slot. After the user passes in the person’s name, I want to verify if this person’s name exists in my data which is on the frontend, if it exists then move on with the form, else give a list of similar names from the frontend data and allow the user to choose from it.
Thank you for your reply. Yes, this is somewhat like what I need. However, the problem is that the list of names from which I want to confirm the name is not on the RASA end (python), but is on the frontend. So somehow I want to request the frontend using RASA during the validation (maybe through a hidden response, or a custom response) to give me the list of names so that I can use it in the custom form validation during the validation action.
So basically we have a Flutter app (mobile application), and we were planning to somehow request the list of contacts once the user requests RASA to call a person. We can get the list of contacts and store it in some slot, but then the problem would be when should I request it, because I don’t know when will the user request to call a person and the user may update their contact list just before call request.
User press button call -> post request with text: /user_need_call ->
trigger this intent -> rasa return with payload {text:"please, give permission": payload:need_user_list} ->
frontend check response (if response.payload == 'need_user_list': get list phone and send to rasa)
Yes, this will work fine I think but will create a lot of back and forth between the app and RASA. I was looking for a way using form validation, as I have further questions too in the form which need to be filled after verifying the name
Let’s say I have a case of the message, where the user wants to send a message, I can get the person’s name using your method, however, now I want the message that needs to be sent too (which was my next slot in the form), but since the form is not running anymore and the message that the user needs to send can be anything (i.e. can’t be predicted beforehand), I can’t create an intent for it so that RASA can identify it and fill in the required slot
Make an API that you can call is the custom validation action - Useful when the data is always changing so you can call that API when needed only
Send the frontend data as a hidden payload - Useful when the data is static or does not change that often so that you can send it to Rasa when it changes
For the first option, do you mean to make an API on the frontend (Flutter) end? I don’t think that’s possible, since, it’s not deployed on a server, it’s installed locally on the user’s smartphone.
For the second option, do you mean to send a hidden payload regardless of whether the user wants to make a call or not? If that is the case, then won’t that be wasteful in the sense of available resources?
Yeah I thought that would be the case, but I tried my luck
Send a hidden payload - yes. It would be wasteful - it depends.
It would be wasteful if there was no way to predict when the frontend changes and you keep sending it. It would be less wasteful to do it when the frontend changes only.
If it’s okay to have a 1 minute delay between each hidden message to Rasa, then this wouldn’t be very heavy (what is 1 message per minute in a conversation, really?).
The least wasteful way is if there is a way to detect when the slots will be needed (through a hidden message from Rasa as I explained here).
@itsjhonny Is there a way to interrupt the form in the middle and perform the above-suggested method for verification and continue the same form again?