Button in custom action


I want to display buttons in a custom action (because the number of buttons depends on a request). For this, I tried to use dispatcher.utter_button_template(message, buttons, tracker) and dispatcher.utter_button_message(message, buttons), but when the action is run, nothing happens.

Here is my action class :

class ActionChooseRoute(Action):

	def name(self):
		return 'action_choose_route'
	def run(self, dispatcher, tracker, domain):
		if tracker.get_slot("stop_name") != None:
			possible_routes = [{"route_name" : "B"}, {"route_name": "4"}, {"route_name": "6"}]

			message = "Plusieurs lignes passent par l'arrêt " + tracker.get_slot("stop_name") + ", quelle est celle qui vous intéresse ? "

			buttons = []
			for route in possible_routes:
				title = ("la " + route["route_name"])
				payload = ('/slot{\"route_name\": '+ route["route_name"] + '}')
				buttons.append({ "title": title, "payload": payload })

			dispatcher.utter_button_template(message, buttons, tracker)

		return []

Does anybody know the solution ?

Thanks !

My mistake. utter_button_template doesn"t work (maybe it is why it is written “deprecated” in the code ?), but utter_button_message works fine ! Sorry for this useless question !

Both worked for me. Which version of core are you using?