Webhooks in Easy!Appointments allow the system to automatically notify external services when key events occur (e.g., when an appointment is booked, updated, or canceled). This is useful for integrating with third-party systems such as CRMs, notification platforms, or analytics tools.
⚙️ Webhooks are configured via code—there is no built-in admin UI for webhooks.
Supported Events
Easy!Appointments can trigger webhooks for the following events:
Event | Description |
---|---|
appointment_created | Triggered when a new appointment is created. |
appointment_updated | Triggered when an existing appointment is edited. |
appointment_deleted | Triggered when an appointment is canceled or removed. |
How Webhooks Work
When a supported event occurs, Easy!Appointments sends an HTTP POST
request to a specified URL with a JSON payload containing relevant appointment data.
Step-by-Step Setup
1. Enable Webhooks in the Codebase
You’ll need to customize the appointment model or create a custom library to trigger the webhook on relevant events.
For example, in application/models/appointment_model.php
, you can add a function like:
phpCopyEditprivate function trigger_webhook($event, $data) {
$url = 'https://your-webhook-url.com/webhook-endpoint';
$payload = json_encode([
'event' => $event,
'timestamp' => date('c'),
'data' => $data,
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Content-Length: ' . strlen($payload)
]);
curl_exec($ch);
curl_close($ch);
}
Then, call trigger_webhook()
inside functions like add_appointment
, update_appointment
, and delete_appointment
.
2. Define the Webhook Receiver
Your external system must be prepared to receive a POST
request with a JSON body like:
jsonCopyEdit{
"event": "appointment_created",
"timestamp": "2025-07-08T10:15:00+00:00",
"data": {
"id": 145,
"start_datetime": "2025-07-15 14:30:00",
"end_datetime": "2025-07-15 15:00:00",
"service_name": "Consultation",
"provider_name": "John Doe",
"customer": {
"full_name": "Jane Smith",
"email": "jane@example.com",
"phone": "+123456789"
}
}
}
🔐 Tip: Use secret headers or token-based validation to ensure requests are from a trusted source.
Security Best Practices
- Always validate the request origin using a secret token or IP allowlist.
- Use HTTPS for secure data transfer.
- Log incoming requests on your server for debugging and audit purposes.
Advanced: Centralized Webhook Library
If you want to make webhook triggering more modular, consider creating a new library (e.g., application/libraries/Webhook.php
) and load it wherever needed.
Use Cases
- Sync appointments to an external CRM
- Trigger a Slack or Microsoft Teams notification
- Send real-time updates to a mobile app backend
- Integrate with Zapier or Make (formerly Integromat)