Stopping the conversation

rasa-core

(Vikalp Upadhyay) #1

I want to stop the conversation after a particular intent provided by the user. Can I create a custom action that does the same?


(Souvik Ghosh) #2

What do you mean by stop? like the customer can’t ask any more questions or do you just want the bot to forget everything about the user?

You can restart the conversation so the bot forgets all contextual information


(Vikalp Upadhyay) #3

I mean whatever the customer types, bot should not respond. I wanna know if there is a custom action for that?


(Souvik Ghosh) #4

You can pause it, every message to the bot will be ignored


(Vikalp Upadhyay) #5

ok thanks man. I have another question. Do you know how to send shortened links through the bot as replies? The frontend is capable of handling links.


(Souvik Ghosh) #6

You want the links to be programmatically shortened ? use a custom action and use some library to shorted your links and send it back to the user


(Vikalp Upadhyay) #7

I am storing responses as custom actions in a dictionary. I’ll give you an example.

payroll_dict = { ‘block payroll’: ‘To block the payroll of an employee, click on Payroll and choose Block Employee Payroll.’, ‘block the payroll’: ‘To block the payroll of an employee, click on Payroll and choose Block Employee Payroll.’, ‘payroll blocking’: ‘To block the payroll of an employee, click on Payroll and choose Block Employee Payroll.’, }

class ActionRollpay(Action): def name(self): return ‘Action_Rollpay’

def run(self, dispatcher, tracker, domain):
	pa_yroll = tracker.get_slot('pay_roll')
	
	if pa_yroll in payroll_dict:
		reply = payroll_dict[pa_yroll]
	else:
		reply = "It is so odd that I don't have this info on vE. I'm afraid you have to contact the user account manager."
	
	dispatcher.utter_message(reply)
	return [SlotSet('pay_roll', pa_yroll)]

And there is an additional requirement that the link should have the name i desire. Like click here

Do you have any idea of how to do it?