ReminderScheduled doesn't work

Hi! I have an issue with ReminderScheduled. I’m returning an anction, but it’s not running. acctions.py: class Remember(Action): def name(self): return ‘reminder_’

def run(self, dispatcher, tracker, domain):
    export_timeout = datetime.timedelta(seconds=30)
    dispatcher.utter_message("Me dan ganas de llorar")
    return [ReminderScheduled("utter_reminder", datetime.datetime.now() + datetime.timedelta(seconds=20))]

Stories.md

Get Solution MalwareType

  • request_solution_malwaretype
    • change_slot_solution
    • name_malwaretype_form
    • form{“name”: “name_malwaretype_form”}
    • form{“name”: null}
    • utter_description_malwaretype
    • reminder_

Can you help me, please?

Do you have the action name registered in your domain.yml? It’s pretty difficult to tell what the issue is without knowing that, and what the conversation looks like in the tracker. Your story seems right, and the return value for your run seems correct, but there’s just not enough context to know what’s causing the issue.

Hi nivek, thanks for your answer.

The full code in actions.py:

class Remember(Action): def name(self): return ‘reminder_’

def run(self, dispatcher, tracker, domain):
    return [ReminderScheduled("utter_reminder", datetime.datetime.now() + datetime.timedelta(seconds=20))]

I removed the dispatcher.utter_message because it’s just a test.

In domain.yml I have: intents: … entities: … slots: …

templates:
utter_reminder:

  • text: Some text. …

actions:

  • reminder_ …

forms: …

Sorry, that’s still not a lot of information, but at least I see it’s registered properly. In your actions.py do you import ReminderScheduled? Do you have a line like this at the top of your file:

from rasa_sdk.events import ReminderScheduled

The program run until utter_description_malwaretype correctly.

If you do have that line at the top, could you provide the logs for your action server? That would be a big help.

I have this imports:

from typing import Dict, Text, Any, List, Union, Optional
    from rasa_sdk import Tracker
    from rasa_sdk.executor import CollectingDispatcher
    from rasa_sdk.forms import FormAction
    from rasa_sdk.events import SlotSet, ReminderScheduled
    from rasa_sdk import Action
    from Database import getMalwareTypeDescription, getMalwareTypeSolution
    import datetime
    from datetime import timedelta

I used “rasa shell -vv”

2019-11-07 19:22:24 INFO     root  - Starting Rasa server on http://localhost:5005
2019-11-07 19:22:24 DEBUG    rasa.core.utils  - Using the default number of Sanic workers (1).
2019-11-07 19:22:24 INFO     root  - Enabling coroutine debugging. Loop id 98058696.
2019-11-07 19:22:24 DEBUG    rasa.model  - Extracted model to '/tmp/tmp63btfo26'.
2019-11-07 19:22:27 INFO     absl  - Entry Point [tensor2tensor.envs.tic_tac_toe_env:TicTacToeEnv] registered with id [T2TEnv-TicTacToeEnv-v0]
2019-11-07 19:22:27 DEBUG    rasa.core.tracker_store  - Connected to InMemoryTrackerStore.
2019-11-07 19:22:27 DEBUG    rasa.core.lock_store  - Connected to lock store 'InMemoryLockStore'.
2019-11-07 19:22:27 DEBUG    rasa.model  - Extracted model to '/tmp/tmp_4o1hppc'.
2019-11-07 19:22:27 DEBUG    pykwalify.compat  - Using yaml library: /home/sonia/.local/lib/python3.6/site-packages/ruamel/yaml/__init__.py
Bot loaded. Type a message and press enter (use '/stop' to exit): 
Your input ->  ¿Cómo elimino un Ransomware?                                                                                                   
2019-11-07 19:22:47 DEBUG    rasa.core.tracker_store  - Creating a new tracker for id 'default'.
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Received user message '¿Cómo elimino un Ransomware?' with intent '{'name': 'request_solution_malwaretype', 'confidence': 0.9999113082885742}' and entities '[{'start': 17, 'end': 27, 'value': 'Ransomware', 'entity': 'name_malwaretype', 'confidence': 0.9484920716232873, 'extractor': 'CRFEntityExtractor'}]'
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Current slot values: 
	description_malwaretype: None
	has_antivirus: None
	name_malwaretype: None
	operating_system: None
	requested_slot: None
	search: None
	typemachine: None
	what_antivirus: None
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Logged UserUtterance - tracker now has 2 events
2019-11-07 19:22:47 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - Current tracker state [None, None, None, {}, {'prev_action_listen': 1.0, 'intent_request_solution_malwaretype': 1.0}]
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - There is a memorised next action '9'
2019-11-07 19:22:47 DEBUG    rasa.core.policies.form_policy  - There is no active form
2019-11-07 19:22:47 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Predicted next action 'change_slot_solution' with confidence 1.00.
2019-11-07 19:22:47 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'change_slot_solution'.
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Action 'change_slot_solution' ended with events '['SlotSet(key: search, value: solution)']'
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Current slot values: 
	description_malwaretype: None
	has_antivirus: None
	name_malwaretype: None
	operating_system: None
	requested_slot: None
	search: solution
	typemachine: None
	what_antivirus: None
2019-11-07 19:22:47 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - Current tracker state [None, None, {}, {'prev_action_listen': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_change_slot_solution': 1.0, 'intent_request_solution_malwaretype': 1.0}]
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - There is a memorised next action '25'
2019-11-07 19:22:47 DEBUG    rasa.core.policies.form_policy  - There is no active form
2019-11-07 19:22:47 DEBUG    rasa.core.policies.mapping_policy  - There is no mapped action for the predicted intent, 'request_solution_malwaretype'.
2019-11-07 19:22:47 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Predicted next action 'name_malwaretype_form' with confidence 1.00.
2019-11-07 19:22:47 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'name_malwaretype_form'.
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Action 'name_malwaretype_form' ended with events '['Form(name_malwaretype_form)', 'SlotSet(key: description_malwaretype, value: Para evitar este tipo de malware es importante tener cuidado con el spam, pues es el método más empleado para su propagación. \n\t También es recomendable disponer de algún programa con protección en tiempo real, por ejemplo, Malwarebytes para Windows. \n\t Para evitar pérdida de información, es recomendable realizar copias de seguridad de forma periódica, y asegurarse de que el software utilizado está actualizado.\n\t Si el equipo ya ha sido ifectado, existen herramientas gratuitas como Alcatraz Locker, BadBlock o CryptoMix\n\t que pueden eliminarlo y restaurar los ficheros que hayan sido encriptados.)', 'Form(None)', 'SlotSet(key: requested_slot, value: None)']'
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Current slot values: 
	description_malwaretype: Para evitar este tipo de malware es importante tener cuidado con el spam, pues es el método más empleado para su propagación. 
	 También es recomendable disponer de algún programa con protección en tiempo real, por ejemplo, Malwarebytes para Windows. 
	 Para evitar pérdida de información, es recomendable realizar copias de seguridad de forma periódica, y asegurarse de que el software utilizado está actualizado.
	 Si el equipo ya ha sido ifectado, existen herramientas gratuitas como Alcatraz Locker, BadBlock o CryptoMix
	 que pueden eliminarlo y restaurar los ficheros que hayan sido encriptados.
	has_antivirus: None
	name_malwaretype: None
	operating_system: None
	requested_slot: None
	search: solution
	typemachine: None
	what_antivirus: None
2019-11-07 19:22:47 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - Current tracker state [None, {}, {'prev_action_listen': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_change_slot_solution': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_name_malwaretype_form': 1.0, 'intent_request_solution_malwaretype': 1.0}]
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - There is a memorised next action '17'
2019-11-07 19:22:47 DEBUG    rasa.core.policies.form_policy  - There is no active form
2019-11-07 19:22:47 DEBUG    rasa.core.policies.mapping_policy  - There is no mapped action for the predicted intent, 'request_solution_malwaretype'.
2019-11-07 19:22:47 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Predicted next action 'utter_description_malwaretype' with confidence 1.00.
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Action 'utter_description_malwaretype' ended with events '['BotUttered(text: Para evitar este tipo de malware es importante tener cuidado con el spam, pues es el método más empleado para su propagación. \n\t También es recomendable disponer de algún programa con protección en tiempo real, por ejemplo, Malwarebytes para Windows. \n\t Para evitar pérdida de información, es recomendable realizar copias de seguridad de forma periódica, y asegurarse de que el software utilizado está actualizado.\n\t Si el equipo ya ha sido ifectado, existen herramientas gratuitas como Alcatraz Locker, BadBlock o CryptoMix\n\t que pueden eliminarlo y restaurar los ficheros que hayan sido encriptados., data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {})']'
2019-11-07 19:22:47 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - Current tracker state [{}, {'prev_action_listen': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_change_slot_solution': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_name_malwaretype_form': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_utter_description_malwaretype': 1.0, 'intent_request_solution_malwaretype': 1.0}]
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - There is a memorised next action '11'
2019-11-07 19:22:47 DEBUG    rasa.core.policies.form_policy  - There is no active form
2019-11-07 19:22:47 DEBUG    rasa.core.policies.mapping_policy  - There is no mapped action for the predicted intent, 'request_solution_malwaretype'.
2019-11-07 19:22:47 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Predicted next action 'reminder_' with confidence 1.00.
2019-11-07 19:22:47 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'reminder_'.
Para evitar este tipo de malware es importante tener cuidado con el spam, pues es el método más empleado para su propagación. 
	 También es recomendable disponer de algún programa con protección en tiempo real, por ejemplo, Malwarebytes para Windows. 
	 Para evitar pérdida de información, es recomendable realizar copias de seguridad de forma periódica, y asegurarse de que el software utilizado está actualizado.
	 Si el equipo ya ha sido ifectado, existen herramientas gratuitas como Alcatraz Locker, BadBlock o CryptoMix
	 que pueden eliminarlo y restaurar los ficheros que hayan sido encriptados.
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Action 'reminder_' ended with events '['ReminderScheduled(action: utter_reminder, trigger_date: 2019-11-07 19:22:48.670864, name: 999e4e38-018b-11ea-83f3-c8ff28a04407)']'
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Current slot values: 
	description_malwaretype: Para evitar este tipo de malware es importante tener cuidado con el spam, pues es el método más empleado para su propagación. 
	 También es recomendable disponer de algún programa con protección en tiempo real, por ejemplo, Malwarebytes para Windows. 
	 Para evitar pérdida de información, es recomendable realizar copias de seguridad de forma periódica, y asegurarse de que el software utilizado está actualizado.
	 Si el equipo ya ha sido ifectado, existen herramientas gratuitas como Alcatraz Locker, BadBlock o CryptoMix
	 que pueden eliminarlo y restaurar los ficheros que hayan sido encriptados.
	has_antivirus: None
	name_malwaretype: None
	operating_system: None
	requested_slot: None
	search: solution
	typemachine: None
	what_antivirus: None
2019-11-07 19:22:47 DEBUG    rasa.core.policies.fallback  - NLU confidence threshold met, confidence of fallback action set to core threshold (0.3).
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - Current tracker state [{'prev_action_listen': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_change_slot_solution': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_name_malwaretype_form': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_utter_description_malwaretype': 1.0, 'intent_request_solution_malwaretype': 1.0}, {'prev_reminder_': 1.0, 'intent_request_solution_malwaretype': 1.0}]
2019-11-07 19:22:47 DEBUG    rasa.core.policies.memoization  - There is a memorised next action '0'
2019-11-07 19:22:47 DEBUG    rasa.core.policies.form_policy  - There is no active form
2019-11-07 19:22:47 DEBUG    rasa.core.policies.mapping_policy  - There is no mapped action for the predicted intent, 'request_solution_malwaretype'.
2019-11-07 19:22:47 DEBUG    rasa.core.policies.ensemble  - Predicted next action using policy_1_MemoizationPolicy
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Predicted next action 'action_listen' with confidence 1.00.
2019-11-07 19:22:47 DEBUG    rasa.core.processor  - Action 'action_listen' ended with events '[]'
2019-11-07 19:22:47 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'default'.

I can see the Reminder was scheduled here, though it looks like it’s set to trigger 1 second after it was scheduled – you might need to increase the timeout to 30 seconds and leave Rasa running while the timeout starts (please provide logs if you’re still having issues), but I’m guessing the underlying issue is more related to the way the action executed and the message is sent to the client. Are you using the REST channel?

What I’ve noticed is that if you’re using the REST channel, unless you have a way for Rasa to send a message proactively (via a POST in a custom action), you don’t see a message from Rasa, since it’s sending the utterance to the tracker. So the action is executed but the message itself is never sent to the client.

Sidenote – I’d recommend changing this:

import datetime
from datetime import timedelta

To this:

from datetime import datetime, timedelta

that will clean up your imports a bit, but you’d have to change wherever you use datetime.datetime.now() to just datetime.now(). Just a suggestion, though.

Hi niveK!

I changed the impot and the seconds as you said. I haven’t any POST action. Now I’m calling a CustomAction instead of utter_reminder.

class Remember(Action):
    def name(self):
        return 'reminder_'

    def run(self, dispatcher, tracker, domain):
        return [ReminderScheduled("pues", datetime.now() + timedelta(seconds=30))]

class RememberPues(Action):
    def name(self):
        return 'pues'

    def run(self, dispatcher, tracker, domain):
        dispatcher.utter_template('utter_reminder', tracker)
        return []

I think the problem is the channel.

I had this in credentials.yml

rest:
rasa:
  url: "http://localhost:5002/api"

I changed it to this using bgrok:

rest: rasa: url: “http://7c094151.ngrok.io

I realized that it works with Rasa x, but not in the ubuntu’s console. ¿Should I change the channel?