我想将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);
})
},
]);
答案 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