Skip to content

Migrate Clientify integration from API v1 to API v2#164

Merged
davidperezgar merged 11 commits intotrunkfrom
cursor/clientify-api-v2-migraci-n-de01
Mar 16, 2026
Merged

Migrate Clientify integration from API v1 to API v2#164
davidperezgar merged 11 commits intotrunkfrom
cursor/clientify-api-v2-migraci-n-de01

Conversation

@davidperezgar
Copy link
Contributor

@davidperezgar davidperezgar commented Mar 3, 2026

Migrates the Clientify CRM integration from the legacy API v1 to the new API v2 (api-plus.clientify.com/v2). This update includes endpoint changes, schema updates, and several fixes for reliability and data integrity.

Fixes #163.

Changes

  • API v2 migration — Updated all Clientify endpoints: login via me/, custom fields now filter by object_type, deal creation uses ID-based references with inline products following the v2 schema
  • marketing_status default — Contacts now default to marketing_status = 2 (Marketing Contact) when the field is not explicitly set, avoiding API rejections on contact creation
  • Pipeline improvements — Support for pipeline ID/stage name resolution and pipeline_desc field mapping
  • Email Main / Phone Main — Added support for Email Main and Phone Main field type mapping
  • HTTP method fix — Replaced incorrect HTTP verbs with wp_remote_request() using PUT; unified response handling via wp_remote_retrieve_body() for error paths
  • GravityForms widget fix — Resolved a bug where leads were being sent twice when viewing or editing an existing entry
  • Code cleanup — Removed redundant blank lines and applied DRY refactoring across the Clientify class
  • readme.txt — Updated changelog for version 4.3.2 with clarification that marketing_status defaults to Marketing Contact (2)

Benefits

  • Compatibility with Clientify's current API v2, preventing broken connections for all users
  • Contacts are created successfully even when marketing_status is not explicitly configured in the feed
  • Reduced risk of duplicate CRM submissions from GravityForms entry edits
  • Cleaner, more maintainable codebase via DRY improvements

Testing Instructions

  1. Go to WordPress Admin → FormsCRM → Settings and enter valid Clientify API v2 credentials
  2. Open a form (e.g. Gravity Forms) with a Clientify feed configured
  3. Submit the form and verify the contact is created in Clientify under the Marketing Contact status
  4. Edit an existing GravityForms entry and confirm no duplicate lead is sent to Clientify
  5. Create a feed with pipeline mapping and verify the deal is created with the correct pipeline ID and stage
  6. Submit a form without marketing_status explicitly mapped — confirm it defaults to Marketing Contact (2) in Clientify

Checklist

  • Code follows WordPress Coding Standards
  • Self-reviewed the code
  • Added necessary comments
  • No new linter errors

Co-authored-by: David Perez <davidperezgar@gmail.com>
@cursor
Copy link

cursor bot commented Mar 3, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@davidperezgar davidperezgar marked this pull request as ready for review March 3, 2026 15:54
cursoragent and others added 7 commits March 3, 2026 16:09
- Update base URL from api.clientify.net/v1 to api-plus.clientify.com/v2
- Update login endpoint from settings/my-account/ to me/
- Update custom fields to use ?object_type= filter parameter
- Update deal creation to use contact_id/company_id instead of URL refs
- Include products inline in deal creation payload (v2 format)
- Add pipeline_id, pipeline_desc, pipeline_stage_desc deal fields
- Add Email Main (type 4) and Phone Main (type 1) from v2 API
- Fix PUT method: use wp_remote_request() instead of wp_remote_post()
- Fix error body access: use wp_remote_retrieve_body() consistently
- Fix pipeline field mismatch (pipeline_desc now maps correctly)
- Update product format to use product_id + price (v2 schema)
- Update test mock data to match v2 response formats
- Add new tests: v2 types, deal fields, contact/deal creation

Closes #163

Co-authored-by: David Perez <davidperezgar@gmail.com>
Co-authored-by: David Perez <davidperezgar@gmail.com>
Co-authored-by: David Perez <davidperezgar@gmail.com>
@davidperezgar davidperezgar changed the title Clientify API v2 migración Migrate Clientify integration from API v1 to API v2 Mar 16, 2026
@davidperezgar davidperezgar merged commit 687a1ff into trunk Mar 16, 2026
6 checks passed
@davidperezgar davidperezgar deleted the cursor/clientify-api-v2-migraci-n-de01 branch March 16, 2026 15:24
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.

Migrate Clientify Integration from API v1 to API v2

2 participants