Skip to content

Incorporate Clientify v2 with automatic v1/v2 detection #175

@davidperezgar

Description

@davidperezgar

Overview

Add support for Clientify v2 API in FormsCRM while maintaining full backwards compatibility with v1. The plugin should automatically detect which API version the user's account uses, so they don't need to reconfigure their form field mappings when the underlying API changes.

Motivation

Clientify v2 introduces a new API with different field structures. Without automatic detection, users would need to manually recreate all their form field mappings after migrating to v2, which is a poor user experience.

Requirements

Automatic version detection

  • On credentials validation (login()), detect whether the account is on Clientify v1 or v2 (e.g. by probing a version-specific endpoint or inspecting the API response).
  • Store the detected version (e.g. as a setting or derived at runtime) so subsequent calls (list_modules, list_fields, create_entry) use the correct API path.

Shared interface

  • Both v1 and v2 must implement the same CRMLIB_Clientify interface: login(), list_modules(), list_fields(), create_entry().
  • Consider splitting the implementation into two internal classes (CRMLIB_Clientify_V1, CRMLIB_Clientify_V2) with a factory/dispatcher in CRMLIB_Clientify that delegates based on the detected version.

Field mapping compatibility

  • Existing v1 field mappings saved in the DB must continue to work without requiring the user to remap fields.
  • If v2 uses different field keys, add a mapping/translation layer so saved v1 mappings can be applied to v2 payloads transparently.

No UX disruption

  • Users already configured on v1 should experience no change.
  • Users on v2 should be able to set up and use the integration without any extra steps beyond entering their credentials.

Acceptance Criteria

  • Plugin detects Clientify API version automatically after saving credentials.
  • Form submissions work correctly for both v1 and v2 accounts.
  • Existing v1 field mappings are honoured without requiring reconfiguration.
  • No HTTP 500 or uncaught errors are thrown for either version.
  • Unit/integration tests cover version detection and both API paths.

Related

Closes #174 (Clientify v2 reverted due to 500 errors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions