microsoft-teamswebhookspower-automate

Microsoft Teams: How can I forward all messages sent to an Incoming Webhook to a Group Chat?


Given:

Question:

Power Automate Workflow


Solution

  • You should use Power Automate. Teams Connectors are being retired in the next few weeks: https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/

    Here is a working Webhook sent from PowerShell. My application only supports top level JSON keys, so I am using the "text" key:

    $WebhookUri = "https://prod-157.westus.logic.azure.com:443/workflows/..."
    
    
    $adaptiveCardJson = @"
    { "type": "messagecard",
      "text": "Test 9" ,}          
    "@
    Invoke-RestMethod -Method POST $WebhookUri -Body $adaptiveCardJson -ContentType 'application/json'
    

    Here is the Power Automate flow. You would change the "Post in" to "Group Chat".

    Power Automate Flow