From ef91b7f53e0d83d560541a48727dce261af7a002 Mon Sep 17 00:00:00 2001 From: Paolo Torricelli Date: Wed, 26 Aug 2026 11:13:14 +0200 Subject: [PATCH 1/6] filter based only on date and not datetime, all leads also readed --- src/fetchLeadsFromKeystone.js | 4 ++-- src/hubspotConnector.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fetchLeadsFromKeystone.js b/src/fetchLeadsFromKeystone.js index 8a08883..ddbd35e 100644 --- a/src/fetchLeadsFromKeystone.js +++ b/src/fetchLeadsFromKeystone.js @@ -12,8 +12,8 @@ async function getLeads(lastRunDate, currentDate, unsent, test) { 'Content-type': 'application/json' }, body: JSON.stringify({ - after: lastRunDate, - before: currentDate, + after: lastRunDate.substring(0, 10), + before: currentDate.substring(0, 10), unsent: unsent, // If this variable is set to 0, then it will show leads that have been marked as seen (old leads) test: test, // If this is removed or set to 0, then all leads that are returned would be marked as seen. This allows you to only fetch new leads }) diff --git a/src/hubspotConnector.js b/src/hubspotConnector.js index 66d664b..9a30cbe 100644 --- a/src/hubspotConnector.js +++ b/src/hubspotConnector.js @@ -148,9 +148,9 @@ async function runConnector() { } try { - console.log('Retrieving data from Keystone...'); + console.log('Retrieving data from Keystone...', lastRunDate, currentDate, isDryRun ); // getLeads(lastRunDate, currentDate, unsent, test) - const unsetValue = 1; + const unsetValue = 0; const testValue = isDryRun ? 1 : 0; const leads = await getLeads(lastRunDate, currentDate, unsetValue, testValue); From cfec0f4b1194305b1782cc2fd43ee3edd2a8661d Mon Sep 17 00:00:00 2001 From: Paolo Torricelli Date: Wed, 26 Aug 2026 11:13:52 +0200 Subject: [PATCH 2/6] uppercase Keystone --- src/hubspotConnector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hubspotConnector.js b/src/hubspotConnector.js index 9a30cbe..7d8ccd7 100644 --- a/src/hubspotConnector.js +++ b/src/hubspotConnector.js @@ -51,7 +51,7 @@ let fields = { return targetCountry.toUpperCase(); },*/ corso_keystone: (lead) => lead.programList?.join('; ') ?? '', - leadsource: () => 'keystone' + leadsource: () => 'Keystone' }; function mapFields(lead) { From d88ccf60325d76a74ee7cb893c2c46ebaba3d41e Mon Sep 17 00:00:00 2001 From: Paolo Torricelli Date: Wed, 26 Aug 2026 11:15:35 +0200 Subject: [PATCH 3/6] lowercase keystone --- src/hubspotConnector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hubspotConnector.js b/src/hubspotConnector.js index 7d8ccd7..9a30cbe 100644 --- a/src/hubspotConnector.js +++ b/src/hubspotConnector.js @@ -51,7 +51,7 @@ let fields = { return targetCountry.toUpperCase(); },*/ corso_keystone: (lead) => lead.programList?.join('; ') ?? '', - leadsource: () => 'Keystone' + leadsource: () => 'keystone' }; function mapFields(lead) { From a1f0dde061c7b2118da06c3315f608410176f1ba Mon Sep 17 00:00:00 2001 From: abertoni Date: Wed, 26 Aug 2026 11:23:02 +0200 Subject: [PATCH 4/6] test user commit --- cfg/hubspot.json | 2 +- logs/output.log | 52 ++++++++++++++++++++++++++++++++++--- src/last-modified-date.json | 2 +- xxx | 0 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 xxx diff --git a/cfg/hubspot.json b/cfg/hubspot.json index 38e304a..2117359 100644 --- a/cfg/hubspot.json +++ b/cfg/hubspot.json @@ -1,7 +1,7 @@ { "token_type": "bearer", "refresh_token": "dfdb8172-1072-4a95-8122-6f4be5dbcbaf", - "access_token": "CNa5muiDNBInQlNQMl8kQEwrAhoACAcCAhICEgkEHgEBAQEBAQEbAQIBLh4BIAEgGI-0ogEgopooKMKUazIUGdB2ITwlGDUOf6qIynbdtFhnp7M6a0JTUDJfJEBMKwNcAAeOAgTLAhP1AgaYAwejAwaBBQaJBggTGRobH4oBiwGQAbsB3gH6AfsB_AGVApYCtgLHAv8DgASEBIUEowSkBKUEpwSoBN0E4QbiBuMGlZoFrO8F3_cFgvkFg_kF_PUIQhSLWuIvSf4oJBL1S034uszxekWSSEoDbmExUgBaAGAAaKKaKHAAeAA", + "access_token": "CPDM2euDNBInQlNQMl8kQEwrAhoACAcCAhICEgkEHgEBAQEBAQEbAQIBLh4BIAEgGI-0ogEgopooKMKUazIUAyadDK38t_Nd7afu92XPlJWNIAo6a0JTUDJfJEBMKwNcAAeOAgTLAhP1AgaYAwejAwaBBQaJBggTGRobH4oBiwGQAbsB3gH6AfsB_AGVApYCtgLHAv8DgASEBIUEowSkBKUEpwSoBN0E4QbiBuMGlZoFrO8F3_cFgvkFg_kF_PUIQhSC4VGhsI_4_JW1pwepVd_QSHEyGEoDbmExUgBaAGAAaKKaKHAAeAA", "hub_id": 2660879, "scopes": [ "crm.lists.read", diff --git a/logs/output.log b/logs/output.log index ee8afea..9cd50e7 100644 --- a/logs/output.log +++ b/logs/output.log @@ -1,4 +1,48 @@ -◇ injected env (0) from .env // tip: ⌘ suppress logs { quiet: true } -Retrieving data from Keystone... -Error fetching the data: Keystone HTTP Error 403 (Forbidden): {"error":"Unauthorized","code":"401","message":"key missmatch"} -Error in processing data: Keystone HTTP Error 403 (Forbidden): {"error":"Unauthorized","code":"401","message":"key missmatch"} +◇ injected env (1) from .env // tip: ◈ secrets for agents [www.dotenvx.com] +Retrieving data from Keystone... 2026-08-26T09:15:46.604Z 2026-08-26T09:16:01.807Z false +DateTime saved successfully in file last-modified-date.json +Data retrieved successfully! +Now Connecting to Hubspot... +getAccessToken +getAccessToken +New access token generated +Hubspot connection is ready! +Connection successful! +Batch successfully created! +{ + "completedAt": "2026-08-26T09:16:05.075Z", + "status": "COMPLETE", + "startedAt": "2026-08-26T09:16:04.941Z", + "results": [ + { + "id": "244396741787", + "properties": { + "corso_keystone": "Italian Culinary Program", + "createdate": "2026-08-26T08:27:10.610Z", + "email": "videeshasawane@gmail.com", + "firstname": "Videesha ", + "hs_full_name_or_email": "Videesha Sawane", + "hs_is_unworked": "true", + "hs_object_id": "244396741787", + "hs_object_source": "INTEGRATION", + "hs_object_source_id": "1755714", + "hs_object_source_label": "INTEGRATION", + "hs_pipeline": "contacts-lifecycle-pipeline", + "hs_v2_date_entered_current_stage": "2026-08-26T08:27:10.610Z", + "hs_v2_time_in_current_stage": "2026-08-26T08:27:10.610Z", + "lastmodifieddate": "2026-08-26T08:34:13.632Z", + "lastname": "Sawane", + "leadsource": "keystone", + "lifecyclestage": "lead", + "phone": "+91 8454046665" + }, + "createdAt": "2026-08-26T08:27:10.610Z", + "updatedAt": "2026-08-26T08:34:13.632Z", + "archived": false, + "url": "https://app.hubspot.com/contacts/2660879/record/0-1/244396741787", + "new": false + } + ] +} +HubSpot Batch Response: Contact/s created successfully! +All contacts have been created! diff --git a/src/last-modified-date.json b/src/last-modified-date.json index c1e3dce..2152033 100644 --- a/src/last-modified-date.json +++ b/src/last-modified-date.json @@ -1,3 +1,3 @@ { - "lastRun": "2026-08-25T14:25:46.866Z" + "lastRun": "2026-08-26T09:16:01.807Z" } \ No newline at end of file diff --git a/xxx b/xxx new file mode 100644 index 0000000..e69de29 From 05f92a6a8f8216ac8ec0312cec0cffc4ef3566a3 Mon Sep 17 00:00:00 2001 From: dqauttrini Date: Wed, 26 Aug 2026 11:41:06 +0200 Subject: [PATCH 5/6] nuovo test commit --- xxx | 1 + 1 file changed, 1 insertion(+) diff --git a/xxx b/xxx index e69de29..acc1291 100644 --- a/xxx +++ b/xxx @@ -0,0 +1 @@ +xxxxxx From ffb5a6a6f923e935a936e82241d74c2fa46223bb Mon Sep 17 00:00:00 2001 From: dquattrini Date: Wed, 26 Aug 2026 11:43:58 +0200 Subject: [PATCH 6/6] remove xxx --- xxx | 1 - 1 file changed, 1 deletion(-) delete mode 100644 xxx diff --git a/xxx b/xxx deleted file mode 100644 index acc1291..0000000 --- a/xxx +++ /dev/null @@ -1 +0,0 @@ -xxxxxx