MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
285 stars 506 forks source link

Incoming webhook - Send messages using cURL and PowerShell does not work with Workflow connector #11302

Open jentrup346734 opened 3 months ago

jentrup346734 commented 3 months ago

Steps to reproduce

This page https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=PowerShell%2Ctext1#send-messages-using-curl-and-powershell

PowerShell section suggests using this code to post message using webhook suggested by Microsoft to replace incoming webhook connector. Workflow template called "Post to a channel when a webhook request is received"

Expected behavior

Execute below with appropriate URI Invoke-RestMethod -Method post -ContentType 'Application/Json' -Body '{"text":"Hello World!"}' -Uri

Expected to post "Hello World!" in channel

Actual behavior

Power Automate flow fails with error

Error details

Action 'Send_each_adaptive_card' failed: The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.

microsoft-github-policy-service[bot] commented 3 months ago

Hi jentrup346734! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

Meghana-MSFT commented 3 months ago

Thank you for reporting this, we will check this and get back to you.

vivekk0903 commented 3 months ago

@jentrup346734 Looks like the json format you are using is for old connector format. Since you are using a workflow you should be following the json format for the adative cards : just below the curl / powershell section, here.

The "Send_each_adaptive_card" of the workflow requires the "attachments" parts filled as an adaptive card, which is not present in your original json and hence the error.

jentrup346734 commented 3 months ago

@vivekk0903 Yes that is accurate, however we still need the documentation updated as the documentation is incorrect when using the new workflows.

Meghana-MSFT commented 2 months ago

@jentrup346734 - We have shared the feedback with engineering team to update the documentation with examples for workflows.