I’m working with the Calendly API and running into a frustrating problem. When I set up my webhook, I expect to get the actual appointment data when someone books or cancels a meeting. However, all I’m getting back is the webhook subscription information itself.
I need to capture real booking events like when someone schedules or cancels an appointment. The API should send me detailed information about the booking, but instead I just get confirmation that my webhook is active.
Here’s my current implementation:
$api_endpoint = 'https://calendly.com/api/v1/hooks';
$callback_url = 'MY_CALLBACK_URL_HERE';
$post_data = 'url='.$callback_url.'&events[]=invitee.created&events[]=invitee.canceled';
$handle = curl_init();
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_URL, $api_endpoint);
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($handle, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($handle, CURLOPT_HTTPHEADER, array(
"X-TOKEN: MY_API_TOKEN"
));
$response = curl_exec($handle);
echo $response;
curl_close($handle);
// Process incoming webhook data
$input_data = trim(file_get_contents("php://input"));
$parsed_data = json_decode($input_data, true);
echo $parsed_data;
The response I get looks like this:
{"data":[{"type":"hooks","id":380871,"attributes":{"url":"MY_CALLBACK_URL","created_at":"2019-04-17T11:07:36Z","events":["invitee.created","invitee.canceled"],"state":"active"}}]}
This just shows my webhook is set up correctly, but where is the actual appointment data? What am I missing in my setup?