Dr.Crazy
Dr.Crazy

Reputation: 2291

Make POST call with HttpPOST Action form Teams message

I have a MessageCard which I am sending to my Teams channel via the Incoming Webhook connector. This is working well. However, the card has the button with HttpPOST Action. In "target" I defined URL to my API in the format: "http://user:pass@address/resource/action.html?add2Queue=test". When I am trying to push button I am getting the error: "Target URL scheme 'http://user:pass@address/resource/action.html?add2Queue=test' is not allowed.". I didn't find any restrictions for using HTTP. I am using the "Incoming Webhook" connector.

Is it works with HTTP or only HTTPS?

JSON:

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Action on environments status change",
    "sections": [{
        "activityTitle": "Envrionments status are going to change",
        "facts": [{
            "name": "Environment:",
            "value": "3"
        }, {
            "name": "Due date",
            "value": "On Friday 8:00 PM Central Time"
        }, {
            "name": "Pending Action",
            "value": "Environment are going to be stopped"
        }, {
            "name": "Notes",
            "value": "You can pause this action by pressing Pause button bellow"
        }],
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "HttpPOST",
        "name": "Pause Action",
        "actions": [{
            "@type": "HttpPOST",
            "name": "Pause",
            "target": "http://user:pass@server/teamcity/httpAuth/action.html?add2Queue=Marlin_Infrastructure_MarlinInfrastructureStopStartEnvironments_TechnicalTasks_N"
        }]
    }]
}

Upvotes: 1

Views: 2370

Answers (1)

brohymn
brohymn

Reputation: 460

Explanation of Teams sending a bearer authorization token can be found here
Based on that I did:

        "@type": "HttpPOST",
        "name": "Your Action",
        "target": "https://www.your-url.com",
        "headers": [
            {
                "name": "Authorization",
                "value": null
            }
        ],
        "body": "{\"whateverdata\"}"

and it worked for me. Works on Teams , I imagine it should work for outlook as well

enter image description here

Upvotes: 3

Related Questions