来自 Microsoft Teams 卡片的 Http POST

Http POST from card in Microsoft Teams

我们正在尝试使用 Teams、Flow 和 Assembla 创建审批工作流,但 运行 遇到了一些麻烦。

我们已经成功设置了一些组件,但是我们无法从 Teams 中的卡片启动 POST 操作。

在团队中,我们可以使用带有此结果的传入 webhook 连接器成功创建卡片。

这是使用来自 FlowPOST 操作的以下 JSON 正文创建的

{
    "@@type": "MessageCard",
    "@@context": "http://schema.org/extensions",
    "summary": "This is the summary property",
    "themeColor": "f46b42",
    "sections": [
        {
            "startGroup": true,
            "title": "**Pending Review**",
            "activityTitle": "Ticket Title",
            "activitySubtitle": "Requested by: ",
            "facts": [
                { "name": "Date submitted:", "value": "06/27/2017, 2:44 PM" },
                { "name": "Details:",
                "value": "This ticket is ready for review." }
            ]
        },
        {
            "potentialAction": [
                {

                    "@@type": "HttpPOST",
                    "name": "Approve",
                    "target": "ANOTHER-POST-URL-IS-HERE"
                },
                {


                    "@@type": "HttpPOST",
                    "name": "Deny",
                    "target": "ANOTHER-POST-URL-IS-HERE"
                }
            ]
        }
    ]
}

我们有另一个 Flow url 作为卡片上两个按钮的目标。为了测试这个 url 我们能够通过 POSTMAN 成功地 post 并继续审批工作流程。

单击团队卡上的按钮时,根本不会通知 post url 处的流程。没有 运行 on Flow 被触发。在团队中,会显示一个非常普遍的 "There was a problem submitting your changes. Try again in a minute." 错误。

在对 Microsoft Teams github 页面上的 connectors.md 文件进行研究后,我 运行 注意到文档中这个可爱的部分

我觉得很奇怪,在他们下面提到可能不支持 POST 操作文档继续详细说明在团队卡片中使用 POST 和 ActionCard 操作的示例.

所以我的问题是,有什么方法可以让 HttpPOST 操作从 Teams 中的自定义卡片到 Microsoft Flow POST URL?

谢谢!

Update:

Upon further testing we have determined that HttpPOST actions work with just about any post url we can come up with except Microsoft Flow Request URLs. They are exceptionally long urls so maybe that has something to do with it?

Here's an example Flow request url.

https://prod-43.westus.logic.azure.com:443/workflows/f86b928acd3d4ecab849f677974f7816/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ZBxr5GFKQhMp4JXWGmec_L6aqgcaqvCOKUWOf2li-xQ

When running teams in a web browser we are able to see the request first posts to a api.teams.skype.com url and returns a generic "ProviderError". Other non-flow urls also do the same but return success.

这对我们来说是一个 head-scratcher - 正如您推测的那样,这应该有效。 Teams、Flow 和 Outlook 团队今天对此进行了故障排除,并找出了问题所在。

您要发布到的 URL https://prod-43.westus.logic.azure.com[...] 具有嵌入的不记名令牌(URL 中 sig 参数的值)。当您通过 CURL、Fiddler、Postman 等 POST 到那个 URL 时,它可以工作,因为该令牌存在。

但是,当您单击可操作消息中的 HttpPOST 按钮时,Outlook 会在 HTTP header 中添加自己的 JWT 令牌,这意味着 HTTP POST 具有 URL 中的 sig= 不记名令牌和 HTTP header 中的 JWT 令牌。 Flow 检测到这一点并拒绝 HTTP POST 无效(虽然我们目前不支持 JWT 令牌,但我们计划将这种情况视为无效以保持向前兼容性)。

这个用例将来会起作用。同时,尝试的一种解决方法是将可操作的消息按钮 POST 连接到 您的 端点,例如https://yoursite.com/accepthttps://yoursite.com/deny(尽可能多地验证 JWT)并让这些端点 POST 直接在没有 JWT 的情况下流动。

如果可行,请告诉我们。

顺便说一句,您找到的文本是一个文档错误,此后 fixed

抱歉造成混淆。