How can I send the message “I’m ending the session if you won’t talk to me” to the user when 30 minutes have passed after the conversational ends?
for example;
user: hello What’s your name?
chatbot: I’m a bot
after 30 minute;
chatbot: I’m ending the session if you won’t talk to me
I think you’ll need to use External Events for this. There’s a session timeout but no event that is thrown when the timeout is hit (Rasa is not monitoring this - it determines the timeout if and when the user tries to start the session again).
Maybe an external process (service or cron job) that processes the tracker store since it’s last interval, notes new session id’s, checks for last activity on other session id’s. If the 30 mins have passed, send an external event with your message.
You could use something like this, just add reset if user sends new message
# import the time module
import time
# define the countdown func.
def countdown(t):
while t:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
t -= 1
print('Fire in the hole!!')
# input time in seconds
t = input("Enter the time in seconds: ")
# function call
countdown(int(t))
How should I define in the story section? I did it this way but there was a problem. The problem is that; The chatbot waits for 120 seconds to give the answer and then both the reply and the logout message come at the same time.
after 120 seconds;
I want to say “Great, carry on!” the text will come, and after 120 seconds the text “I’m ending the session if you won’t talk to me” will come.