【问题标题】:Bot Dialog Action button issue node.js机器人对话框操作按钮问题 node.js
【发布时间】:2020-05-08 00:26:56
【问题描述】:

我正在尝试使用 Internet 上的一些示例通过 Microsoft Bot Framework 为 MS Teams 创建机器人。

我创建了带有“查看报告”按钮的用户卡

function userCard(session, connector, name, workingStatus, TeamsID) {

    var card = new builder.HeroCard(session)
        .title(name)
        .subtitle(workingStatus.toString())
        .buttons([
            builder.CardAction.dialogAction(session, 'userReport', TeamsID, 'See Report')
        ]);
    return card;
}

卡显示没有任何问题。当我按下按钮时,它应该会触发新对话框

//Begins the userReport dialog if the button on the userCard is pressed
bot.beginDialogAction('userReport', '/userReport');

当我在 Bot Framework Emulator 中测试此功能时,它运行良好。 在 MS Teams 中,它不会触发 userReport 对话框,而是转到主对话框(发送消息时使用的对话框)。所以这个按钮根本不起作用。

请您告知应该调整/添加什么以使此按钮在 MS Teams 中工作?

提前致谢!

【问题讨论】:

    标签: dialog botframework chatbot


    【解决方案1】:

    谢天谢地,你才刚刚开始。看起来您正在使用严重过时的 Bot Framework V3。你绝对应该切换到V4

    Teams 有它自己的额外技巧。我建议尝试并梳理以下每个示例:

    然后通读Adaptive Cards blog post

    基本上,来自自适应卡的响应会在 activity.value 中返回,因此在 onTurn() 中,您需要使用 if 语句来查看 activity.value 以获取自适应卡中发送的值,当用户点击“查看报告”。然后,根据需要使用beginDialogdialog.run() 开始您的对话。

    【讨论】:

    • @StandardUser 很高兴听到!我总是推荐 V4 而不是 V3,但我很高兴你刚刚开始;为您减少工作量!
    猜你喜欢
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 2012-07-06
    • 2022-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    相关资源
    最近更新 更多