playwright-community / playwright-msteams-reporter

Microsoft Teams reporter for Playwright
https://www.npmjs.com/package/playwright-msteams-reporter
MIT License
10 stars 4 forks source link

AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard' #1

Closed miguelc1221 closed 4 months ago

miguelc1221 commented 4 months ago

Tried using this lib but keep running into the following exception when making the request, any ideas?

Currently only passing webhook url

AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard'

estruyf commented 4 months ago

Thanks, @miguelc1221, for giving it a try! The type is correctly set to AdaptiveCard, so it's weird that it is returning that error in your environment. Something may be wrong with the card data itself.

I just released version 0.0.3, where you can set the debug property on the reporter to true. Once you enable the debug mode, it will pass the card to the console. Would you be able to pass me this card JSON so I can validate it on my end?

miguelc1221 commented 4 months ago

@estruyf I'll post it when I have some time but also want to add, I think it may be something wrong with the webhook endpoint because i forked playwright-msteams-reporter in order to debug and I would get the same error response even when using the following payload from https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL%2Ctext1, the messageCard example works fine though.


{
       "type":"message",
       "attachments":[
          {
             "contentType":"application/vnd.microsoft.card.adaptive",
             "contentUrl":null,
             "content":{
                "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
                "type":"AdaptiveCard",
                "version":"1.2",
                "body":[
                    {
                    "type": "TextBlock",
                    "text": "For Samples and Templates, see [https://adaptivecards.io/samples](https://adaptivecards.io/samples)"
                    }
                ]
             }
          }
       ]
 }
estruyf commented 4 months ago

@miguelc1221 that's weird indeed. That body should indeed work. How was the webhook created?

miguelc1221 commented 4 months ago

I created the webhook following these docs https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cdotnet. Even though connectors will be deprecated next month https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/

It might be some settings in my orgs team not allowing this or something, i am not sure. I opened an issue to see if they can shine some light on what is happening. https://github.com/MicrosoftDocs/msteams-docs/issues/11222

Seems like the library is working correctly and just an issue on my end. Thanks for trying to look into it!

estruyf commented 4 months ago

Thanks for the update! In that case, I'll add the support for the Power Automate too.

estruyf commented 4 months ago

There are some minor differences, but not a lot has to be changed.

image
estruyf commented 4 months ago

I just updated the reporter. Support for Power Automate webhooks has been added to version 0.0.5.

estruyf commented 4 months ago

Hopefully, they will remove the footer from the card in the future.

https://powerusers.microsoft.com/t5/General-Power-Automate/Change-to-my-workflow-Cards-USER-NAME-used-a-Workflow-template/td-p/2821563

estruyf commented 4 months ago

Closing the issue as it is not a bug from the reporter.