Commencer un nouveau sujet

PHP | Scheduling API: how to create a watcher

You can use this snippet to create a new watcher (or webhook). Once the watcher is created, Agendize platform will notify the subscribed URL and send the JSON structure for each 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"
    // or: 'address' => "https://hooks.zapier.com/hooks/catch/yyyyyyy/xxxxxx/"
);
$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);
?>


You can also view all your existing watchers using the Watcher API.

Connexion ou Inscription pour poster un commentaire