waigel / node-ms-teams-webhook

Microsoft Teams webhook
https://adaptive-card.waigel.com
MIT License
2 stars 2 forks source link

MS Teams is retiring webhooks #33

Open adrukh opened 1 month ago

adrukh commented 1 month ago

According to this article, MS are retiring webhook connectors in 2024. Specifically, new integrations won't be possible after August 15th, and existing webhooks will stop working after October 1st. EDIT: existing webhooks will work until Dec 31st 2024. There is also an option to extend the deprecation until the end of 2025 by updating the webhook URL. See the article for more details.

The article calls out PowerAutomate Workflows as the suggested solution.

Question - is there any JS client support for PowerAutomate Workflows? I think all users of this webhook client would be interested to ease with the migration.

waigel commented 1 month ago

Thanks for the heads up. The deadline is quite ambitious, especially with many developers on holiday. This feature moving to a Premium function is classic Microsoft.

Given the download stats of this lib, we should communicate the best way to migrate to PowerAutomate and update this lib to support PowerAutomate workflows. This evening, I will review what I need to do to continue sending messages and cards to the teams.

adrukh commented 1 month ago

Kindly pinging about this :)

adrukh commented 1 month ago

In the meantime, I'll post my migration steps as I added the necessary support for my app. I used the occasion to switch from MessageCards to ActionCards posted by my app, don't think that this is a must. Please note that your AI companion can easily transform one JSON format into another to help you through this.

Before the migration, code using the amazing ms-teams-webhook client:

const MSTeamsWebhook = require('ms-teams-webhook')
const webhookClient = new MSTeamsWebhook(webhookUrl)
await webhookClient.send({
        '@type': 'MessageCard',
        '@context': 'https://schema.org/extensions',
        summary: 'Lorem Ipsum',
        sections: [
          {
            startGroup: true,
            activityImage: someIconUrl,
            activityTitle: 'Hooray, it works!',
            activitySubtitle: welcomeMessage
          }
        ]
      })

After the migration, using got, a plain HTTP client:

      await got.post({
        url: powerAutomateWorkflowsURL,
        json: {
          type: 'message',
          attachments: [
            {
              contentType: 'application/vnd.microsoft.card.adaptive',
              content: {
                $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
                type: 'AdaptiveCard',
                version: '1.3',
                body: [
                  ...
                ]
              }
            }
          ]
        }
      })

You can use https://adaptivecards.io/designer/ to tweak the ActiveCard design to perfection, just note the encapsulating JSON object that you need to use as the request payload.

Good luck!

waigel commented 1 month ago

MessageCards are no longer supported, and there’s no straightforward migration path available. Furthermore, automating the creation of new workflows is not feasible, raising concerns about the current library’s utility. With 40k downloads in the last 8 days, this breaking change will have a significant impact on users. We need to strategize on how to prepare users for this transition.

Plan:

  1. Release Version 3.0.0 (Breaking Change) - End of Week

    • webhook.sendCard({schema}) with support from @microsoft/adaptivecards-tools -webhook.sendRawCard({schema}) from adaptivecards.io
    • webhook.sendText("plain text")
    • Add validation to ensure the use of the new power workflow URL
  2. Deprecate Versions < 3.0.0 (End of August)

    • Explain Microsoft’s breaking change in detail and provide a guide for updating the library. This gives developers time to adapt their systems and set up new power workflows, including acquiring necessary licenses.
  3. Codemon Migration Tool (End of August)

  4. Create Migration PRs (End of Year)

    • Identified 160 open-source repositories using this library. Automatically create issues with deprecated warnings, or, if Codemon proves effective, generate PRs with automatic migration.

@adrukh Can you provide more details how you migrated your workflow? Think that could be interesting for many

adrukh commented 1 month ago

@adrukh Can you provide more details how you migrated your workflow? Think that could be interesting for many

So I basically fed my MessageCard payload into chatGPT & Claude.ai, asking them to suggest the closest ActionCard payload. It worked well, I made some final touches directly in the designer. Some JavaScript <-> JSON conversions, again relying on the AI agents, and I was done!

waigel commented 1 month ago

Here is a pre-release version representing the v3 of the ms-teams-webhook (#34 ) Feel free to test and give feedback.

ms-teams-webhook v3.0.0 (PREVIEW): npm i https://pkg.pr.new/waigel/node-ms-teams-webhook/ms-teams-webhook@042eaf4

waigel commented 1 week ago

The first version of the messagecard converter is ready, please test it and give feedback here.

https://adaptive-card.waigel.com/

waigel commented 1 week ago

@adrukh Could you please test the converter to see if you obtain a similar optical result? Unfortunately, I don’t have the necessary “test data” to verify it myself.

adrukh commented 1 week ago

@waigel apologies, but I also lack the environment in which I can test the visual aspects by myself...