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

问题描述:

Facebook Messenger的API支持称为的消息类型. 按钮模板" .这种卡类型允许发送带有文本的消息,然后发送具有不同操作的按钮列表,如下图所示(来自Facebook文档):

Facebook messenger's APIs support a message type called the "Button Template". This card type allows sending a message with text, then a list of buttons with different actions, as in the image below (from Facebook's documentation):

该模板类似于通用模板,它是由Bot Framework的Hero卡生成的,但是区别在于它不需要"Header"标签.在卡片上,这是通用模板所必需的.

This template similar to the Generic template, which is what is produced by the Bot Framework's Hero cards, but is distinct in that it does not require a "Header" on the card, which is required by the Generic template.

我试图弄清楚如何使用Bot Framework呈现此模板-通过使用基于Facebook文档中基于JSON创建的自定义模型填充MessageActivity.ChannelData,我们已将其在Facebook Messenger中使用,但这会导致消息无法出现在Bot Framework仿真器中.有什么方法可以使用Bot Framework的官方方法/类来呈现此模板?

I'm trying to figure out how to render this template using the Bot Framework -- we've gotten it to work in Facebook messenger by populating the MessageActivity.ChannelData with a custom model we created based on the JSON in Facebook's documentation, but this causes the message to fail to appear in the Bot Framework Emulator. Is there any way to render this template using official Bot Framework methods/classes?

简短答案:否.仿真器并非旨在通过这种方式测试特定于通道的功能.

Short answer: No. The Emulator is not designed to test channel-specific functionality in this way.

使用channelData存储自定义消息定义,您将在正确的轨道上.但是,正如您已经发现的那样,由于您要测试FB特定的功能,因此唯一的方法是直接在FB Messenger上进行测试.

You are on the right track using the channelData to store your custom message definition. But, as you already discovered, since you are wanting to test a FB-specific feature, the only way is to test on FB Messenger directly.