0
votes

We use the Incoming Webhook feature to send notifications from our application backend to our internal Teams channel in some situations that require employee intervention (This is not a question about some kind of public Teams integration). I'm trying to add actionable notifications to our Teams workflow by adding an HttpPost action to our messages:

{
    "@type": "MessageCard",
    "@context": "https://schema.org/extensions",
    "summary": "Manual Verification Required",
    "themeColor": "#2196F3",
    "text": "<message content here>",
    "title": "Manual Verification Required",
    "potentialAction": [
        {
            "@type": "HttpPOST",
            "name": "Approve",
            "target": "https://our.application.host/.teams/webhook",
            "body": "verification.approve"
        }
    ]
}

The message arrives in teams properly:

message in Teams

Upon clicking the button though, immediately the following error message appears:

⚠️ Failed to send:
There was a problem submitting your changes. Try again in a minute.

After scratching my head, I opened the Teams webapp and checked the console:

POST https://teams.microsoft.com/api/mt/emea/beta/users/connectors/19:[email protected];messageid=1615721159117/1615721159117/executeAction 400

2021-03-14T11:30:20.322Z [O365ActionPaneController.makeHttpPOSTRequestForConnector()] Http invoke failed: {
  "data": {
    "errorCode": "BadRequest"
  },
  "status": 400,
  "config": {
    "method": "POST",
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "url": "https://teams.microsoft.com/api/mt/emea/beta/users/connectors/19:[email protected];messageid=1615721159117/1615721159117/executeAction",
    "data": {
      "inputParameters": [],
      "actionId": "3c5b2184-bffb-4797-9bbd-03fe41e11a83",
      "potentialAction": "{\"@type\":\"HttpPOST\",\"@id\":\"3c5b2184-bffb-4797-9bbd-03fe41e11a83\",\"name\":\"Approve\",\"target\":\"https://our.appplication.host/.teams/webhook\",\"headers\":[],\"body\":\"verification.approve\",\"bodyContentType\":\"\"}",
      "name": "action/connector",
      "integrationId": "8urpi87b0u",
      "meta": "\"{\\\"connectorSenderGuid\\\":\\\"203a1e2c-26cc-47ca-83ae-be98f960b6b2\\\",\\\"providerAccountUniqueId\\\":null,\\\"connectorConfigurationAlternateId\\\":\\\"8a43fac7aa1748688609de3602c9a4c5\\\"}\"",
      "clientInfo": {
        "locale": "en-us",
        "country": "us",
        "platform": "Web",
        "clientVersion": "1415/1.0.0.2021030227"
      }
    },
    "headers": {
      "X-Skypetoken": "pii",
      "Authorization": "pii",
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json;charset=utf-8",
      "X-RingOverride": "general",
      "x-ms-scenario-id": "620",
      "x-ms-user-type": null,
      "x-ms-client-type": "web",
      "x-ms-client-env": "pckgsvc-prod-c1-euno-02",
      "x-ms-client-version": "1415/1.0.0.2021030227",
      "x-ms-session-id": "694afe93-2218-14ab-fd16-d46edaf9fcc5"
    },
    "counter": "ext_actionable_card_http_post",
    "geoRoutingLookupDuration": 0.014999997802078724,
    "decrementNetworkRequests": null,
    "hostName": "teams.microsoft.com",
    "requestCreationDuration": 0.09000004455447197,
    "requestStartTime": 3355762.155000033,
    "responseStartTime": 3356549.715000001,
    "requestDuration": 787.5649999482557
  },
  "statusText": ""
}

So the only valuable information returned from the server seems to be the response {"errorCode":"BadRequest"}. That's a little thin.

I tried different variations of the body property - with quotes, without, with a content type, empty - no change.

What do I have to do to get message actions working?

1
Hi @Moritz Friedrich, I am unable to repro the issue. I have followed this documentation. Can you please provide valid target url in HttpPost action. - Sridevi-MSFT
Hi @Sridevi-MSFT, I replaced our working, publicly available, HTTPS target URL with an example value in the output above, as I don't think its relevant to the question. I tested calling the target URL with curl, which successfully returns a Status 200 in ~30ms. - Moritz Friedrich
Hey again @Sridevi-MSFT is there anything I can do to learn more about this error? Surely the Teams infrastructure logs the cause of BadRequest exceptions somewhere? The result of this cannot simply be that a reproduction is impossible. We have a subscription and I'm sending messages exactly as per the documentation, so this seems to be a bug in the product. I'm grateful for any help, just a little lost here. What is the suggested procedure? - Moritz Friedrich
I have reproduced the same code that you have provided and tested with my working target URL i.stack.imgur.com/Vxkm6.png i.stack.imgur.com/awyRh.png, its working completely fine. I think the issue is with your target URL could you please check your target URL in postman. - Sridevi-MSFT
As of today, the message action works. Nothing about the code changed; the target URL works flawlessly from curl or Postman; until now, the access log didn't even show any request made by Microsoft servers, so I'm absolutely sure there was some kind of bug in the Teams infrastructure. You can consider this issue solved, I guess... - Moritz Friedrich

1 Answers

0
votes

I have reproduced the same code that you have provided and tested with my working target URL, its working completely fine. I think the issue is with your target URL could you please check your target URL in postman. enter image description hereenter image description here