【问题标题】:Microsoft BotBuilder node.js : How to send formatted text (BOLD , Italic , New Line ) to Android Skype for business client from BotMicrosoft BotBuilder node.js:如何将格式化文本(BOLD、Italic、New Line)从 Bot 发送到 Android Skype for business 客户端
【发布时间】:2018-01-17 14:46:47
【问题描述】:

我们在 node js 中使用 Microsoft BotBuilder 实现了一个 Bot,以主动向 Skype for Business 用户发送消息。我们要求发送少量格式化文本,例如 - 粗体、斜体和换行符(新行),但 Android Skype for business 似乎不支持这些格式中的任何一种。所有 Html 格式在所有平台(iOS、Android 和 MAC)中都显示为原始 HTML。 到目前为止,我们已经尝试了以下方式来发送格式化文本。

//1 using \n\n
var msgToSend = new builder.Message()
                            .text("Hello \n\n World!");
//2 using unicodes
var msgToSend = new builder.Message()
                            .text("Hello \u0085 \u2028 World!");
//using html formatting
var msgToSend = new builder.Message()
                            .text("Hello </br> World!");


bot.loadSession(addr1, function (err, session) {
    bot.send(msgToSend);
});

我们成功地将换行文本发送到 Mac、iOS 和 Windows Skype for Business 客户端,但这些似乎都不适用于 Android。 将格式化的文本发送到 android 将不胜感激。

【问题讨论】:

    标签: node.js botframework skype-for-business


    【解决方案1】:

    正如已在围绕同一主题的问题(关于网络聊天和呈现 HTML)中回答的那样:

    Microsoft Bot Framework 仅支持 2 种类型的文本格式(请参阅文档 here):

    • 降价
    • XML(只有 Skype 频道支持 textFormat xml。)

    因此:

    • HTML 在这里帮不了你
    • 您受限于 Markdown 的功能以及您的频道中 Markdown 渲染的限制

    如果您在Channel Inspector 中查看Skype for Business 的降价,则无法执行您想要的操作(粗体、斜体等未按预期呈现),抱歉

    【讨论】:

    • 是的,你是对的。 Microsoft Bot Framework 仅支持 2 种类型的文本格式。但是有一些 unicode 至少适用于 new line 。像 - \u0085 、 \u2028 、 \u2029 这些 un​​icode 可以在 Windows、MAc 和 iOS 上运行,但不能在 Android 上运行。
    • 我想知道是否有适用于所有这些平台的 unicode。
    • 我不知道。你试过回车(\u000D)吗?
    • 是的,但没有帮助:(
    • " \n \n" :- 两个空格 + \n + 空格。这对我有用!
    猜你喜欢
    • 2017-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多