0

I have a logic app setup following these directions to push it to a Teams Channel. When the alert is notified it sends a message to my Teams channel successfully. However the objects are not parsing out like the example. I tried 2 things.

  1. Copying step 4 (of the above documentation) into the sample payload to generate the schema.
  2. After the Alert is triggered going into the Logic App run history and grabbing the raw outputs, copying those into the sample payload to generate the schema.
  3. Used Common Alert Schema definitions for the payload and things still come in blank in Teams.

Neither of these options filled out the notification that was pushed to the teams channel. I copied the raw outputs. Put them into PostMan. Sent the request to the endpoint. This worked when parsing the data into the message posted into the teams channel.

It's a simple logic app that is using the designer options: "When an HTTP request is received" for the payload. "Post a message with the flow bot to a channel" to post messages to a team channel.

What JSON payload or options should I be using for the ability to use a Logic App to push to a Teams Channel successfully?

Justin Neff
  • 182
  • 3
  • 17
  • When checking the raw output of the http trigger, do you see the values of the different fields populated? Did you try triggering the Logic app from postman with the JSON body in [link](https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/action-groups-logic-app#create-a-service-health-alert) ? Could you post the raw inputs and outputs of each step? And also what exactly was received on Microsoft teams. That may help the community recheck on their side. – Anupam Chand Apr 17 '21 at 07:54

1 Answers1

1

I test it in my side, it works fine and I can reproduce your problem.

First I configure the alert to trigger the logic app, then go to "Runs history" of the logic app and find the outputs of the trigger(you mentioned you copied the raw into sample payload to generate the schema), copy the outputs body of raw but not all of the json content of raw (shown as below two screenshot)

enter image description here

enter image description here

After generate the schema, please select all of the parsed fields again because the expressions of the parsed fields which you selected before may not match the properties now (although it may not show error when you save the logic app if you don't select them again). Below screenshot is what I test, I selected all of the parsed fields again, then the logic app was executed as expected.

enter image description here

Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • Thanks for the help. I grabbed only the context JSON object like you suggested to parse payload for generating the schema. Then on the following step I created selected my fields for the output step. Still having issues with those values not populating on the Notification in Microsoft Teams. When parsing with PostMan this does not generate the correct text in Teams, it is blank. When using the whole payload and PostMan the entire message DOES get displayed in teams. Do I need to initialize them in to variables like you have displayed? – Justin Neff Apr 19 '21 at 14:31
  • @JustinNeff No, you do not need to initialize them to variables. I use variables just for test. But you can also use a variable and select some fields into the variable value for test. – Hury Shen Apr 19 '21 at 14:37
  • it looks like the part of the raw output to select was the entire Body object, not the context which is within the body. So I followed your suggestion but 2 object layers higher. I was selected also the headers which would parse the incorrect payload schema with those copied in. That was it, that got the data through to the Teams Notification! If you want to edit your answer go ahead. – Justin Neff Apr 19 '21 at 14:43