Alex Skiffin
Alex Skiffin

Reputation: 419

Telegram chat keyboard through bot framework

I try to show the keyboard chatting telegram using botframework, but the keyboard is not displayed. I tried send keybord like this:

        Activity reply = activity.CreateReply(message);
        var keyboard =new ReplyKeyboardMarkup
        {
            Keyboard = new[] { new[] { new KeyboardButton("Text1"), new KeyboardButton("text1") } }
        };
        reply.ChannelData = keyboard;
        await connector.Conversations.ReplyToActivityAsync(reply);

And many other ways. But keyboard does not show up.

What could be the reason? How to make it show up?

Upvotes: 3

Views: 655

Answers (1)

Lars
Lars

Reputation: 10573

You don't need to use ChannelData. Just send the buttons on a HeroCard:

        var card = new HeroCard("Some Text");
        card.Buttons = new List<CardAction>()
        {
                new CardAction()
                {
                    Title = "button1",
                    Type=ActionTypes.ImBack,
                    Value="button1"
                },
                new CardAction()
                {
                    Title = "button2",
                    Type=ActionTypes.ImBack,
                    Value="button2"
                }
        };

        var reply = activity.CreateReply("");
        reply.Attachments = new List<Attachment>();
        reply.Attachments.Add(new Attachment()
        {
            ContentType = HeroCard.ContentType,
            Content = card
        });
        return reply;

Upvotes: 3

Related Questions