使用HttpPOST操作表单团队消息进行POST呼叫

时间:2019-10-02 21:04:42

标签: microsoft-teams office365connectors

我有一个MessageCard,正在通过传入Webhook连接器发送到我的团队频道。这运作良好。但是,该卡具有带有HttpPOST操作的按钮。在“目标”中,我以以下格式定义了指向我的API的URL:“ http://user:pass@address/resource/action.html?add2Queue=test”。当我尝试按下按钮时,出现错误:“不允许目标URL方案'http://user:pass@address/resource/action.html?add2Queue=test'。”。我没有发现使用HTTP的任何限制。我正在使用“传入Webhook”连接器。

它适用于HTTP还是仅适用于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"
        }]
    }]
}

1 个答案:

答案 0 :(得分:0)

关于发送承载授权令牌的团队的说明见here
基于我所做的:

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

它对我有用。适用于 Teams,我想它也适用于 Outlook

enter image description here