There's very few post here regarding Calendly so hopefully somebody can help with this issue. Below is the code I'm using and the issue is that Calendly only returns the webhook subscription data, not the actually appointments that customers schedule.
I want to receive data as described on their page here: https://developer.calendly.com/docs/sample-webhook-data but I only get webhook subscription data back, not the scheduled appointments.
$url = 'https://calendly.com/api/v1/hooks';
$webhook_url = 'MY URL HERE';
$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);
echo $result;
curl_close($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"}}]}