WP Manifestindependent plugin directory
manifest / events / amelia-transpired-webhook

Amelia Transpired Webhook self-updates

Amelia for WordPress webhook that fires after an event has transpired

by Abundant Designs · github.com/robertstaddon/amelia-transpired-webhook · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/robertstaddon/amelia-transpired-webhook/archive/refs/heads/main.zip

Ships its own WordPress updater (Update URI header), so new versions show up under Dashboard → Updates.

WordPress plugin for Amelia Booking. It sends an HTTP POST with a JSON body to your chosen URL after an appointment’s scheduled end time (bookingEnd in Amelia’s database), not when the customer completes the booking form.

Use cases include Zapier, Make, custom APIs, CRM updates, and internal automations that should run only once the time slot has finished.

Requirements

  • WordPress 5.4+
  • PHP 7.4+
  • Amelia Booking (paid recommended; plugin reads wp_amelia_* tables and uses Amelia action hooks)

Installation

  1. Copy the amelia-transpired-webhook folder into wp-content/plugins/.
  2. Activate Amelia Transpired Webhook in Plugins.
  3. Ensure Amelia is active so the admin menu and database tables exist.

Configuration

Admin UI

  1. In wp-admin, open Amelia → Transpired webhook.
  2. Enter your webhook URL (https://…). Leave empty to disable all scheduling and outbound requests.
  3. Click Save Changes.

This screen sits next to Amelia’s built-in Settings entry. Amelia’s settings use a single-page app (#/general, etc.), so this plugin adds a separate submenu rather than injecting a tab into their JavaScript bundle.

Test webhook

Under Test webhook, use Send test webhook to POST a sample payload. It uses the same structure as production and the most recent appointment-linked booking in the database. The JSON includes "test": true (and related fields) so automations can ignore test traffic.

  • If the Webhook URL field has text, that value is used for the test (even before saving).
  • If the field is empty, the saved URL is used—save first if you only typed a new URL.

Reliability

WordPress cron depends on site traffic unless you trigger wp-cron.php from a system scheduler. For time-sensitive webhooks, configure a real cron job on the server.

How it works

  1. On relevant Amelia events (booking saved, rescheduled, appointment updated, etc.), the plugin schedules one wp_schedule_single_event at the appointment end time (read from the DB in UTC).
  2. When the event runs, it rebuilds the payload from the database, checks booking/appointment status against your rules, then POSTs JSON.
  3. Cancellations, rejections, no-shows, and deletions remove pending events for affected bookings.
  4. Successful sends store a short-lived transient so the same booking is not posted twice.
  5. Failed HTTP requests retry with increasing delay, up to a configurable maximum.

JSON payload (production)

Top-level keys include:

Key Description
event amelia.appointment.transpired
site_url Home URL
fired_at_gmt ISO 8601 time (GMT)
booking Amelia customer booking fields (id, status, price, persons, custom fields, etc.)
appointment Slot times (UTC strings + booking_end_unix_utc), status, integrations metadata
service, location, customer, provider Joined Amelia data

Test requests add test, test_note, and may be altered via atw_test_webhook_payload.

Filters

All filters are optional. The webhook URL is: saved option → then atw_webhook_url (return a string to override or force empty).

Filter Default Purpose
atw_webhook_url Option value Override effective URL
atw_delay_seconds 0 Extra seconds after bookingEnd before POST
atw_schedule_statuses approved, pending Which booking statuses get a scheduled event
atw_send_booking_statuses approved Booking must be in this set at fire time to send
atw_send_appointment_statuses approved, pending Appointment must be in this set at fire time
atw_max_retries 3 Max retry attempts after failure
atw_retry_interval 300 Base seconds between retries (multiplied by attempt)
atw_debug false Log to PHP error log with [ATW] prefix
atw_sent_ttl_days 90 Days to retain “already sent” transient
atw_menu_capability amelia_read_settings Capability for the settings page
atw_test_webhook_payload Modify test payload array

Example:

add_filter( 'atw_webhook_url', function ( $url ) {
    return $url ?: 'https://hooks.zapier.com/hooks/catch/xxx/yyy/';
});

add_filter( 'atw_debug', '__return_true' );

Uninstall / deactivation

  • Deactivate clears pending cron events registered under atw_booking_transpired_v1.
  • The plugin does not register an uninstall routine; the atw_webhook_url option and transients remain unless you remove them manually.

Development

  • Text domain: amelia-transpired-webhook
  • Prefix: ATW_ classes, atw_ functions and hooks
  • Bootstrap: atw() returns the singleton ATW_Plugin

Changelog

See CHANGELOG.md.

License

GPL-2.0-or-later. See license.

Amelia Booking is a trademark of its respective owners; this plugin is not affiliated with or endorsed by Amelia.