# O365 Connectors retirement: how to keep your Teams Webhook alive

Microsoft switches off [O365 connectors in Teams](https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/). If you ever clicked on this:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720782467673/d60f11f8-4ab7-489b-a8c6-162eb5c471ca.png align="center")

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720782658337/80fb1f35-14de-4476-9e16-fe15ac20208d.png align="center")

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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720782916981/9a06992b-c83e-4bad-b29a-4778dcad2e49.jpeg align="center")

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720783594635/5307688b-7988-48d3-aa9a-4121dbee7fc3.png align="center")

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720783701651/e446396a-932c-450e-96c4-5c6e73f34ae6.png align="center")

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

Now you already get a workflow URL:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720783824054/334d7340-3872-4628-8528-98cc3209bab0.png align="center")

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:

```json
{
  "@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:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720785117014/d6beaf52-f0ac-44b2-bf2b-f9f134ccdce5.png align="center")

The result would look like this:

```json
{
  "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](https://learn.microsoft.com/en-us/connectors/teams/?tabs=text1#request-body-schema).

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

```json
{
    "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:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720785617126/c7018662-bd1d-4491-afdd-682960f473c4.png align="center")

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.
