2

I'm using botframework with Node.js SDK version 4, and i'm try to send an HeroCard to Facebook Messanger.

If i send the card without all it works properly, but if i add some buttons i get a generic error in console that doesn't give me any information.

The error is the following : "[onTurnError]: Error: Facebook API error bot framework"

Doesn't work:

 await turnContext.sendActivity({attachments: [CardFactory.heroCard("Lorem Ipsum 1","https://mysite/myimg.jpg", ["buy","view"]);, CardFactory.heroCard("Lorem Ipsum 2","https://mysite/myimg.jpg", ["action1","action2"]);], attachmentLayout: "carousel", text:"asd"}); 

Work without errors:

await turnContext.sendActivity({attachments: [CardFactory.heroCard("Lorem Ipsum 1","https://mysite/myimg.jpg", []);, CardFactory.heroCard("Lorem Ipsum 2","https://mysite/myimg.jpg", []);], attachmentLayout: "carousel", text:"asd"}); 

Thanks, Lorenzo

JBerta93
  • 699
  • 3
  • 16
  • 27

1 Answers1

1

It looks like you are not providing the correct parameters for the card action. At least in the code you posted you are just adding a string instead of an actual card action.

Try something like this:

CardFactory.heroCard(
            'BotFramework Hero Card',
            CardFactory.images(['https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg']),
            CardFactory.actions([
                {
                    type: 'openUrl',
                    title: 'Get started',
                    value: 'https://learn.microsoft.com/en-us/azure/bot-service/'
                }
            ])
        );
D4RKCIDE
  • 3,439
  • 1
  • 18
  • 34