Webhooks
Webhooks notify a URL when an appointment is scheduled, canceled, or rescheduled. You can create static webhooks in your Acuity account settings, or create webhooks dynamically using our API.
Static Webhooks
Under Integrations set the Webhook integration with the URL to be notified on changes to appointments. The URL must be to port 443 or 80.
Webhook requests are application/x-www-form-urlencoded
POST requests with these variables:
- action either
scheduled
rescheduled
canceled
changed
ororder.completed
depending on the action that initiated the webhook call - id the ID for the appointment or order, get the details through the get appointment API call or the orders API call
- calendarID the ID of the calendar for the appointment. This is only sent for appointments
- appointmentTypeID the ID of the type of the appointment. This is only sent for appointments
The different actions:
scheduled
is called once when an appointment is initially bookedrescheduled
is called when the appointment is rescheduled to a new timecanceled
is called whenever an appointment is canceledchanged
is called when the appointment is changed in any way. This includes when it is initially scheduled, rescheduled, or canceled, as well as when appointment details such as e-mail address or intake forms are updated.order.completed
is called when an order is completed
Dynamic Webhooks
This new feature allows you to create new Webhook subscriptions through the Webhooks API. Click here to learn all details.
Verifying Webhook Requests
Webhook notifications are signed by Acuity using the main admin's API key for static webhooks or your user account's API key for dynamic webhooks. You can use this signature to verify that a notification is from Acuity. First compute the base64 HMAC-SHA256
signature of the notification using the request's body as the message and your API key as the shared secret. Then compare this signature to the request header x-acuity-signature
. If they match, the notification is authentic.
<?php
// Get hash of message using shared secret:
$body = file_get_contents('php://input');
$hash = base64_encode(hash_hmac('sha256', $body, $secret, true));
// Compare the two:
if ($hash !== $_SERVER['HTTP_X_ACUITY_SIGNATURE']) {
throw new Exception('This message was forged!');
}
// Get hash of message using shared secret:
var hasher = crypto.createHmac('sha256', secret);
hasher.update(buf.toString());
var hash = hasher.digest('base64');
// Compare hash to Acuity signature:
if (hash !== req.header('x-acuity-signature')) {
throw new Error('This message was forged!');
}
require 'openssl'
require 'base64'
def verify_message_signature(secret, body, signature)
hash = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret, body))
if hash.strip() != signature
raise 'This message was forged!'
end
end
POST https://example.com/webhook-callback
action=changed&id=13&calendarID=1&appointmentTypeID=13
Simulate Acuity Webhooks
You can use
curl
to simulate Acuity webhooks:curl -d "action=changed&id=1&calendarID=1&appointmentTypeID=1" "https://example.com/webhook-callback"
Webhook Retries
Webhook calls are retried with exponential backoff over a 24 hour period. Acuity will stop attempting if there is not a successful response after 24 hours. We only retry webhooks if they return a 500
internal server error, or if we experience network related connection errors when attempting to send the webhook.
Retry Number | Interval |
---|---|
1 | 2 seconds |
2 | 30 seconds |
3 | 1 minute |
4 | 5 minutes |
5 | 10 minutes |
6 | 15 minutes |
7 | 30 minutes |
8 | 1 hour |
9 | 12 hours |
NOTE If a webhook continues to fail because of a 500
HTTP error or because of connection issues over a period of 5 days, we will disable the webhook. It will have to be manually re-enabled by you, either through the API for API webhooks or through the Integrations page for static webhooks.
Updated 8 months ago