Rasa Reminders

I am trying to set up a reminder through bot and had the below actions. Reminder is getting executed after one minute as i requested. BBut dispatcher.utter_message is not appearing in screen. Could some one please help in finding the issue?

class ActionAcceptReminder(Action):
    def name(self):
        return 'action_accept_reminder'
    def run(self, dispatcher, tracker, domain):
        print("entered reminder accept action")
        reminderContent = tracker.get_slot('reminderContent')
        import re
        hourfind = re.search('\d+|$',reminderContent)
        if hourfind.group():
            print('First number found = {}'.format(hourfind.group()))
            numberOfHours = int(hourfind.group())
            response = """Sure!! .You get relaxed. will remind you in {} hours""".format(numberOfHours)
            dispatcher.utter_message(response)
            return [ReminderScheduled("action_reminder", datetime.datetime.now() + timedelta(minutes=numberOfHours),kill_on_user_message=False),SlotSet('reminderContent',reminderContent)]
        else:
            print('Not Found')
            response = """I am Sorry. Time is missiing in reminder request"""
            return[]

class ActionAcceptReminder(Action):
    def name(self):
        return 'action_reminder'
    def run(self, dispatcher, tracker, domain):
        reminderContent = tracker.get_slot('reminderContent')
        print("entered reminder accept action" )
            #+ reminderContent)
            #response = """You have scheduled a reminder {}""".format(reminderContent)
            response = """You have scheduled a reminder """
        dispatcher.utter_message(response)
        return [SlotSet('reminderContent',reminderContent)]

and had below stories setup

## Generated Story -reminders

* Reminder{"reminderContent": "to call ibm after 2 hours"}

- slot{"reminderContent": "to call ibm after 2 hours"}

- action_accept_reminder

## Generated Story -reminders execution

- action_reminder

I am getting the message in the action server that DEBUG:rasa_core_sdk.executor:Received request to run ‘action_accept_reminder’

entered reminder accept action

First number found = 1

DEBUG:rasa_core_sdk.executor:Successfully ran 'action_accept_reminder'

127.0.0.1 - - [2018-11-04 23:21:20] "POST /webhook HTTP/1.1" 200 472 0.002077

DEBUG:rasa_core_sdk.executor:Received request to run 'action_reminder'

entered reminder accept action

DEBUG:rasa_core_sdk.executor:Successfully ran 'action_reminder' 

But message is not coming back to the client. I am trying to do this in command line.

Any hep on this is item is very helpful as i still struck with this issue.

HI @sivaramkappaganthu!

So, I can see the action is running properly as illustrated by the print messages, so yes, the fault is happening at this line - dispatcher.utter_message(response)

Are you importing Action from rasa_core_sdk or rasa_core to inherit for your class?

I am importing from rasa_core

**from rasa_core_sdk import Action**

from rasa_core_sdk.events import SlotSet

from rasa_core_sdk.events import UserUtteranceReverted

from rasa_core_sdk.forms import FormAction

from rasa_core_sdk.forms import EntityFormField, BooleanFormField, FreeTextFormField

from rasa_core_sdk.events import ReminderScheduled

@akelad or @Juste … Any idea on why am i not able to get the response back to the bot??

what do your rasa core logs look like?

I have the same problem, the scheduled job starts and the action runs, but the utterance is only visible in the logs, not at the screen.

Here are the logs:

21.12.2018 11:11:44 DEBUG:apscheduler.scheduler: Looking for jobs to run 21.12.2018 11:11:44 INFO:apscheduler.executors.default: Running job “MessageProcessor.handle_reminder (trigger: date[2018-12-21 11:11:44 ], next run at: 2018-12-21 11:11:44 )” (scheduled at 2018-12-21 11:11:44+01:00) 21.12.2018 11:11:44 DEBUG:rasa_core.tracker_store: Recreating tracker for id ‘default’ 21.12.2018 11:11:44 INFO:apscheduler.scheduler: Removed job cbc1e058-0508-11e9-a86a-784f4388017d 21.12.2018 11:11:44 DEBUG:rasa_core.actions.action: Calling action endpoint to run action ‘action_slider_check_in’. 21.12.2018 11:11:44 DEBUG:apscheduler.scheduler: No jobs; waiting until a job is added 21.12.2018 11:11:44 DEBUG:rasa_core_sdk.executor: Received request to run ‘action_slider_check_in’ 21.12.2018 11:11:44 INFO:root: *** running action_slider_check_in *** 21.12.2018 11:11:44 DEBUG:rasa_core_sdk.executor: Successfully ran ‘action_slider_check_in’ 21.12.2018 11:11:44 DEBUG:rasa_core.processor: Action ‘action_slider_check_in’ ended with events ‘[]’ 21.12.2018 11:11:44 DEBUG:rasa_core.processor: Bot utterance ‘BotUttered(text: Hallo Mister-X, hast du Zeit für die üblichen Fragen?, data: { “elements”: null, “buttons”: [ { “payload”: “/inform{“slider_check_in”: “ja”}”, “title”: “Ja, gerne.” }, { “payload”: “/inform{“slider_check_in”: “nein”}”, “title”: “Nein, jetzt nicht.” } ], “attachment”: null })’

class ActionSliderCheckIn(Action): def name(self): return ‘action_slider_check_in’

def run(self, dispatcher, tracker, domain):
    logging.info('*** running action_slider_check_in ***')
    dispatcher.utter_template("utter_slider_check_in", name=User.get_user_name(tracker.sender_id), tracker=tracker)
    return []

rasa-core 0.12.3
rasa-core-sdk 0.12.1
rasa-nlu 0.13.7

Hey is this problem solved?

Hi I am also facing a similar issue. The scheduler job starts and action runs, but the message is only visible in logs and not on command line. I have upgraded to latest version of Rasa Core: rasa_core==0.13.2 rasa_core_sdk==0.12.2 rasa_nlu==0.14.4

Please let me know, if you any other details to resolve this. Thanks.

Same issue here.

rasa-core==0.14.0
rasa-core-sdk==0.14.0

i am also facing same issue using RASA 1.0

@mohangunta can you create a new post with your relevant data, i.e. actions code and the output?

Hi @erohmensing, I am not sure if I should start a new thread. However I am facing the same problem as these guys. Weird thing is that the reminder is able to utter_message at Rasa x. After 1minute, I saw that the message is displayed there. But when I tried using a custom channel, I am not able to see the message.

Currently the way I am testing is to run Rasa x --enable-api. My custom channel would then send a message to http://localhost:5005/webhooks/rest/webhook. I am able to receive a response but I am not able to receive the response that is scheduled 30sec after the first action.

Strangely, when I went to rasa x @ localhost:5002/conversations, I saw that the bot was able to utter_message after 30 sec.

So in conclusion, I am able to view the scheduled message after 30 sec at Rasa X but I am not able to view it at my custom channel.

Would be glad if you could help. Thanks!

1 Like

@enzechua Hm, that’s indeed strange. Do you have access to the requests hitting your channel and their respones?

Hello @erohmensing yes. I have actually tried an experiment. So I created an action and in the Run method, I did

def run (self, dispatcher, tracker, domain):
  dispatcher.utter_message("TESTING") 
  return []

and I was able to get a response back. However, when I tried to run

def run (self, dispatcher, tracker, domain):
  dispatch.utter_message("TESTING")
  return 
  [ReminderScheduled(
  action_name="action_blacklist_removal",
  trigger_date_time=scheduled_time,
  kill_on_user_message=False)] 

I did not manage to get a response back, however the scheduler was working. So yes, the weird thing was when I access rasa x, I was able to see the response. I was just not able to see the response in my custom channel.

Which led me to the assumption that dispatcher.utter_message works for everything except when I return a ReminderScheduled in my custom channel.

Sorry, I meant the HTTP requests :grinning_face_with_smiling_eyes:would be good to see if they are maybe formatted strangely and that’s why they aren’t rendering on the frontend of your custom channel

Sorry for the late reply, didn’t see it! Yes I am able to print out the HTTP requests. I would send a message to localhost:5005/webhooks/rest/webhook and then get back a response from it. So from the above example, I was able to get and print the response of utter_message("testing") from my action. But as soon as I use a ReminderScheduled action to trigger another action and to utter_message("testing") from the second action that was triggered by the ReminderScheduled, the response wasn’t shown!

I am not sure if it is because I have a thread that is making a request to rasa. From there, I am able to get back an immediate response. But when the scheduler is done doing the job and it utters back a message, there isn’t any thread to get that response and send to the custom channel. My thoughts might be wrong though. Hope to hear from you @erohmensing, thanks!

But when the scheduler is done doing the job and it utters back a message, there isn’t any thread to get that response and send to the custom channel.

Hm I would recommend using asyncio instead of threads, but I still don’t assume that’s the problem – can you put the HTTP requests for the following situation here so I can check them out?

So from the above example, I was able to get and print the response of utter_message("testing") from my action. But as soon as I use a ReminderScheduled action to trigger another action and to utter_message("testing") from the second action that was triggered by the ReminderScheduled, the response wasn’t shown!