简体   繁体   中英

bot framework remove cardaction

I am using Bot Framework (Version 3.0, ASP.NET Bot Framework template) for one of my chatbot and using HeroCard & CardAction to get user's feedback. I have below issues:

  1. CardAction translated into inline keyboard on Telegram channel. That works fine and remain available to user to act mutiple time in chat area. How can I remove buttons from chat area once user has taken action using that button?

  2. Can I translate CardAction into reply keyboard (reply_markup) rather than inline markup?

  3. CardAction are working fine with Telegram but not working in Skype. Skype is showing them as external media.

The Bot Framework doesn't directly support Telegram's reply keyboard feature, but you can still send it via the message's channelData field. ChannelData is for sending channel-specific messages that aren't directly surfaced in the Bot Framework. In BotBuilder/NodeJS, this field is set using the message.sourceEvent method:

Example (untested):

var msg = new builder.Message(session);
msg.sourceEvent({
    telegram: {
        method: "sendMessage",
        parameters: {
            text: "This is a reply keyboard",
            parse_mode: "Markdown",
            reply_markup: JSON.stringify({
                "keyboard": [
                    [{ text: "1" }, { text: "2" }, { text: "3" }],
                    [{ text: "4" }, { text: "5" }, { text: "6" }],
                    [{ text: "7" }, { text: "8" }, { text: "9" }],
                    [{ text: "*" }, { text: "0" }, { text: "#" }]
                ]
            })
        }
    }
});
session.send(msg);

channelData field documentation: https://docs.botframework.com/en-us/csharp/builder/sdkreference/channels.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM