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:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user