Commencer un nouveau sujet

PHP | Scheduling API: how to create an appointment watcher

You can use this snippet to create a watcher (or webhook) that will send the JSON structure of each new appointment booked:


<?php 
$apiKey = "";
$token = "";
$companyId = "";

//create a new cURL resource
$ch = curl_init("https://app.agendize.com/api/2.1/scheduling/companies/$companyId/appointments/watch?apiKey=$apiKey&token=$token");

//setup request to send json via POST
$data = array(
    'address' => "https://webhook.site/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
);
$payload = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

//set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

//execute the POST request
$result = curl_exec($ch);

//close cURL resource
curl_close($ch);
?>


Connexion ou Inscription pour poster un commentaire