From 14b5f4f7ce1f7d6f264587a223cde13e1630bbfd Mon Sep 17 00:00:00 2001 From: Mit Suthar Date: Sat, 16 Mar 2024 07:27:52 +0000 Subject: [PATCH] Sync contacts --- .../src/crm/contact/services/attio/index.ts | 24 ++++++++++++------- packages/shared/src/utils.ts | 5 ++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/api/src/crm/contact/services/attio/index.ts b/packages/api/src/crm/contact/services/attio/index.ts index c7e397e5a..b8d1e7a10 100644 --- a/packages/api/src/crm/contact/services/attio/index.ts +++ b/packages/api/src/crm/contact/services/attio/index.ts @@ -80,14 +80,22 @@ export class AttioService implements IContactService { provider_slug: 'attio', }, }); - const resp = await axios.get(`https://api.attio.com/v2/objects/people/records/query`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }); + console.log("Before Axios") + console.log(this.cryptoService.decrypt(connection.access_token)) + + const resp = await axios.post(`https://api.attio.com/v2/objects/people/records/query`, {}, + { + headers: { + accept: 'application/json', + 'Content-Type': 'application/json', + Authorization: `Bearer ${this.cryptoService.decrypt(connection.access_token)}`, + }, + } + + + ); + + console.log("After Axios") return { data: resp.data.data, diff --git a/packages/shared/src/utils.ts b/packages/shared/src/utils.ts index 955d1a50d..6ccff8454 100644 --- a/packages/shared/src/utils.ts +++ b/packages/shared/src/utils.ts @@ -17,15 +17,16 @@ type ProvidersConfig = { export const providersConfig: ProvidersConfig = { 'crm': { + // Add client id in their respective crm 'hubspot': { - clientId: 'clientid', + clientId: 'Add hubspot requested client id', scopes: 'crm.objects.contacts.read crm.objects.contacts.write crm.schemas.deals.read crm.schemas.deals.write crm.objects.deals.read crm.objects.deals.write crm.objects.companies.read crm.objects.companies.write crm.objects.owners.read settings.users.read settings.users.write settings.users.teams.read settings.users.teams.write', authBaseUrl: 'https://app-eu1.hubspot.com/oauth/authorize', logoPath: "https://assets-global.website-files.com/6421a177cdeeaf3c6791b745/64d61202dd99e63d40d446f6_hubspot%20logo.png", description: "Sync & Create contacts, deals, companies, notes, engagements, stages, tasks and users" }, 'attio': { - clientId: 'clientid', + clientId: '', scopes: 'record_permission:read', authBaseUrl: 'https://app.attio.com/authorize', logoPath: "https://assets-global.website-files.com/6421a177cdeeaf3c6791b745/64d61202dd99e63d40d446f6_hubspot%20logo.png",