O365 Connectors retirement: how to keep your Teams Webhook alive

How to change the legacy O365 Teams Webhook for a Teams Workflow Webhook

Microsoft switches off O365 connectors in Teams. If you ever clicked on this:

you are going to be affected. They give you this little banner to tell you that the message that is attached to the banner won't be working after 1.10.2024

Unfortunately, the "Set up Workflow" Button does not create a working Workflow. Furthermore, besides changing the webhook URL, you propably have to change the JSON that is sent to the webhook.

Here is how to do it.

In Teams, click on the 3 little dots next to the channel that houses your old webhook and click "Workflows"

In the appearing window, search for webhook, and select the "Post to a channel when a webhook request is received" Templatee

Make sure to give a name and configure the connection correctly, click Next and "Add workflow".

Now you already get a workflow URL:

Now it would be nice if this was already all the work, wouldn't it?

Unfortunately, the new Workflow Webhook and the old Webhook Webhook do not work with the same JSON templates. Your legacy JSON might look like this:

{
  "@type": "MessageCard",
  "@context": "https://schema.org/extensions",
  "themeColor": "FFA500",
  "title": " **My Title**",
  "text": "My Text",
  "potentialAction": [
    {
      "@type": "OpenUri",
      "name": "Open URL 1",
      "targets": [
        {
          "os": "default",
          "uri": "Some url"
        }
      ]
    },
    {
      "@type": "OpenUri",
      "name": "Open URL 2",
      "targets": [
        {
          "os": "default",
          "uri": "Some url 2"
        }
      ]
    }
  ]
}

Now here comes the nice post-AI-era part: just ask your favorite LLM to transform the JSON for you:

The result would look like this:

{
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "My Title",
      "wrap": true
    },
    {
      "type": "TextBlock",
      "text": "My Text",
      "wrap": true
    }
  ],
  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "Open URL 1",
      "url": "Some url"
    },
    {
      "type": "Action.OpenUrl",
      "title": "Open URL 2",
      "url": "Some url 2"
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.2"
}

We are almost done. Now one last thing: the connector expects an array of adaptive cards, propably for compatibility reasons to Teams bots. You can read about that here.

This is the complete JSON, with root.attachments[0].content containing the actual transformed adaptive card.

{
    "type": "message",
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.card.adaptive",
            "contentUrl": null,
            "content": {
                "type": "AdaptiveCard",
                "body": [
                    {
                        "type": "TextBlock",
                        "size": "Medium",
                        "weight": "Bolder",
                        "text": "My Title",
                        "wrap": true
                    },
                    {
                        "type": "TextBlock",
                        "text": "My Text",
                        "wrap": true
                    }
                ],
                "actions": [
                    {
                        "type": "Action.OpenUrl",
                        "title": "Open URL 1",
                        "url": "Some url"
                    },
                    {
                        "type": "Action.OpenUrl",
                        "title": "Open URL 2",
                        "url": "Some url 2"
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                "version": "1.2"
            }
        }
    ]
}

Posting this to the Endpoint url you got earlier results in an Adaptive card being posted:

Some downsides to the old o365 webhook approach:

  1. More steps are involved to get a working webhook

  2. The JSON is more complex

  3. It costs money

  4. You can not use a custom icon or title, as you have to select a user account to post

Some upsides:

  1. havent found any yet

So that concludes the transformation from O365 Connector Webhooks to Workflow Webhooks. I will update this post as more relevant information become available.

Did you find this article valuable?

Support Jens Caasen Cloud Blog by becoming a sponsor. Any amount is appreciated!