Forum Discussion

Radiergummi's avatar
Radiergummi
Copper Contributor
Mar 16, 2021

HttpPost Action fails with BadRequest

We use the https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-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:

 
 

 

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

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

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

POST https://teams.microsoft.com/api/mt/emea/beta/users/connectors/19:0d89db468868447a8e526a258788b854@thread.tacv2;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:0d89db468868447a8e526a258788b854@thread.tacv2;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?

Resources