在主动机器人中重复心肌反应

时间:2017-05-12 21:29:28

标签: node.js azure botframework azure-functions

我想将api响应显示为卡片,但响应重复 - 我做错了什么,这是英雄卡的有效用途吗?

bot.dialog('/receipt', [
    function(session){
        bot.on('trigger', function (message) {
        var queuedMessage = message.value;
        var msg = new builder.Message()
             .address(queuedMessage.address)
             .attachments([
                new builder.HeroCard(session)
                    .title("Good news - I can book this for you:")
                    .subtitle("Customer: " + queuedMessage.name)
                    .images([
                        builder.CardImage.create(session, "")
                    ])
                    .buttons([
                        builder.CardAction.dialogAction(session, "bookIt", "", "Book it?"),
                        builder.CardAction.dialogAction(session, "help", "", "Start again?")
            ])
            ]);
            session.send(msg);
        })
    },  
]);

1 个答案:

答案 0 :(得分:0)

正如OmG在评论中所建议的:删除bot.on('trigger'

您似乎正在尝试设置Azure Function来触发机器人发送消息:https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview这不是必需的,以便主动向用户发送消息机器人。

有关主动发送邮件的文档,请参阅https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-proactive-messages。以下是node中的一些示例:https://github.com/MicrosoftDX/botFramework-proactiveMessages/tree/master/node