Hi with the recent news that
"Action Required: O365 connectors within Teams will be deprecated and notifications from this service will stop.Learn more about the timing and how the Workflows app provides a more flexible and secure experience. If you want to continue receiving these types of messages, you can use a workflow to post messages from a webhook request. Set up Workflow"
I was then trying to set up workflow as an alternative, it seems easy at first since Microsoft already has an inbuilt workflow just for webhooks.
However i keep facing the same problem that results in the flow to fail, this is the error i keep recieving
Its so weird that such a simple flow has problems running, and further more this is suppoedly the new solution so i dont know whats wrong, really seeking all helps and advice, thanks!!
Here is a sample JSON payload that works via a python requests.post method (You may need to change some things eg; True to true, remove trailing commas, etc.)
N/B : This works on Standard ,General & Private Channels
For private Channels, Use "Post As": User in your Power Automate Flow.
For Standard/Public Channels, use "Post As: Flow Bot", You would need to go to Manage Channel> Moderation, Turn It On and check the `Allow Bots to Submit Message Button`
{
"type": "adaptiveCard",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "Container",
"style": "attention",
"bleed": True,
"spacing": "None",
"items": [
{"type": "TextBlock", "text": "TEST After o365 deprecation V2 "}
],
},
{
"type": "Container",
"style": "emphasis",
"items": [
{"type": "TextBlock", "text": "**Pipeline Id:** Test Pipeline.backfill", "color": "attention"},
{"type": "TextBlock", "text": "_self.pipeline_id_ failed", "color": "attention"},
{"type": "TextBlock", "text": "**Task Id:** self.task_id"},
{"type": "TextBlock", "text": "**Execution Start Time:**"},
{"type": "TextBlock", "text": "self.execution_start_time"},
],
},
{
"type": "TextBlock",
"text": "This Error Has Been Resolved.",
"id": "Resolved",
"isVisible": False
},
{
"type": "TextBlock",
"text": "Pending Resolution.",
"id": "Unresolved",
"isVisible": False
}
],
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Mark as Resolved",
"targetElements": [ "Resolved"]
}
]
},
}
],
}
The post runs on Power Automate as shown below
The Post to the channel gets resolved to what is shown below (Note that step 3 just needs items()?['content'] ie; the content object of any number of Adaptive Card attachment contents in your payload );
{
"host": {
"connectionReferenceName": "shared_teams",
"operationId": "PostCardToConversation"
},
"parameters": {
"poster": "User",
"location": "Channel",
"body/recipient/groupId": "eb12xxxxxxxxx",
"body/recipient/channelId": "1x:bxxxxx@thread.tacv2",
"body/messageBody": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "Container",
"style": "attention",
"bleed": true,
"spacing": "None",
"items": [
{
"type": "TextBlock",
"text": "TEST After o365 deprecation V2 "
}
]
},
..............rest of paylod
Result
Hope this helps. ??
Thank you, I was missing the top part of the json.
I had a meeting with Octopus, but thats been moved out to Wednesday
202 is accepted, so will be a response from Teams hook
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202
I actually got this to work by changing the default flow that Power automate creates.
As the first step actually is successful and the flow is failing in the second step where the 'attachment is null',
I actually parsed the output from step 1 as JSON in step 2 and used it in the post to channel step. The I was able to use the variables as required.
Hope this helps someone.
Yes @RD01 technically the flow work Workflow or power automate isnt working as it should be yet, so i will removed 'Marked as Solution' for now to prevent confusion.
To clarify, @gavinc found a workaround you can see from the thread and try if it works for you, otherwise @Doriima has reached out to Octopus who is working on the problem, i believe we should see it fixed and we can use that flow before connectors expires on October. So for now i will re-open the problem as not solved until we have a definite way that works for everyone.
Gavin or Dorrima you can clarify if im not recounting accurately or so thanks..
Thanks @gavinc It's sending the messages but why it is returning 202 as a response code in postman? does anyone know about it?
I Love you gavinc! It worked thanks!
What a mess. Can't install new flows, old ones going away..
I just want to post to a Teams channel....
WarrenBelz
146,530
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,908
Most Valuable Professional