# Utter\_button\_template in custom action of actions.py

**URL:** <https://forum.rasa.com/t/utter-button-template-in-custom-action-of-actions-py/9797>\
**Category:** Rasa Open Source\
**Created:** [May 15, 2019, 11:51am UTC](https://forum.rasa.com/t/utter-button-template-in-custom-action-of-actions-py/9797 "2019-05-15T11:51:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cs-2007](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/cs-2007/32/2451_2.png) [@cs-2007](https://forum.rasa.com/u/cs-2007)\
**Post date:** [May 15, 2019, 11:51am UTC](https://forum.rasa.com/t/utter-button-template-in-custom-action-of-actions-py/9797/1 "2019-05-15T11:51:24Z")

</div>

I need to display a set of buttons in custom action using **utter\_button\_template()**. These buttons will be used to fill a slot. I am facing problem in how to define the parameters for utter\_button\_template(), as for now my code flow doesn’t show any error but doesn’t even show the buttons in front end. Below is the code I am using : class action\_CustomAction(Action): def name(self): return ‘action\_’

```
    buttons = [{'title': 'title1', 'payload': '/intent{\"Entity_name\": "payload1"}'},{'title': 'title2', 'payload': 
                     '/intent{\"Entity_name\": "payload2"}'}]
    def run(self, dispatcher, tracker, domain):
          if tracker.get_slot('Slot_name') == 'yes':
              dispatcher.utter_button_template('utter_message', 'buttons', tracker)
          else:
              dispatcher.utter_button_template('utter_message_1', 'buttons', tracker)
          return [SlotSet("Other_slot","buttons")]
```

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [May 21, 2019, 1:13pm UTC](https://forum.rasa.com/t/utter-button-template-in-custom-action-of-actions-py/9797/2 "2019-05-21T13:13:09Z")

</div>

Looks like you are passing the string `'buttons'` instead of your button list. Try this:

```auto
buttons = [{'title': 'title1', 'payload': '/intent{\"Entity_name\": "payload1"}'},{'title': 'title2', 'payload': 
                     '/intent{\"Entity_name\": "payload2"}'}]
    def run(self, dispatcher, tracker, domain):
          if tracker.get_slot('Slot_name') == 'yes':
              dispatcher.utter_button_template('utter_message', buttons, tracker)
          else:
              dispatcher.utter_button_template('utter_message_1', buttons, tracker)
          return [SlotSet("Other_slot","buttons")]

```

What are you trying to do with your slotset event? right now you’re setting a slot to the value “buttons”. It seems like you want to rather put the list there (`return [SlotSet("Other_slot", buttons)]`), but i’m not quite sure why you would want to do that.
