'Microsoft Teams HttpPost Action print http return status

We want to know what is the best way to do :

  1. an alert is sent to the MS teams channel, the alert contains "Approve" and "Deny"
  2. Both "Approve" or "Deny" has "HttpPost" to send the POST to target URL
  3. After clicking "Approve" or "Deny", how do we get the http status and print the comment "Approved" if http status is "200" ?
  4. After clicking either approve or deny, how do we print the comment with whoever clicked(for example logged in user) so that others will know.

This is below payload :

 {
   "@type":"MessageCard",
   "@context":"http://schema.org/extensions",
   "themeColor":"0076D7",
   "text":"### Build [($BUILD_NUMBER)]($CONSOLE_LINK) of [($BUILD_LINK)]($BUILD_URL) failed on [($BM_NAME)]($JENKINS_URL)",
   "potentialAction":[
      {
         "@type":"HttpPost",
         "name":"Approve",
         "body": "verification.approve",
         "target":"https://docs.microsoft.com/outlook/actionable-messages"
      },
      {
         "@type": "OpenUri",
        "name": "Deny",
        "targets": [{
            "os": "default",
            "uri": "https://docs.microsoft.com/outlook/actionable-messages"

        }]
      }
   ],
}


Solution 1:[1]

You need to implement a Bot or Client App and then while calling the Webhook Http/Https URL, you need to capture the response & based on response code, you can take action accordingly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman