# Rasa X - Buttons

**URL:** <https://forum.rasa.com/t/rasa-x-buttons/17270>\
**Category:** \[Deprecated\] Rasa X Community Edition\
**Created:** [September 26, 2019, 5:33am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270 "2019-09-26T05:33:40Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Star](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@Star](https://forum.rasa.com/u/Star)\
**Post date:** [September 26, 2019, 5:33am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/1 "2019-09-26T05:33:40Z")

</div>

Hi! I’m using Rasa X version 0.21.0 and the buttons right below redirects me to another similar page instead of the payload/intent inside the buttons. ![37%20PM](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/8/85cc40a9e703fd75962ef74a3c6bbf5901e2818f.png)It redirects me here:

 ![13%20PM](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/8/87b12da5733a0fd8a6ec74f12c15cfc6c6ab9e4e.png)I’m using a custom action for two stage fallback policy. Here’s the code:

```
class ActionDefaultAskAffirmation(Action):
"""Asks for an affirmation of the intent if NLU threshold is not met."""
def name(self) -> Text:
    return "action_default_ask_affirmation"

def __init__ (self) -> None:
    import pandas as pd

    self.intent_mappings = pd.read_csv("data/" "intent_description_mapping.csv", encoding="utf-8")
    self.intent_mappings.fillna("", inplace=True)
    self.intent_mappings.entities = self.intent_mappings.entities.map(
        lambda entities: {e.strip() for e in entities.split(",")}
    )

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

    intent_ranking = tracker.latest_message.get("intent_ranking", [])
    if len(intent_ranking) > 1:
        diff_intent_confidence = intent_ranking[0].get(
            "confidence"
        ) - intent_ranking[1].get("confidence")
        if diff_intent_confidence < 0.2:
            intent_ranking = intent_ranking[:2]
        else:
            intent_ranking = intent_ranking[:1]
    first_intent_names = [
        intent.get("name", "")
        for intent in intent_ranking
        if intent.get("name", "") != "out_of_scope"
    ]

    message_title = (
        "Sorry, I'm not sure I've understood " "you correctly 🤔 Do you mean...".encode("utf-8")
    )

    entities = tracker.latest_message.get("entities", [])
    entities = {e["entity"]: e["value"] for e in entities}

    entities_json = json.dumps(entities)

    buttons = []
    for intent in first_intent_names:
        logger.debug(intent)
        logger.debug(entities)
        buttons.append(
            {
                "title": self.get_button_title(intent, entities),
                "payload": "/{}{}".format(intent, entities_json),
            }
        )

    buttons.append({"title": "Something else", "payload": "/out_of_scope"})

    dispatcher.utter_button_message(message_title, buttons=buttons)

    return []

def get_button_title(self, intent: Text, entities: Dict[Text, Text]) -> Text:
    default_utterance_query = self.intent_mappings.intent == intent
    utterance_query = (
        self.intent_mappings.entities == entities.keys() & default_utterance_query
    )

    utterances = self.intent_mappings[utterance_query].button.tolist()

    if len(utterances) > 0:
        button_title = utterances[0]
    else:
        utterances = self.intent_mappings[default_utterance_query].button.tolist()
        button_title = utterances[0] if len(utterances) > 0 else intent

    return button_title.format(**entities)

```

---

<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:** [September 26, 2019, 12:10pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/2 "2019-09-26T12:10:54Z")

</div>

Hey there @Star, thanks for the bug report! It has nothing to do with your code. We just ran into this one and are aware of it, should be fixed in an upcoming patch 👍

---

<div class="post-metadata">

**Author:** ![intranetchris](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/intranetchris/32/3038_2.png) [@intranetchris](https://forum.rasa.com/u/intranetchris)\
**Post date:** [October 2, 2019, 6:11pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/3 "2019-10-02T18:11:32Z")

</div>

@erohmensing I don’t see this issue in Github, and the issue has persisted through 0.21.1 and 0.21.2. To me this is a blocker / highest priority issue as it makes our bot, which uses buttons heavily, absolutely unusable within Rasa X (still works on Messenger, fortunately). Should I create this issue in Github?

---

<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:** [October 3, 2019, 5:12pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/4 "2019-10-03T17:12:17Z")

</div>

Sure thing, we are aware of it already, but feel free to make a github issue for more exposure.

---

<div class="post-metadata">

**Author:** ![thusithaC](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/thusithac/32/5280_2.png) [@thusithaC](https://forum.rasa.com/u/thusithaC)\
**Post date:** [October 14, 2019, 12:33am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/5 "2019-10-14T00:33:51Z")

</div>

Hi @erohmensing Any updates or workarounds on the issue? I have switched to rasa 1.3.x an having trouble getting rasa-x working because of this bug. Is there a way to force rasa 1.3.x with an older version of rasa-x? whenever i try to pip install rasa-x \< 0.21.0, rasa automatically downgrades.

---

<div class="post-metadata">

**Author:** ![Andre1](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Andre1](https://forum.rasa.com/u/Andre1)\
**Post date:** [November 12, 2019, 12:44pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/6 "2019-11-12T12:44:15Z")

</div>

@erohmensing Any news on the problem? Can the buttons be simulated as text input? Example: /intent{“slot\_name”: “text\_value”

---

<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:** [November 12, 2019, 4:30pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/7 "2019-11-12T16:30:43Z")

</div>

@Andre1 I just tried on the latest version and the buttons seem to work fine. So i would try upgrading. You can indeed simulate the buttons as text as you’ve said, though it should be noted that that format is for entity names, not slot names (if you ahve a slot of the same name as an entity, the default is to autofill that slot, though)

---

<div class="post-metadata">

**Author:** ![Andre1](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Andre1](https://forum.rasa.com/u/Andre1)\
**Post date:** [November 12, 2019, 8:28pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/8 "2019-11-12T20:28:16Z")

</div>

@erohmensing you’re absolutely right. But now the buttons are all pressed into one line. Is it possible to split the buttons into several lines?

 ![Screenshot_2019-11-12%20Rasa%20X](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/658bfa87c09d8e0bc23f1288df299a8c557e06c1.png)

---

<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:** [November 13, 2019, 9:14am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/9 "2019-11-13T09:14:55Z")

</div>

Good point, we’re working on a fix for this (somehow a regression got introduced): [Buttons rasa x 0.22](http://forum.rasa.com/t/buttons-rasa-x-0-22/21016)

do they also appear in one line in Talk to your bot?

---

<div class="post-metadata">

**Author:** ![Andre1](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Andre1](https://forum.rasa.com/u/Andre1)\
**Post date:** [November 13, 2019, 11:50am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/10 "2019-11-13T11:50:20Z")

</div>

@erohmensing Thanks for your work. Yes, unfortunately that’s the way it is. ![Screenshot_2019-11-13%20Rasa%20X](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/a/a926986a3611eb1dfe244a16d52929d790b7b8a8.png)

---

<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:** [November 13, 2019, 4:31pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/11 "2019-11-13T16:31:27Z")

</div>

Ok thank you for the report!

---

<div class="post-metadata">

**Author:** ![ravikrcs](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ravikrcs/32/10301_2.png) [@ravikrcs](https://forum.rasa.com/u/ravikrcs)\
**Post date:** [November 27, 2019, 7:47am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/12 "2019-11-27T07:47:32Z")

</div>

upgrade rasa x to 0.23, its working i.e, now buttons are in several lines

---

<div class="post-metadata">

**Author:** ![touqeer](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@touqeer](https://forum.rasa.com/u/touqeer)\
**Post date:** [July 9, 2020, 11:29am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/13 "2020-07-09T11:29:47Z")

</div>

Is there any way to add next line between 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:** [July 9, 2020, 2:41pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/14 "2020-07-09T14:41:55Z")

</div>

@touqeer in Rasa X there is not. In any other channels, it depends on your channel.

---

<div class="post-metadata">

**Author:** ![touqeer](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@touqeer](https://forum.rasa.com/u/touqeer)\
**Post date:** [July 9, 2020, 3:08pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/15 "2020-07-09T15:08:28Z")

</div>

What you mean by channel? my User case is follow: text: | Welcome message

```
buttons:
  - title: Register a Complaint
    payload: >/complaint_registration
    type: postback
    index: 1
<I want to add next line here> 

  - title: Check Complaint Status
    payload: >-
      /complaint_registration
    type: postback
    index: 2
  - title: Default
    payload: /greet
    type: postback
    index: -1
```

---

<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:** [July 9, 2020, 3:25pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/16 "2020-07-09T15:25:01Z")

</div>

The channel is where the user talks to the bot. Examples include shell (your console), facebook, telegram, slack, share your bot in rasa x, etc.

---

<div class="post-metadata">

**Author:** ![touqeer](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@touqeer](https://forum.rasa.com/u/touqeer)\
**Post date:** [July 10, 2020, 4:52am UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/17 "2020-07-10T04:52:18Z")

</div>

We are using Whatsapp

---

<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:** [July 21, 2020, 3:26pm UTC](https://forum.rasa.com/t/rasa-x-buttons/17270/18 "2020-07-21T15:26:53Z")

</div>

You would have to check the [WhatsApp API](https://developers.facebook.com/docs/whatsapp/api/messages) for a parameter like that. On first look, I can’t even find how buttons are sent, though.
