Event Hooks for Developers
The ReDi Restaurant Reservation plugin allows restaurants to accept real-time online reservations and offers developer-friendly hooks for extending functionality or integrating with other WordPress plugins, CRMs, or third-party services.
These hooks function like standard WordPress do_action() and apply_filters() calls. Developers can attach custom code to reservation lifecycle events when a reservation is created.
Available Events
1. Reservation Created
Triggered immediately after a new reservation is successfully saved.
add_action('redi/event', function ($type, $payload) {
if ($type === 'ReservationCreated') {
// Your custom logic here
error_log('New reservation created: ' . print_r($payload, true));
}
}, 10, 2);
Payload Structure
Each event passes a structured payload array with reservation details:
[
'reservationId' => (int), // Reservation ID
'placeId' => (int), // Restaurant (place) ID
'startsAt' => (string, ISO8601), // Reservation start time
'endsAt' => (string, ISO8601), // Reservation end time
'partySize' => (int), // Number of guests
'parameters' => (array), // Custom fields
'comments' => (string), // Comments to reservation
'customer' => [
'name' => (string), // Full name of the guest
'firstName' => (string), // First name of the guest
'lastName' => (string), // First name of the guest
'phone' => (string),
'email' => (string),
],
]
Example for a created reservation:
[
'reservationId' => 1012,
'placeId' => 42,
'startsAt' => '2025-10-01 19:00',
'endsAt' => '2025-10-01 21:00',
'partySize' => 4,
'comments' => 'Seating near window',
'parameters' => [],
'customer' => [
'name' => 'John Doe',
'firstName' => 'John',
'lastName' => 'Doe',
'phone' => '+123456789',
'email' => 'john@example.com',
],
]
Filtering the Payload
Before an event is fired, the payload passes through a filter:
add_filter('redi/event/payload', function ($payload, $type) {
// Example: anonymize customer phone before sending to webhook
if ($type === 'ReservationCreated') {
$payload['customer']['phone'] = 'hidden';
}
return $payload;
}, 10, 2);
Return a modified array to adjust the data.
Return
falseto block the event from being emitted.
Typical Use Cases
Send reservations to Google Calendar or Outlook
Sync with external CRMs or email marketing tools
Send WhatsApp / SMS confirmations using third-party gateways
Trigger Zapier or custom webhooks
Generate custom analytics or reports
Why Use ReDi Reservation Hooks?
Built on standard WordPress action & filter system (familiar to all developers).
Works like hooks in popular plugins (WooCommerce, Five Star Restaurant Reservations).
Makes the ReDi Restaurant Reservation plugin easy to integrate with any external system.