Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
sarcastasaur
New Member

Failing to send messages to Teams channel via Teams webhook

I am trying to follow the example from this page about sending a post request to a Teams webhook, and then I want to send a portion of that text to a Teams channel. The code and workflow I am using is below.

 

https://learn.microsoft.com/en-us/connectors/teams/?tabs=text1%2Cdotnet#microsoft-teams-webhook

const formatted_Card_Payload = {
  "method": "POST",
  "type":"message",
  "attachments":[{
    "contentType": "application/vnd.microsoft.card.adaptive",
    "contentUrl": null,
    "content":{
      "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
      "type":"AdaptiveCard",
      "version":"1.2",
      "body":[{
	"type": "TextBlock",
	"text": "does this work?"
      }
    ]
  }
}
	]
}

fetch(TEAMS_WEBHOOK_URL, formatted_Card_Payload)

 

I keep getting the error below, and I am not sure how to resolve it.Screenshot 2025-03-18 170252.pngScreenshot 2025-03-18 165246.png

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

 

I have been stumped on this issue all week, and I'm sure the fix is something super obvious

1 REPLY 1
lbendlin
Super User
Super User

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.