Friday, 12 May 2017

duplicate herocard response in proactive bot

I want to display an api response as a card, but the response duplicates - what am I doing wrong, is this a valid use of for hero card?

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);
        })
    },  
]);



via singzzz

No comments:

Post a Comment