Skip to content

feat(integrations): add Bookly action integration with setup UI#165

Open
RishadAlam wants to merge 3 commits into
mainfrom
feat/bookly
Open

feat(integrations): add Bookly action integration with setup UI#165
RishadAlam wants to merge 3 commits into
mainfrom
feat/bookly

Conversation

@RishadAlam
Copy link
Copy Markdown
Member

@RishadAlam RishadAlam commented May 16, 2026

Description

This PR adds a new Bookly action integration to Bit Integrations with end-to-end backend and frontend support. Users can now configure Bookly actions in the flow builder, map trigger fields, and use dynamic/staff/service/status data during setup.

Motivation & Context

Bookly users need a native action connector so they can automate appointment and customer management workflows directly from Bit Integrations. This closes that gap by introducing Bookly action configuration, authorization checks, and execution routing.

Related Links: (if applicable)

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • ⚡ Improvement
  • 🔄 Code refactor

Key Changes

Backend (Bookly Action Engine)

  • Added Bookly action controller and route handlers for authorization and dynamic data refresh (staff, services, statuses)
  • Added Bookly action execution helper with action-based dispatch and logging integration
  • Added field-map request data generation for Bookly action payload construction

Frontend (Integration Setup UI)

  • Added full Bookly integration UI flow components (layout, authorization screen, field mapping, edit support)
  • Added Bookly integration metadata and action modules for action selection
  • Added integration registration hooks so Bookly appears in new/edit integration flows and action selector

Assets

  • Added Bookly integration icon asset for integration listing and selection UI

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Tests added/updated
  • Documentation updated if needed
  • README updated if needed

Changelog

  • Feature: Added Bookly as a new action integration in the flow builder.
  • New Actions: Users can configure create/update/delete operations for Bookly appointments and customers.
  • Improvement: Added dynamic staff, service, and appointment status loading to simplify Bookly action setup.

Copilot AI review requested due to automatic review settings May 16, 2026 11:16
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new integration for Bookly, providing both backend logic and a frontend configuration interface. The backend includes a controller for managing staff, services, and statuses, along with an API helper to execute actions like creating or updating appointments and customers. The frontend implementation covers authorization, field mapping, and integration layout. Feedback provided focuses on ensuring that methods called statically in the routes are correctly declared as static in the controller and improving PHP 8 compatibility by validating potential WP_Error responses before accessing them as arrays.

wp_send_json_success(true);
}

public function refreshStaff()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The method refreshStaff is called statically in Routes.php but is declared as an instance method. For consistency with booklyAuthorize and to avoid potential issues in PHP 8.0+, it should be declared as static.

    public static function refreshStaff()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Changed refreshStaff to static for consistency with other methods in this class.

public static function refreshStaff()

Note: the router (Route::action()) uses ReflectionMethod::isStatic() to handle both static and instance methods, so this was not causing a runtime error — but making it static is correct since the method doesn't use $this.

wp_send_json_success(['staff' => $staff], 200);
}

public function refreshServices()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The method refreshServices is called statically in Routes.php but is declared as an instance method. It should be declared as static.

    public static function refreshServices()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Changed refreshServices to static for consistency with other methods in this class.

public static function refreshServices()

wp_send_json_success(['services' => $services], 200);
}

public function refreshStatuses()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The method refreshStatuses is called statically in Routes.php but is declared as an instance method. It should be declared as static.

    public static function refreshStatuses()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Changed refreshStatuses to static for consistency with other methods in this class.

public static function refreshStatuses()

break;
}

$responseType = isset($response['success']) && $response['success'] ? 'success' : 'error';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In PHP 8.0+, accessing an array offset on an object that does not implement ArrayAccess (like WP_Error) will throw a fatal error. Since Hooks::apply might return a WP_Error, you should validate the response using is_wp_error() before checking for the success key.

        $responseType = !is_wp_error($response) && isset($response['success']) && $response['success'] ? 'success' : 'error';
References
  1. In PHP, when handling responses that may return a WP_Error object, always use the is_wp_error() function to validate the response before accessing it as an array or object. This prevents fatal errors in PHP 8.0+.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Added is_wp_error() check before accessing $response as an array to prevent fatal errors in PHP 8.0+ if a filter callback returns a WP_Error.

$responseType = !is_wp_error($response) && isset($response['success']) && $response['success'] ? 'success' : 'error';

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@RishadAlam RishadAlam changed the title feat(integrations): add Bookly action integration feat(integrations): add Bookly action integration with setup UI May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants