Add GoHighLevel CRM sync for tenant locations.

Warehouse leads/deals from GHL contacts and opportunities so Métricas and CRM can use the same scorecard as Clientify.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-10-06 11:57:02 +02:00
parent fb8adab162
commit 487e2c7a2b
12 changed files with 603 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ import {
superhumanConfigured,
} from '@/lib/superhuman-docs';
import { syncAllClientifyTenants } from '@/lib/clientify-sync';
import { syncAllGhlTenants } from '@/lib/gohighlevel-sync';
export const dynamic = 'force-dynamic';
export const maxDuration = 300;
@@ -92,12 +93,16 @@ export async function GET(req: NextRequest) {
// 4) Clientify CRM → leads/deals
try {
const crm = await syncAllClientifyTenants();
const [clientify, gohighlevel] = await Promise.all([
syncAllClientifyTenants(),
syncAllGhlTenants(),
]);
const results = [...clientify.results, ...gohighlevel.results];
out.crm = {
ok: true,
synced: crm.results.filter((r) => !r.error).length,
withErrors: crm.results.filter((r) => r.error).length,
results: crm.results,
synced: results.filter((r) => !r.error).length,
withErrors: results.filter((r) => r.error).length,
results,
};
} catch (e) {
out.crm = {