-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hubspot): [nan-1848] additional hubspot syncs (#42)
## Describe your changes Add hubspot syncs: - deals - includes associations - companies - currency codes - Improved contacts sync with primary company id included which is an association Add hubspot actions: - fetch-account-information - fetch-custom-object ## Issue ticket number and link NAN-1848 ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [x] I added tests, otherwise the reason is: - [x] External API requests have `retries` - [x] Pagination is used where appropriate - [x] The built in `nango.paginate` call is used instead of a `while (true)` loop - [x] Third party requests are NOT parallelized (this can cause issues with rate limits) - [x] If a sync requires metadata the `nango.yaml` has `auto_start: false` - [x] If the sync is a `full` sync then `track_deletes: true` is set
- Loading branch information
1 parent
f201232
commit 25f6f19
Showing
36 changed files
with
13,762 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { NangoAction, Account, ProxyConfiguration } from '../../models'; | ||
import type { HubspotAccountInformation } from '../types'; | ||
|
||
export default async function runAction(nango: NangoAction): Promise<Account> { | ||
const config: ProxyConfiguration = { | ||
// https://developers.hubspot.com/docs/api/settings/account-information-api | ||
endpoint: '/account-info/v3/details', | ||
retries: 10 | ||
}; | ||
|
||
const response = await nango.get<HubspotAccountInformation>(config); | ||
|
||
return { | ||
id: response.data.portalId.toString(), | ||
type: response.data.accountType, | ||
timeZone: response.data.timeZone, | ||
companyCurrency: response.data.companyCurrency, | ||
additionalCurrencies: response.data.additionalCurrencies, | ||
utcOffset: response.data.utcOffset, | ||
utcOffsetMilliseconds: response.data.utcOffsetMilliseconds, | ||
uiDomain: response.data.uiDomain, | ||
dataHostingLocation: response.data.dataHostingLocation | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { NangoAction, CustomObject, ProxyConfiguration } from '../../models'; | ||
|
||
export default async function runAction(nango: NangoAction): Promise<CustomObject> { | ||
const config: ProxyConfiguration = { | ||
// https://developers.hubspot.com/docs/api/crm/crm-custom-objects | ||
endpoint: '/crm-object-schemas/v3/schemas', | ||
retries: 10 | ||
}; | ||
|
||
const response = await nango.get(config); | ||
|
||
return response.data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { NangoSync, ProxyConfiguration, Property } from '../../models'; | ||
|
||
export async function getProperties(nango: NangoSync, entity: string): Promise<string[]> { | ||
const propertyConfig: ProxyConfiguration = { | ||
// https://developers.hubspot.com/docs/api/crm/properties | ||
endpoint: `/crm/v3/properties/${entity}`, | ||
retries: 10 | ||
}; | ||
const response = await nango.get(propertyConfig); | ||
|
||
const properties = response.data.results | ||
.filter((result: Property) => result.hubspotDefined) | ||
.map((result: Property) => { | ||
return result.name; | ||
}); | ||
|
||
return properties; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
10 changes: 10 additions & 0 deletions
10
integrations/hubspot/mocks/companies/Company/batchSave.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
{ | ||
"id": "12100981203", | ||
"createdAt": "2024-05-30T12:50:08.479Z", | ||
"updatedAt": "2024-05-30T12:50:13.203Z", | ||
"name": "Nango", | ||
"domain": "nango.dev", | ||
"archived": false | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
57 changes: 57 additions & 0 deletions
57
integrations/hubspot/mocks/contacts/Contact/batchSave.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[ | ||
{ | ||
"id": "1", | ||
"created_at": "2022-12-22T08:54:46.103Z", | ||
"updated_at": "2023-10-30T00:16:59.063Z", | ||
"first_name": "Maria", | ||
"last_name": "Johnson (Sample Contact)", | ||
"email": "emailmaria@hubspot.com", | ||
"active": true | ||
}, | ||
{ | ||
"id": "51", | ||
"created_at": "2022-12-22T08:54:46.403Z", | ||
"updated_at": "2023-10-30T00:18:35.221Z", | ||
"first_name": "Brian", | ||
"last_name": "Halligan (Sample Contact)", | ||
"email": "bh@hubspot.com", | ||
"active": true | ||
}, | ||
{ | ||
"id": "151", | ||
"created_at": "2023-10-24T14:48:35.251Z", | ||
"updated_at": "2023-10-30T00:17:22.573Z", | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
"email": "john@some-email.com", | ||
"active": true | ||
}, | ||
{ | ||
"id": "201", | ||
"created_at": "2023-10-25T11:08:26.814Z", | ||
"updated_at": "2024-01-16T13:13:51.418Z", | ||
"first_name": "John", | ||
"last_name": "NangoTest", | ||
"email": "john+yo@some-email.com", | ||
"active": true | ||
}, | ||
{ | ||
"id": "251", | ||
"created_at": "2023-10-25T14:04:18.164Z", | ||
"updated_at": "2024-07-26T18:45:12.900Z", | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
"email": "john+update_2@some-email.com", | ||
"active": true | ||
}, | ||
{ | ||
"id": "301", | ||
"created_at": "2023-11-10T11:18:58.562Z", | ||
"updated_at": "2024-10-08T22:10:33.883Z", | ||
"first_name": "Christopher L.", | ||
"last_name": "Johnson", | ||
"email": "chris.johnson@some-email.com", | ||
"active": true, | ||
"primaryCompanyId": "12100981203" | ||
} | ||
] |
1 change: 1 addition & 0 deletions
1
integrations/hubspot/mocks/currency-codes/CurrencyCode/batchDelete.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
Oops, something went wrong.