Is it possible to fetch the past 15 user inputs/questions?

Dear Team,

I have gone through some interesting thing to know that? Is it possible to show the user his/her previous searches/questions? when an user asked for it like!

let’s say user asked like → Hey Rasa, what are my last 15 searches/questions? Bot should respond with his/her last 15 searches/questions?

Best Regards, Ravi

Yes, you can write a custom action that gets the past user events from the tracker store. The user event is documented here.

Something like this:

    for e in reversed(tracker.events):
        if e.get("event") == 'user':
            print(f"text: {e.get('text')}")
    return None

Hi @stephens Thank you very much for your response. Let me try this way.

Best Regards, Ravi