如何使用 Microsoft Bot Framework 处理丰富的内容?

How do I deal with rich content with the Microsoft Bot Framework?

我不确定如何处理丰富的内容。我想要 return 的一些示例是超链接列表或 a/some 图像缩略图。我该怎么做呢?我尝试将我的文本格式化为 HTML,这导致 Bot Emulator 崩溃并导致 Web Chat 客户端仅显示编码的 HTML.

这个或一些解释这个的文档有秘密吗?

降价。 Bot Framework 将 Markdown 转换为每个渠道的丰富原生格式。

一些频道通过 ChannelData 字段支持更丰富的内容(例如,您可以通过我们在 ChannelData 字段中的 Slack 频道发送 Slack 卡片)但是如果您发送 Markdown,我们所有的频道都会为该频道做正确的事情。

编辑:此处的文档:http://docs.botframework.com/connector/message-content/#the-text-property-is-markdown

您可能会发现 github 的 link 有帮助:

https://guides.github.com/features/mastering-markdown/

Style               Markdown    Description Example
Bold                **text**    make the text bold  
Italic              *text*      make the text italic    
Header1-5           # H1        Mark a line as a header 
Strikethrough       ~~text~~    make the text strikethrough 
Hr                  ---         insert a horizontal rule    
Unordered list      *           Make an unordered list item 
Ordered list        1.          Make an ordered list item starting at 1 
Pre                 `text`      Preformatted text(can be inline)    
Block quote         > text      quote a section of text 

link               [bing](http://bing.com)  
image link         ![duck](http://aka.ms/Fo983c)    

请注意,渠道会因支持的降价子集而有所不同。

https://docs.botframework.com/en-us/core-concepts/channeldata 示例附件 https://api.slack.com/docs/message-attachments 您必须在下面的代码中更改源和扭曲附件。 我能够在 slack 中处理丰富的文档 使用 Microsoft bot framework 参考这个内容丰富的松弛示例

enter code here
bot.dialog('/', function (session) {

    session.send('Looking into your upcoming flights to see if you check-in on any of those...');
    var card =  {
  slack: {
    "attachments": [
        {
            "fallback": "Required plain-text summary of the attachment.",
            "color": "#36a64f",
            "pretext": "Optional text that appears above the attachment block",
            "author_name": "Bobby Tables",
            "author_link": "http://flickr.com/bobby/",
            "author_icon": "http://flickr.com/icons/bobby.jpg",
            "title": "Slack API Documentation",
            "title_link": "https://api.slack.com/",
            "text": "Optional text that appears within the attachment",
            "fields": [
                {
                    "title": "Priority",
                    "value": "High",
                    "short": false
                }
            ],
            "image_url": "http://my-website.com/path/to/image.jpg",
            "thumb_url": "http://example.com/path/to/thumb.png",
            "footer": "Slack API",
            "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
            "ts": 123456789
        }
    ]
}
}
var msg = new builder.Message(session).sourceEvent(card);
session.send(msg);
});

您可能会发现此线程对一些示例很有用,是的,MD 就是答案。

https://github.com/microsoft/BotFramework-WebChat/issues/2289

所以说如果你想做一个无序列表。

Unordered list\r\n\r\n* An item\r\n* Another item\r\n* Yet another item\r\n* And there\'s more...\r\n\r\n

无序列表

  • 一项
  • 另一项
  • 还有更多...