Store only user sent messages in the database

I have a chatbot with multiple users and i only want to save the data sent by user and not the chatbot’s responses. I use a postgress db. I want to save only the user_uttered in the database using tracker store otherwise my database will fill-up unnecessarily.

You can do that by creating a action that runs after every story ends and stores user uttered text in your db.

okay. But how to write an action for it

You will have to write your story like

story: story 1
- intent: intent 1
- action: utter_greet
- intent: bye
- action: utter_bye
-action: store_convo

Now you will have to create a custom action naming it as store_convo . To create a custom action, you can check this Custom Actions in Rasa

You can then simply connect with your DB in this custom action and iterate over the tracker to extract the user text and then store it into the DB


i understand If i add that action to every story/rules but what if the user’s message doesn’t come under any intent

Create out of scope intent which will handle everything that is not covered under any of your stories