@@ -76,7 +76,7 @@ export const createPropertyGroupForContacts = async (accessToken: string) => {
76
76
type : "HubSpot" ,
77
77
logMessage : { message : "Creating contact property group..." } ,
78
78
} ) ;
79
- await setAccessToken ( ) ;
79
+ await authenticateHubspotClient ( ) ;
80
80
try {
81
81
const propertyGroupCreateResponse =
82
82
await hubspotClient . crm . properties . groupsApi . create ( "contact" , {
@@ -98,7 +98,7 @@ export const createPropertyGroupForCompanies = async (accessToken: string) => {
98
98
type : "HubSpot" ,
99
99
logMessage : { message : "Creating company property group..." } ,
100
100
} ) ;
101
- await setAccessToken ( ) ;
101
+ await authenticateHubspotClient ( ) ;
102
102
try {
103
103
const propertyGroupCreateResponse =
104
104
await hubspotClient . crm . properties . groupsApi . create ( "company" , {
@@ -123,7 +123,7 @@ export const createRequiredContactProperty = async (accessToken: string) => {
123
123
type : "HubSpot" ,
124
124
logMessage : { message : "Creating required contact property..." } ,
125
125
} ) ;
126
- await setAccessToken ( ) ;
126
+ await authenticateHubspotClient ( ) ;
127
127
try {
128
128
const propertyCreateResponse =
129
129
await hubspotClient . crm . properties . coreApi . create ( "contact" , {
@@ -151,7 +151,7 @@ export const createContactIdProperty = async (accessToken: string) => {
151
151
type : "HubSpot" ,
152
152
logMessage : { message : "Creating custom contact ID property..." } ,
153
153
} ) ;
154
- await setAccessToken ( ) ;
154
+ await authenticateHubspotClient ( ) ;
155
155
try {
156
156
const propertyCreateResponse =
157
157
await hubspotClient . crm . properties . coreApi . create ( "contact" , {
@@ -181,7 +181,7 @@ export const createCompanyIdProperty = async (accessToken: string) => {
181
181
type : "HubSpot" ,
182
182
logMessage : { message : "Creating custom company ID property..." } ,
183
183
} ) ;
184
- await setAccessToken ( ) ;
184
+ await authenticateHubspotClient ( ) ;
185
185
try {
186
186
const propertyCreateResponse =
187
187
await hubspotClient . crm . properties . coreApi . create ( "company" , {
@@ -258,7 +258,7 @@ export const getHubSpotProperties = async (
258
258
) : Promise < { contactProperties : any ; companyProperties : any } | undefined > => {
259
259
// const propertiesCacheIsValid = await checkPropertiesCache(customerId);
260
260
261
- await setAccessToken ( ) ;
261
+ await authenticateHubspotClient ( ) ;
262
262
263
263
// add DB call to check if we've looked in the last 5 minutes
264
264
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#updatedat
@@ -347,7 +347,7 @@ export const checkForPropertyOrGroup = async (
347
347
type : "HubSpot" ,
348
348
logMessage : { message : `Checking for ${ objectType } ${ isGroupString } ${ propertyName } ` }
349
349
} ) ;
350
- await setAccessToken ( ) ;
350
+ await authenticateHubspotClient ( ) ;
351
351
try {
352
352
if ( propertyOrGroup == 'property' ) {
353
353
getPropertyResponse = await hubspotClient . crm . properties . coreApi . getByNameWithHttpInfo ( objectType , propertyName ) ;
0 commit comments