botbuilder是否支持Facebook Messenger的按钮模板?

问题描述 投票:0回答:1

在阅读了这个问题之后,它已经很老了:Does the Bot Framework support Facebook Messenger's Button Template?,然后查看list of available cards using Bot Framework

botbuilder当前支持Facebook Messenger's Button Template吗?我希望该解决方案与频道无关,因此不需要JSON即可实现此目的。我尝试使用没有标题且没有图像的英雄卡,但结果在美学上并不令人满意,并且普通文本保持为粗体。

enter image description here

这是渲染卡片的代码:

const attachment = CardFactory.heroCard(
        "",
        "BotFramework Hero Card",
        CardFactory.images([]),
        CardFactory.actions([
            {
                type: "openUrl",
                title: "Get started",
                value: "https://docs.microsoft.com/en-us/azure/bot-service/"
            },
            {   
                type: "openUrl",
                title: "Get started2",
                value: "https://docs.microsoft.com/en-us/azure/bot-service/"
            }
        ])
    );

    return MessageFactory.attachment(attachment);

也尝试使用ThumbnailCard,但显示相同的结果...

javascript botframework facebook-messenger-bot
1个回答
0
投票
reply = { 'type': ActivityTypes.Message, 'channelData': { 'attachment': { 'type': 'template', 'payload': { 'template_type': 'button', 'text': 'Button Template', 'buttons': buttons } } } };

请注意,虽然您的问题的答案是肯定的,但您可能仍不满意。您只要求使用按钮模板而不是通用模板的方法,但是您的理由是希望它看起来更好。问题在于外观将取决于您使用的是哪个Messenger客户端,在某些客户端中,此按钮模板的外观与通用模板没有什么不同。如果尝试按钮模板,但仍然不满意,则可能需要做一些试验。我认为最快的测试方法是使用Bot Framework REST API在诸如Postman之类的HTTP应用程序中以您的机器人身份发送消息。

© www.soinside.com 2019 - 2024. All rights reserved.