我正在尝试在 Asana 中设置一个 webhook,以向我发送特定项目的事件更新。我是新手,所以在阅读和回答时请记住这一点。我在这里的第一篇文章,所以请放轻松。这是我正在运行的代码。
asanawebhook.php 页面:
$headers = getallheaders();
$secret_token = $headers['X-Hook-Secret'];
header('X-Hook-Secret: ' . $secret_token);
header("HTTP/1.1 200 OK");
我创建 webhook 的 curl 请求:
$apikey = "mykey"; // Your API key
$taskid = "resourceid";
exec( 'curl \
-H "Authorization: Bearer '.$apikey.'" \
-H "Content-Type: application/x-www-form-urlencoded" \
-X POST https://app.asana.com/api/1.0/webhooks \
-d "resource='.$taskid.'" \
-d "target=https://mywebsite.com/folders/asanawebhook.php"', $return);
print_r($return);
这让我在我的页面上打印了这个错误。
Array ( [0] => {"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"}]} )
如果我可以让它返回某种成功消息,我假设我可以解析数据,然后向 Asana 发出 curl 请求以获取完整的有效负载。提前致谢。