Personal Assistant to Cancel the Scheduled Reminder to Call

Oh.. I forgot to call you.

Oh.. I forgot that I had a meeting today.

Oh.. I forgot to attend the today’s session.

All of us may have said or have heard these kinds of sentences one or many times in our entire life. May be due to busy schedules or any other reason, and we must have lost many opportunities as well as relations. But not anymore, as I am back with a technical and the coolest solution for the same. Now, you can have a personal assistant in your pocket that can remind you all about meetings, calls, meets, attending the seminars, and many more. We have discussed and implemented this step in our previous blog.

Suppose, now you have and update in your call or meeting. For example your meeting is postponed or cancelled. In that case, you have to tell your assistant about the update so that it will not remind you as per the previous time. But how do we do it, that’s all you will learn in this blog.

Now, lets discuss and implement it.

Implementation

For the implementation, it’s important for us to understand that what conversation flow we want to follow in this blog. So, here is the conversation that we will follow to make you understand abot this concept.

User: Hey buddy!
Bot: Hey, How can I assist you?
User: Actually my meeting has been postponed so don’t remind me for the meeting  now
Bot: Sure, No problem.

So, this is our conversation as per which we will make the changes and we will understand the how to cancel the scheduling.

As you have already seen in the previous blog, that how to schedule the reminder so here are the changes that you have to make in to the rasa files,

actions.py

class ForgetReminders(Action):
"""Cancels all reminders."""

def name(self) -> Text:
return "action_forget_reminders"

async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:

dispatcher.utter_message(f"Okay, I'll cancel all your reminders.")

# Cancel all reminders
return [ReminderCancelled()]

In the actions script, you can see I have created a class with the name “action_forget_reminders” in which we are just calling an utter message saying “Okay, I’ll cancel all your reminders.” which is actually not cancelling any reminders. Reminders are cancelled from the return statement where I have called “ReminderCancelled()”, which will cancel all the existing reminders.

It’s because by default if you will not pass any reminder name so it includes all the reminders that will be canceled. But if you will return “ReminderCancelled(“my_reminder”)” like this then it will only cancel the reminder with the name “my_reminder”. So in this way, we can cancel any reminder whether all or any specific.

nlu.md

## intent: ask_forget_reminders
- forget about it
- don't remind me!
- Forget about the reminder
- do not remind me
- Actually my meeting has been postponed so don’t remind me for the meeting now
- do not remind me!
- Forget reminding me
- Forget reminding me!

This is the intent that we created as the user input based on which our chatbot will cancel the scheduling.

domain.yml

intents:
- ask_forget_reminders:
triggers: action_forget_reminders
actions:
- action_forget_reminders

In the domain file, i have added the intent with name ask_forget_reminders which will trigger the action that we created for cancelling the schedule reminders.

You can also check this video for more clarification,

Before training the model and checking it’s working. Make sure you already have the data added for scheduling a reminder as we have discussed in the previous blog. Check the full code here:

Download Full Code for Reminder Schedule/Cancel bot

Now, train the model and test it with the given commands,

rasa train
rasa x

here is the output for the above code,

This is all about this blog, I hope you have enjoyed this blog. But still, if you are having any queries regarding the topic or you want to share your views then feel free to leave a comment below in the comment section.
Stay tuned and Happy Learning. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *