botframework-sdk: builder.CardAction.dialogAction not working with carousel layout

Hi

I am using botbuilder 3.2.3 for node

I was trying to bind an action with button for a hero card with carousel layout, but it’s not able to trigger any action.

so I tried the sample https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/demo-skype/app.js from here, it is working if i use the same, but When I modify it by adding one more card and layout to carousel, it didn’t work, it’s working for “List” Layout !!!

` bot.dialog(‘/actions’, [ function (session) { session.send(“Bots can register global actions, like the ‘help’ & ‘goodbye’ actions, that can respond to user input at any time. You can even bind actions to buttons on a card.”);

    var msg = new builder.Message(session)
        .attachmentLayout(builder.AttachmentLayout.carousel)
        .textFormat(builder.TextFormat.xml)
        .addAttachment
        (
            new builder.HeroCard(session)
                .title("Hero Card")
                .subtitle("Space Needle")
                .text("The <b>Space Needle</b> is an observation tower in Seattle, Washington, a landmark of the Pacific Northwest, and an icon of Seattle.")
                .images([
                    builder.CardImage.create(session, "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Seattlenighttimequeenanne.jpg/320px-Seattlenighttimequeenanne.jpg")
                ])
                .buttons([
                    builder.CardAction.dialogAction(session, "weather", "Seattle, WA", "Current Weather")
                ])
        );


    msg.addAttachment (
            new builder.HeroCard(session)
                .title("Hero Card")
                .subtitle("Space Needle")
                .text("The <b>Space Needle</b> is an observation tower in Seattle, Washington, a landmark of the Pacific Northwest, and an icon of Seattle.")
                .images([
                    builder.CardImage.create(session, "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Seattlenighttimequeenanne.jpg/320px-Seattlenighttimequeenanne.jpg")
                ])
                .buttons([
                    builder.CardAction.dialogAction(session, "weather", "Seattle, WA", "Current Weather")
                ])
        );

    session.send(msg);
    session.endDialog("The 'Current Weather' button on the card above can be pressed at any time regardless of where the user is in the conversation with the bot. The bot can even show the weather after the conversation has ended.");
}

]); `

I am using msg.addAttachment as per my use case I need to add attachments inside one loop.

Am I doing anything wrong ?Can any one help me How to use this with carousel ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

@vaibhavi-joshi I just came across this issue after having the same issue. I realised I was missing the very last line from the demo-skype link you posted.

You need to include: bot.beginDialogAction('weather', '/weather'); // <-- no 'matches' option means this can only be triggered by a button.

This got the dialogAction buttons in my carousels working as expected.