Search code examples
c#botframeworkfacebook-messenger-bot

Show normal buttons instead of radio buttons


I used a Hero Card to show some buttons but they have limitations as it concerns the text length. Now I am trying to use adaptive cards but I cannot manage to show normal buttons instead of radio buttons.

List<string> options= new List<string>();

fill the list and continue to create the card

AdaptiveCard ac = new AdaptiveCard()
{
    Body = new List<CardElement>()
    {
        new TextBlock()
        {
            Color = TextColor.Attention,
            Weight = TextWeight.Bolder,
            Size = TextSize.Medium,
            Text = "My title",
        },
        new ChoiceSet()
        {
            Id = "title",
            Style = ChoiceInputStyle.Expanded,
            IsRequired = false,
            IsMultiSelect = false,
            Value = "1",
            Choices = options.Select(item => new Choice { Title = item, Value = item }).ToList(),
        },
    },
};

As you can see I have a list of text values which I fill before the adaptive card. Then I created a TextBlock to show a title and after that the ChoiceSet to display the buttons. What am I doing wrong and the buttons keep appearing as radio buttons.


Solution

  • As per Kyle Delaney's comment Adaptive Cards are not supported on messenger yet. Although they offer more functionalities than other rich cards unfortunately they can't be used. I found a solution by sticking to Hero Cards and following a different flow whenever the text length of a button is bigger than the permitted one.