如何使用 cURL、PHP 和新的 MS 工作流程发布到 MS Teams 频道?

问题描述 投票:0回答:1

试图从已弃用的 webhook 连接器过渡,我收到以下错误...

{"error":{"code":"InvalidRequestContent","message":"The input body for trigger 'manual' of type 'Request' must be of type JSON, but was of type 'applicaton/json'."}}

...按照此处的说明以及可用的 Teams 模板进行操作后,“收到 Webhook 请求时发布到频道。”。

$webhook = <webhook>;
$card = [
  'text' => 'Hello world!'
];
$card = json_encode($card);
$c = curl_init($webhook);
curl_setopt_array($c, [
  CURLOPT_POSTFIELDS      => $card,
  CURLOPT_HTTPHEADER      => ['Content-type: applicaton/json'],
  CURLOPT_RETURNTRANSFER  => true
]);
$res = curl_exec($c);
curl_close($c);
die($res);
php curl microsoft-teams webhooks
1个回答
0
投票

application 有拼写错误。请更新并再次检查。 enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.