ms teams power 自动化 HTTP POST 发送 "attachment id"
ms teams power automate HTTP POST sending "attachment id"
以下是我正在尝试的场景::
- 使用 webhook 将有效负载发送到 MS 团队频道
- 使用频道中的选定消息,我们触发“电源自动化”流程
- 此流程将使用 REST API POST 对所选消息执行 HTTP Post,并将所选消息作为正文。
- 我们注意到目标主机接收到的有效载荷与所选消息不同,例如,目标主机接收到的有效载荷包含如下内容:
{"teamsFlowRunContext":{"MessagePayload":{"Id":"1633540811919","From":{"Application":{"DisplayName":"alerts-test-hk-webhook","Id":"gmbs42a62l"},"Conversation":null,"Device":null,"User":null},"Body":{"ContentType":"html","Content":"<attachment
id="806b91eb802b49db9c13e8903de936f6">","PlainText":null},"Subject":"","LinkToMessage":"https://teams.microsoft.com/l/message/19:5463456345346ghdh@thread.skype/1633540811919"},"Id":"f:4abaa1b5-eb58-b8c7-5190-db70a3b28143","ChannelData":{"EventType":null,"InvalidateInvokeCache":null,"Team":{"Id":"19:sdrg4wt45gsrth4y4her@thread.skype","AadGroupId":"b948e56e-4ea4-456f-bff4-16108061827f","Name":null},"Tenant":{"Id":"8bcff170-9979-491e-8683-d8ced0850bad"},"Channel":{"Id":"19:f1b77b6a406d4f8ebfc33faefea1cf1a@thread.skype","Name":null},"Notification":null,"OnBehalfOf":null},"From":{"Id":"29:1vERchnRGPZujmen29j4aZQzb2OFhXvipxhkjd3z7LyDleTr9PWVn-OBk1mxLcVl6ejhk9kvdw4L1Ph6FFoY5VA","Name":"testuser","Role":null,"AadObjectId":"cf1a646f-7a9b-4e33-830c-2bd0282a93fe","Properties":null},"Conversation":{"Id":"19:f1b77b6a406d4f8ebfc33faefea1cf1a@thread.skype;messageid=1633540811919","Name":"buildeng-alerts-test-hk","IsGroup":true},"Locale":"en-GB","CommandContext":"message","LocalTimezone":"India
Standard Time"},"cardOutputs":{"choice":"Retry"}}}
但是,如果不使用 webhook,即在 MS 团队频道中手动输入或 copy/paste,并使用手动输入的信息或 copy/paste,使用频道中的选定消息,触发电源自动流程,有效载荷被正确发送(如预期的那样),如下所示在目标主机中收到的有效载荷:
{"entity":{"teamsFlowRunContext":{"MessagePayload":{"Id":"1633540339359","From":{"Application":null,"Conversation":null,"Device":null,"User":{"DisplayName":"testuser","Id":"cf1a646f-7a9b-4e33-830c-2bd0282a93fe"}},"Body":{"ContentType":"html","Content":"\n<div
itemprop="copy-paste-block">\n\n<div style="font-size:12px">Build
<a
href="https://example.com/job/hk-test/job/hk-inifniteloop/47/console"
rel="noreferrer noopener" target="_blank"
title="https://example.com/job/hk-test/job/hk-inifniteloop/47/console">(47)
of <a
href="https://example.com/job/hk-test/job/hk-inifniteloop/47/"
rel="noreferrer noopener" target="_blank"
title="https://example.com//hk-test/job/hk-inifniteloop/47/">(hk-test/hk-inifniteloop/47)
failed on <a href="https://example.com"
rel="noreferrer noopener" target="_blank"
title="https://example.com/">(example.com)\n\n","PlainText":"\n\n\nBuild
(47) of (/hk-test/hk-inifniteloop/47) failed on
(teams-buildeng)"},"Subject":"","LinkToMessage":"https://teams.microsoft.com/l/message/19:89nsad08dnd98fmhb-9dfijb@thread.skype/1633540339359"},"Id":"f:b2ad833d-b218-a077-de38-c89ef8563ab6","ChannelData":{"EventType":null,"InvalidateInvokeCache":null,"Team":{"Id":"19:f5f62v456v54b@thread.skype","AadGroupId":"b948e56e-4ea4-456f-bff4-16108061827f","Name":null},"Tenant":{"Id":"8bcff170-9979-491e-8683-d8ced0850bad"},"Channel":{"Id":"19:f5v2356264@thread.skype","Name":null},"Notification":null,"OnBehalfOf":null},"From":{"Id":"29:f4vw6vb65r6-OBk1mxLcVl6ejhk9kvdw4L1Ph6FFoY5VA","Name":"testuser","Role":null,"AadObjectId":"cf1a646f-7a9b-4e33-830c-2bd0282a93fe","Properties":null},"Conversation":{"Id":"19:3425v2345bv45v45b@thread.skype;messageid=1633540339359","Name":"buildeng-alerts-test-hk","IsGroup":true},"Locale":"en-GB","CommandContext":"message","LocalTimezone":"India
Standard Time"},"cardOutputs":{"choice":"Retry"}}}
请告知导致此“附件 ID”行为的原因,因为我们正在自动化从 jenkins 到 ms teams 到 http post 到目标主机的流程。
为了提高知名度,添加评论部分的答案:
这似乎是设计使然:根据所选消息,目标主机中接收到的负载不是预期的。
以下是我正在尝试的场景::
- 使用 webhook 将有效负载发送到 MS 团队频道
- 使用频道中的选定消息,我们触发“电源自动化”流程
- 此流程将使用 REST API POST 对所选消息执行 HTTP Post,并将所选消息作为正文。
- 我们注意到目标主机接收到的有效载荷与所选消息不同,例如,目标主机接收到的有效载荷包含如下内容:
{"teamsFlowRunContext":{"MessagePayload":{"Id":"1633540811919","From":{"Application":{"DisplayName":"alerts-test-hk-webhook","Id":"gmbs42a62l"},"Conversation":null,"Device":null,"User":null},"Body":{"ContentType":"html","Content":"<attachment id="806b91eb802b49db9c13e8903de936f6">","PlainText":null},"Subject":"","LinkToMessage":"https://teams.microsoft.com/l/message/19:5463456345346ghdh@thread.skype/1633540811919"},"Id":"f:4abaa1b5-eb58-b8c7-5190-db70a3b28143","ChannelData":{"EventType":null,"InvalidateInvokeCache":null,"Team":{"Id":"19:sdrg4wt45gsrth4y4her@thread.skype","AadGroupId":"b948e56e-4ea4-456f-bff4-16108061827f","Name":null},"Tenant":{"Id":"8bcff170-9979-491e-8683-d8ced0850bad"},"Channel":{"Id":"19:f1b77b6a406d4f8ebfc33faefea1cf1a@thread.skype","Name":null},"Notification":null,"OnBehalfOf":null},"From":{"Id":"29:1vERchnRGPZujmen29j4aZQzb2OFhXvipxhkjd3z7LyDleTr9PWVn-OBk1mxLcVl6ejhk9kvdw4L1Ph6FFoY5VA","Name":"testuser","Role":null,"AadObjectId":"cf1a646f-7a9b-4e33-830c-2bd0282a93fe","Properties":null},"Conversation":{"Id":"19:f1b77b6a406d4f8ebfc33faefea1cf1a@thread.skype;messageid=1633540811919","Name":"buildeng-alerts-test-hk","IsGroup":true},"Locale":"en-GB","CommandContext":"message","LocalTimezone":"India Standard Time"},"cardOutputs":{"choice":"Retry"}}}
但是,如果不使用 webhook,即在 MS 团队频道中手动输入或 copy/paste,并使用手动输入的信息或 copy/paste,使用频道中的选定消息,触发电源自动流程,有效载荷被正确发送(如预期的那样),如下所示在目标主机中收到的有效载荷:
{"entity":{"teamsFlowRunContext":{"MessagePayload":{"Id":"1633540339359","From":{"Application":null,"Conversation":null,"Device":null,"User":{"DisplayName":"testuser","Id":"cf1a646f-7a9b-4e33-830c-2bd0282a93fe"}},"Body":{"ContentType":"html","Content":"\n<div itemprop="copy-paste-block">\n\n<div style="font-size:12px">Build <a href="https://example.com/job/hk-test/job/hk-inifniteloop/47/console" rel="noreferrer noopener" target="_blank" title="https://example.com/job/hk-test/job/hk-inifniteloop/47/console">(47) of <a href="https://example.com/job/hk-test/job/hk-inifniteloop/47/" rel="noreferrer noopener" target="_blank" title="https://example.com//hk-test/job/hk-inifniteloop/47/">(hk-test/hk-inifniteloop/47) failed on <a href="https://example.com" rel="noreferrer noopener" target="_blank" title="https://example.com/">(example.com)\n\n","PlainText":"\n\n\nBuild (47) of (/hk-test/hk-inifniteloop/47) failed on (teams-buildeng)"},"Subject":"","LinkToMessage":"https://teams.microsoft.com/l/message/19:89nsad08dnd98fmhb-9dfijb@thread.skype/1633540339359"},"Id":"f:b2ad833d-b218-a077-de38-c89ef8563ab6","ChannelData":{"EventType":null,"InvalidateInvokeCache":null,"Team":{"Id":"19:f5f62v456v54b@thread.skype","AadGroupId":"b948e56e-4ea4-456f-bff4-16108061827f","Name":null},"Tenant":{"Id":"8bcff170-9979-491e-8683-d8ced0850bad"},"Channel":{"Id":"19:f5v2356264@thread.skype","Name":null},"Notification":null,"OnBehalfOf":null},"From":{"Id":"29:f4vw6vb65r6-OBk1mxLcVl6ejhk9kvdw4L1Ph6FFoY5VA","Name":"testuser","Role":null,"AadObjectId":"cf1a646f-7a9b-4e33-830c-2bd0282a93fe","Properties":null},"Conversation":{"Id":"19:3425v2345bv45v45b@thread.skype;messageid=1633540339359","Name":"buildeng-alerts-test-hk","IsGroup":true},"Locale":"en-GB","CommandContext":"message","LocalTimezone":"India Standard Time"},"cardOutputs":{"choice":"Retry"}}}
请告知导致此“附件 ID”行为的原因,因为我们正在自动化从 jenkins 到 ms teams 到 http post 到目标主机的流程。
为了提高知名度,添加评论部分的答案:
这似乎是设计使然:根据所选消息,目标主机中接收到的负载不是预期的。