使用 Curl 以日历方式创建 Webhook 订阅:
$url = 'https://calendly.com/api/v1/hooks';
$webhook_url = 'A specific url where you receive Calendly appointment data in real-time';
$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_POSTFIELDS,$curl_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-TOKEN: <your token key>'
));
$result=curl_exec($ch);
curl_close($ch);
挂钩编号
print_r(json_decode($result, true));
实时接收Calendly约会数据的具体url:
接收 RAW 发布数据。
$content = trim(file_get_contents("php://input"));
尝试从 JSON 解码传入的 RAW 发布数据。
$decoded = json_decode($content, true);