Skip to main content

Notifications

Community site session details

Community site session details

Session Id : RZw2BO8ZqiAMESb0C06BT/
Power Automate - General Discussion
Unanswered

Teams Workflow - Post to a channel when a webhook request is received is'nt working

Like (5) ShareShare
ReportReport
Posted on 9 Jul 2024 10:32:40 by 30

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.

Screenshot 2024-07-09 at 7.28.38 PM.png


However i keep facing the same problem that results in the flow to fail, this is the error i keep recieving

Screenshot 2024-07-09 at 7.30.06 PM.png

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!!

  • viciwuoha Profile Picture
    2 on 16 Jul 2024 at 15:53:01
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    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

    viciwuoha_0-1721144485599.png

    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

    viciwuoha_1-1721145136201.png


    Hope this helps. ??

  • Norrdec Profile Picture
    on 15 Jul 2024 at 14:09:44
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    Thank you, I was missing the top part of the json. 

  • gavinc Profile Picture
    31 on 15 Jul 2024 at 10:50:39
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    I had a meeting with Octopus, but thats been moved out to Wednesday

  • gavinc Profile Picture
    31 on 15 Jul 2024 at 10:49:46
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    202 is accepted, so will be a response from Teams hook

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202


    gavinc_0-1721040578918.png

     

  • RD01 Profile Picture
    7 on 15 Jul 2024 at 00:11:26
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    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.


    image.png

  • alexteo Profile Picture
    30 on 14 Jul 2024 at 07:13:18
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    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..

  • Richie Profile Picture
    2 on 14 Jul 2024 at 06:10:52
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    Thanks @gavinc It's sending the messages but why it is returning 202 as a response code in postman? does anyone know about it?

  • Fabioalxk Profile Picture
    4 on 12 Jul 2024 at 20:08:03
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    I Love you gavinc! It worked thanks!

  • cnemelka Profile Picture
    2 on 12 Jul 2024 at 19:11:25
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    What a mess.  Can't install new flows, old ones going away..

     

    I just want to post to a Teams channel....

     

  • RD01 Profile Picture
    7 on 12 Jul 2024 at 03:38:25
    Re: Teams Workflow - Post to a channel when a webhook request is received is'nt working

    Hi @alexteo the post say that it is solved and there is a solution, but the link posted by @Doriima does not have any details yet of the actual fix. Is there a different post where the solution is proposed, can someone please share?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,530 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,908 Most Valuable Professional

Leaderboard
Loading started