1

我试图为 Asana 中的一项任务创建一个 webhook,但我得到的唯一响应是:

{
  "errors": [
    {
      "message": "Could not complete activation handshake with target URL. Please ensure that the receiving server is accepting connections and supports SSL",
      "help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
    }
  ]
}

(状态:400 错误请求)

我正在通过 Postman 发送 POST 请求,https://app.asana.com/api/1.0/webhooks其中包含以下内容:

{
  "data": 
    {
      "resource": 123456789012345,
      "target": "https://example.com/asana.php"
    }
}

asana.php看起来像这样:

$headers = getallheaders();
$secret_token = $headers['X-Hook-Secret'];
header('X-Hook-Secret: ' . $secret_token);

我究竟做错了什么?我错过了什么吗?

4

1 回答 1

0

根据 Asana API 参考 ( https://asana.com/developers/api-reference/webhooks ),

目标必须以 200 OK 和匹配的 X-Hook-Secret 标头进行响应,以确认确实需要此 webhook 订阅。

当您发送标头时,您知道正在发送什么响应代码吗?也许您可能想看看http://php.net/manual/en/function.header.php$http_response_code中的参数

于 2016-09-09T19:28:19.290 回答