From 48dc14254ead2f65fc45120376a682124aca34db Mon Sep 17 00:00:00 2001
From: Hassan_Wari <85742599+hassan254-prog@users.noreply.github.com>
Date: Fri, 1 Mar 2024 19:34:20 +0300
Subject: [PATCH] feat(integrations):integration template for teamtailor
(#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.
---
.../integration-templates/teamtailor.mdx | 21 +++++
docs-v2/mint.json | 1 +
integration-templates/teamtailor/nango.yaml | 89 +++++++++++++++++++
.../teamtailor/teamtailor-candidates.ts | 38 ++++++++
packages/shared/flows.yaml | 88 ++++++++++++++++++
5 files changed, 237 insertions(+)
create mode 100644 docs-v2/integrations/integration-templates/teamtailor.mdx
create mode 100644 integration-templates/teamtailor/nango.yaml
create mode 100644 integration-templates/teamtailor/teamtailor-candidates.ts
diff --git a/docs-v2/integrations/integration-templates/teamtailor.mdx b/docs-v2/integrations/integration-templates/teamtailor.mdx
new file mode 100644
index 0000000000..83828ea21f
--- /dev/null
+++ b/docs-v2/integrations/integration-templates/teamtailor.mdx
@@ -0,0 +1,21 @@
+---
+title: 'Teamtailor API Integration Template'
+sidebarTitle: 'Teamtailor'
+---
+
+## Get started with the Teamtailor template
+
+
+ Learn how to use integration templates in Nango
+
+
+
+ Get the latest version of the Teamtailor integration template from GitHub
+
+
+## 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!
\ No newline at end of file
diff --git a/docs-v2/mint.json b/docs-v2/mint.json
index d3a1e1c433..a9c15ed9f6 100644
--- a/docs-v2/mint.json
+++ b/docs-v2/mint.json
@@ -297,6 +297,7 @@
"integrations/integration-templates/pipedrive",
"integrations/integration-templates/salesforce",
"integrations/integration-templates/slack",
+ "integrations/integration-templates/teamtailor",
"integrations/integration-templates/workable",
"integrations/integration-templates/zendesk",
"integrations/integration-templates/zoho-crm"
diff --git a/integration-templates/teamtailor/nango.yaml b/integration-templates/teamtailor/nango.yaml
new file mode 100644
index 0000000000..476c1881f4
--- /dev/null
+++ b/integration-templates/teamtailor/nango.yaml
@@ -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
diff --git a/integration-templates/teamtailor/teamtailor-candidates.ts b/integration-templates/teamtailor/teamtailor-candidates.ts
new file mode 100644
index 0000000000..036bd57f1f
--- /dev/null
+++ b/integration-templates/teamtailor/teamtailor-candidates.ts
@@ -0,0 +1,38 @@
+import type { NangoSync, TeamtailorCandidate } from './models';
+
+export default async function fetchData(nango: NangoSync): Promise {
+ 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
+ };
+}
diff --git a/packages/shared/flows.yaml b/packages/shared/flows.yaml
index 65b3252757..82123efb28 100644
--- a/packages/shared/flows.yaml
+++ b/packages/shared/flows.yaml
@@ -2013,6 +2013,94 @@ integrations:
mobilePhone: string
licenseType: string
language: string
+ 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
workable:
syncs:
workable-candidates: