forked from NangoHQ/nango
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integrations):integration template for teamtailor (NangoHQ#1748)
## Describe your changes - Added integration template for syncing teamtailor candidates. ## Test The documentation update was reviewed using `npm run docs`, and verification was performed on localhost.
- Loading branch information
1 parent
97a70bb
commit 48dc142
Showing
5 changed files
with
237 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: 'Teamtailor API Integration Template' | ||
sidebarTitle: 'Teamtailor' | ||
--- | ||
|
||
## Get started with the Teamtailor template | ||
|
||
<Card title="How to use integration templates" | ||
href="/understand/concepts/templates" | ||
icon="book-open"> | ||
Learn how to use integration templates in Nango | ||
</Card> | ||
|
||
<Card title="Get the Teamtailor template" | ||
href="https://github.com/NangoHQ/nango/tree/master/integration-templates/teamtailor" | ||
icon="github"> | ||
Get the latest version of the Teamtailor integration template from GitHub | ||
</Card> | ||
|
||
## Need help with the template? | ||
Please reach out in the [Slack community](https://nango.dev/slack), we are very active there and happy to help! |
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,89 @@ | ||
integrations: | ||
teamtailor: | ||
syncs: | ||
teamtailor-candidates: | ||
runs: every 6 hours | ||
description: | | ||
Fetches a list of all candidates from your teamtailor account. | ||
Details: full sync, doesn't track deletes, metadata is not required. | ||
output: TeamtailorCandidate | ||
sync_type: full | ||
endpoint: /teamtailor-candidates/candidates | ||
scopes: | ||
- Admin | ||
models: | ||
TeamtailorCandidate: | ||
id: string | ||
type: string | ||
links: | ||
self: string | ||
attributes: | ||
connected: boolean | ||
consent_future_jobs_at: date | ||
created_at: date | ||
updated_at: date | ||
email: string | ||
facebook_id: string | ||
facebook_profile: string | ||
first_name: string | ||
internal: boolean | ||
last_name: string | ||
linkedin_profile: string | ||
linkedin_uid: string | ||
linkedin_url: string | ||
original_resume: string | ||
phone: string | ||
picture: string | ||
pitch: string | ||
referring_site: string | ||
referring_url: string | ||
referred: boolean | ||
resume: string | ||
sourced: boolean | ||
tags: array | ||
unsubscribed: boolean | ||
relationships: | ||
activities: | ||
links: | ||
self: string | ||
related: string | ||
department: | ||
links: | ||
self: string | ||
related: string | ||
role: | ||
links: | ||
self: string | ||
related: string | ||
regions: | ||
links: | ||
self: string | ||
related: string | ||
job_applications: | ||
links: | ||
self: string | ||
related: string | ||
questions: | ||
links: | ||
self: string | ||
related: string | ||
answers: | ||
links: | ||
self: string | ||
related: string | ||
locations: | ||
links: | ||
self: string | ||
related: string | ||
uploads: | ||
links: | ||
self: string | ||
related: string | ||
custom_field_values: | ||
links: | ||
self: string | ||
related: string | ||
partner_results: | ||
links: | ||
self: string | ||
related: string |
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,38 @@ | ||
import type { NangoSync, TeamtailorCandidate } from './models'; | ||
|
||
export default async function fetchData(nango: NangoSync): Promise<void> { | ||
let totalRecords = 0; | ||
|
||
try { | ||
const endpoint = '/v1/candidates'; | ||
const config = { | ||
paginate: { | ||
type: 'link', | ||
link_path_in_response_body: 'links.next', | ||
limit_name_in_request: 'page[size]', | ||
response_path: 'data', | ||
limit: 100 | ||
} | ||
}; | ||
for await (const candidate of nango.paginate({ ...config, endpoint })) { | ||
const mappedCandidate: TeamtailorCandidate[] = candidate.map(mapCandidate) || []; | ||
|
||
const batchSize: number = mappedCandidate.length; | ||
totalRecords += batchSize; | ||
await nango.log(`Saving batch of ${batchSize} candidate(s) (total candidate(s): ${totalRecords})`); | ||
await nango.batchSave(mappedCandidate, 'TeamtailorCandidate'); | ||
} | ||
} catch (error: any) { | ||
throw new Error(`Error in fetchData: ${error.message}`); | ||
} | ||
} | ||
|
||
function mapCandidate(candidate: any): TeamtailorCandidate { | ||
return { | ||
id: candidate.id, | ||
type: candidate.type, | ||
links: candidate.links, | ||
attributes: candidate.attributes, | ||
relationships: candidate.relationships | ||
}; | ||
} |
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