Teams中Power Automate工作流Webhook调用失败,请求格式不符
问题:Teams Workflow应用Webhook请求格式不匹配错误
原本我以为可以借助Teams里的新版Workflow应用,把适用于Microsoft 365连接器的标准Webhook请求发送到目标Webhook URL,经处理后发布到Teams频道。我的工作流结构如图所示:[工作流结构示意图]。
但当我向该工作流发送如下JSON内容时:
{ "attachments": [ { "type": "AdaptiveCard", "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.5", "body": [ { "type": "Container", "items": [ { "type": "TextBlock", "text": "New TextBlock", "wrap": true, "weight": "Bolder", "size": "Large" } ] }, { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Col 1, Row 1:", "wrap": true, "weight": "Bolder" }, { "type": "TextBlock", "text": "Co 2, Row 2:", "wrap": true, "weight": "Bolder" } ] }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Col 2, Row 1", "wrap": true }, { "type": "TextBlock", "text": "Col 2, Row 2", "wrap": true } ] } ] } ] } ], "type": "message", }
收到如下错误响应:
{ "error": { "code": "TriggerInputSchemaMismatch", "message": "The input body for trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Required properties are missing from object: contentType, content.'." } }
我对此感到困惑,因为这个格式看起来和Teams中Workflow应用(Power Automate)处理消息的已知文档格式不匹配,怀疑是微软文档未更新或者自己操作有误,想知道需要用什么JSON Schema格式才能让Workflow/Automate应用的工作流正常运行?
解决方案
错误提示明确指出缺少contentType和content两个必填属性,这说明你当前使用的是Power Automate手动触发的Request触发器,而非Teams自带的Incoming Webhook连接器。
正确的Request触发器请求格式
需要包含contentType和content字段,若发送自适应卡片,contentType需指定为application/vnd.microsoft.card.adaptive,卡片内容放在content中,示例如下:
{ "contentType": "application/vnd.microsoft.card.adaptive", "content": { "type": "AdaptiveCard", "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.5", "body": [ { "type": "Container", "items": [ { "type": "TextBlock", "text": "New TextBlock", "wrap": true, "weight": "Bolder", "size": "Large" } ] }, { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Col 1, Row 1:", "wrap": true, "weight": "Bolder" }, { "type": "TextBlock", "text": "Co 2, Row 2:", "wrap": true, "weight": "Bolder" } ] }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Col 2, Row 1", "wrap": true }, { "type": "TextBlock", "text": "Col 2, Row 2", "wrap": true } ] } ] } ] } }
额外说明
- 若想使用Teams标准Webhook格式(带
attachments和type字段),需将工作流触发器切换为Teams的Incoming Webhook,而非Power Automate的Request触发器。 - 若必须保留Request触发器,需严格遵循其Schema要求,后续可在工作流步骤中将接收到的
content内容转发至Teams频道。
内容的提问来源于stack exchange,提问作者Thomas Ward
相关产品推荐
相关产品推荐

