EvotecIT / PSTeams

PSTeams is a PowerShell Module working on Windows / Linux and Mac. It allows sending notifications to Microsoft Teams via WebHook Notifications. It's pretty flexible and provides a bunch of options. Initially, it only supported one sort of Team Cards but since version 2.X.X it supports Adaptive Cards, Hero Cards, List Cards, and Thumbnail Cards. All those new cards have their own cmdlets and the old version of creating Teams Cards stays as-is for compatibility reasons.
MIT License
409 stars 41 forks source link

New-AdaptiveCard post links don't copy correctly #57

Closed AndyAtSaxComputeLtd closed 5 months ago

AndyAtSaxComputeLtd commented 6 months ago

After posting a card, successfully, we have found 2 issues.

Issues 1. copying the link and pasting into email, teams message of RTF doc gives text [DevOps: Card - access it on https://go.skype.com/cards.unsupported. Card] (http://somewebsite.com) - NB the link works despite ugly text.

After research I used the returnJson option and added summary field fixed this somewhat but now what ever you put in the summary is repeated like this: DevOps: hellohello when summary was "hello"

I exported the Json:-

{
  "type": "message",
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.adaptive",
      "content": {
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.2",
        "body": [
          {
            "type": "Container",
            "items": [
              {
                "type": "ColumnSet",
                "columns": [
                  {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "**MyApp Release**",
                        "size": "Large",
                        "weight": "Bolder",
                        "highlight": "False",
                        "italic": "False",
                        "strikeThrough": "False"
                      }
                    ]
                  }
                ]
              },
              {
                "type": "Container",
                "items": [
                  {
                    "type": "ColumnSet",
                    "columns": [
                      {
                        "type": "Column",
                        "width": "stretch",
                        "items": [
                          {
                            "type": "TextBlock",
                            "text": "Has been deployed to static MYLAPTOP",
                            "size": "Large",
                            "highlight": "False",
                            "italic": "False",
                            "strikeThrough": "False",
                            "wrap": true
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "type": "FactSet",
                "spacing": "Large",
                "facts": [
                  {
                    "title": "50549",
                    "value": "[SomeText](https://www.somewebite.com)"
                  }
                ]
              }
            ],
            "style": "Emphasis",
            "bleed": true
          }
        ],
        "msteams": {
          "width": "Full"
        }
      }
    }
  ],
  "summary": "Hello"
}
PrzemyslawKlys commented 6 months ago

From what I see if you copy:

image

It will give you error as you describe it, if you select just this:

image

It will copy it correctly to outlook, the content and nothing else.

I am not sure this is fixable because it acts the same when you copy paste it into Notepad. It also acts the same if you click on three dots and do Copy Link and paste it into Outlook. It seems to be trying to use Adaptive Cards in Outlook. Outlook as far as I know supports adapctive cards in it's own way

But the contentType is different:

{
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "TextBlock",
      "text": "Visit the Outlook Dev Portal",
      "size": "large"
    },
    {
        "type": "TextBlock",
        "text": "Click **Learn More** to learn more about Actionable Messages!"
    },
    {
      "type": "Input.Text",
      "id": "feedbackText",
      "placeholder": "Let us know what you think about Actionable Messages"
    }
  ],
  "actions": [
    {
      "type": "Action.Http",
      "title": "Send Feedback",
      "method": "POST",
      "url": "https://...",
      "body": "{{feedbackText.value}}"
    },
    {
      "type": "Action.OpenUrl",
      "title": "Learn More",
      "url": "https://learn.microsoft.com/outlook/actionable-messages"
    }
  ]
}

So delivery mechanism changes and most likely due to the Type "Message" it's getting treated that way.

AndyAtSaxComputeLtd commented 6 months ago

the JSON I supplied cam from your tooling though. I will try the JSON you supplied