Frontend state for custom actions

Frontend state for custom actions

I studied the architecture Architecture and the corresponding python code.

As far as I understand user data is text message and extracted entities and form data accessilbe as slots. This is all parsed out from the text sent to the Rasa backend or extracted by entity identification.

Custom actions then can use and access that data via the tracker instance.

Sometimes it is extremely important the actual user/client state can be also passed to a custom action. For example a trading app already may know the market data or user positions. It may be to expensive to retrive it again in backend custom action server.

What is the canonical way to pass such data along each text message that is passed to rest webhook? Ideally there is a way to atttach a dictionary of key value pairs to each text that is sent to the Rasa server and make it accessible in the tracker.

I did not find a reasonable way to do that unless I have my own interpreter that parses the text message. Do I overlook something?

Thanks a lot for a suggestion how to tackle this problem.

Maybe, you can use the unfeaturized slot OR define a custom slot to record this information. Then, you can use the custom action to set the slot at the beginning of the conversation.

Dear Shao, Thanks for the reply. But how do I set the slot from the user side, not from agent or backend? The information I have to pass over to the custom action comes as structured data, e.g. as a Map of key value pairs from the user, to be more precise from the mobile app where the front end of the bot runs.

This is an interesting question. BUT, user can can only fill the slot through the entity. I think it is not possible to fill the slot directly. It would be nice if the devs like @akelad clarify.

Conceptually, to build a sophisticated bot it needs more than just the language context of the conversation. It also needs a possible state of the environment in which the user is. So having such a feature is very valuable.