这里很少有关于 Calendly 的帖子,所以希望有人可以帮助解决这个问题。下面是我正在使用的代码,问题是 Calendly 只返回 webhook 订阅数据,而不是客户安排的实际约会。
我想接收他们页面上描述的数据:https ://developer.calendly.com/docs/sample-webhook-data但我只得到 webhook 订阅数据,而不是预定的约会。
$url = ' https://calendly.com/api/v1/hooks ';
$webhook_url = '我的网址在这里';
$curl_data = 'url='.$webhook_url.'&events[]=invitee.created&events[]=invitee.canceled';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$curl_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( "X-TOKEN: MY TOKEN ID HERE"
));
$result = curl_exec($ch);
回显$结果;
//print_r(json_decode($result, true));<br><br>
$content = trim(file_get_contents("php://input"));<br>
$decoded = json_decode($content, true);<br><br>
echo $decoded;<br>
{"data":[{"type":"hooks","id":380871,"attributes":{"url":"MY URL HERE","created_at":"2019-04-17T11:07:36Z ","events":["invitee.created","invitee.canceled"],"state":"active"}}]}