From a84b0985d3500d3190a1b4c255cba23254298fbb Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 27 Aug 2025 13:33:59 -0400 Subject: [PATCH 1/2] new components --- .../add-application-comment.mjs | 35 ++++++ .../download-resume/download-resume.mjs | 57 +++++++++ .../get-application/get-application.mjs | 26 ++++ .../list-applications/list-applications.mjs | 93 ++++++++++++++ .../update-application-status.mjs | 35 ++++++ components/bamboohr/bamboohr.app.mjs | 116 +++++++++++++++++- components/bamboohr/common/constants.mjs | 35 ++++++ components/bamboohr/package.json | 2 +- 8 files changed, 394 insertions(+), 5 deletions(-) create mode 100644 components/bamboohr/actions/add-application-comment/add-application-comment.mjs create mode 100644 components/bamboohr/actions/download-resume/download-resume.mjs create mode 100644 components/bamboohr/actions/get-application/get-application.mjs create mode 100644 components/bamboohr/actions/list-applications/list-applications.mjs create mode 100644 components/bamboohr/actions/update-application-status/update-application-status.mjs create mode 100644 components/bamboohr/common/constants.mjs diff --git a/components/bamboohr/actions/add-application-comment/add-application-comment.mjs b/components/bamboohr/actions/add-application-comment/add-application-comment.mjs new file mode 100644 index 0000000000000..1bd413d2cd1ba --- /dev/null +++ b/components/bamboohr/actions/add-application-comment/add-application-comment.mjs @@ -0,0 +1,35 @@ +import bamboohr from "../../bamboohr.app.mjs"; + +export default { + key: "bamboohr-add-application-comment", + name: "Add Application Comment", + description: "Add a comment to an application. [See the documentation](https://documentation.bamboohr.com/reference/post-application-comment-1)", + version: "0.0.1", + type: "action", + props: { + bamboohr, + applicationId: { + propDefinition: [ + bamboohr, + "applicationId", + ], + }, + comment: { + type: "string", + label: "Comment", + description: "The comment to add to the application", + }, + }, + async run({ $ }) { + const response = await this.bamboohr.addApplicationComment({ + $, + applicationId: this.applicationId, + data: { + comment: this.comment, + type: "comment", + }, + }); + $.export("$summary", `Added comment to application ${this.applicationId}`); + return response; + }, +}; diff --git a/components/bamboohr/actions/download-resume/download-resume.mjs b/components/bamboohr/actions/download-resume/download-resume.mjs new file mode 100644 index 0000000000000..a722e09ac7d5a --- /dev/null +++ b/components/bamboohr/actions/download-resume/download-resume.mjs @@ -0,0 +1,57 @@ +import bamboohr from "../../bamboohr.app.mjs"; +import fs from "fs"; +import { ConfigurationError } from "@pipedream/platform"; + +export default { + key: "bamboohr-download-resume", + name: "Download Resume", + description: "Download a resume from an application. [See the documentation](https://documentation.bamboohr.com/reference/get-company-file)", + version: "0.0.1", + type: "action", + props: { + bamboohr, + applicationId: { + propDefinition: [ + bamboohr, + "applicationId", + ], + }, + filename: { + type: "string", + label: "Filename", + description: "The filename to save the downloaded file as in the `/tmp` directory", + }, + syncDir: { + type: "dir", + accessMode: "write", + sync: true, + }, + }, + async run({ $ }) { + const { resumeFileId } = await this.bamboohr.getApplication({ + $, + applicationId: this.applicationId, + }); + + if (!resumeFileId) { + throw new ConfigurationError("No resume file ID found for application"); + } + + const response = await this.bamboohr.downloadFile({ + $, + fileId: resumeFileId, + }); + + const rawcontent = response.toString("base64"); + const buffer = Buffer.from(rawcontent, "base64"); + const downloadedFilepath = `/tmp/${this.filename}`; + fs.writeFileSync(downloadedFilepath, buffer); + + $.export("$summary", `Downloaded resume for application ${this.applicationId}`); + + return { + filename: this.filename, + downloadedFilepath, + }; + }, +}; diff --git a/components/bamboohr/actions/get-application/get-application.mjs b/components/bamboohr/actions/get-application/get-application.mjs new file mode 100644 index 0000000000000..85ec41103cd0c --- /dev/null +++ b/components/bamboohr/actions/get-application/get-application.mjs @@ -0,0 +1,26 @@ +import bamboohr from "../../bamboohr.app.mjs"; + +export default { + key: "bamboohr-get-application", + name: "Get Application", + description: "Get the details of an application. [See the documentation](https://documentation.bamboohr.com/reference/get-application-details-1)", + version: "0.0.1", + type: "action", + props: { + bamboohr, + applicationId: { + propDefinition: [ + bamboohr, + "applicationId", + ], + }, + }, + async run({ $ }) { + const response = await this.bamboohr.getApplication({ + $, + applicationId: this.applicationId, + }); + $.export("$summary", `Found application ${this.applicationId}`); + return response; + }, +}; diff --git a/components/bamboohr/actions/list-applications/list-applications.mjs b/components/bamboohr/actions/list-applications/list-applications.mjs new file mode 100644 index 0000000000000..0f6c2dd33db07 --- /dev/null +++ b/components/bamboohr/actions/list-applications/list-applications.mjs @@ -0,0 +1,93 @@ +import bamboohr from "../../bamboohr.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + key: "bamboohr-list-applications", + name: "List Applications", + description: "List all applications. [See the documentation](https://documentation.bamboohr.com/reference/get-applications)", + version: "0.0.1", + type: "action", + props: { + bamboohr, + jobId: { + propDefinition: [ + bamboohr, + "jobId", + ], + }, + statusId: { + propDefinition: [ + bamboohr, + "statusId", + ], + optional: true, + }, + statusGroup: { + type: "string", + label: "Status Group", + description: "The group of statuses to filter by", + options: constants.APPLICATION_STATUS_GROUPS, + optional: true, + }, + jobStatusGroup: { + type: "string", + label: "Job Status Group", + description: "The group of job statuses to filter by", + options: constants.JOB_STATUS_GROUPS, + optional: true, + }, + searchString: { + type: "string", + label: "Search String", + description: "A general search criteria by which to find applications", + optional: true, + }, + sortBy: { + type: "string", + label: "Sort By", + description: "The field to sort by", + options: constants.APPLICATION_SORT_FIELDS, + optional: true, + }, + sortOrder: { + type: "string", + label: "Sort Order", + description: "The order in which to sort the results", + options: [ + "ASC", + "DESC", + ], + optional: true, + }, + newSince: { + type: "string", + label: "New Since", + description: "Only get applications newer than a given UTC timestamp, for example `2024-01-01 13:00:00`", + optional: true, + }, + page: { + type: "integer", + label: "Page", + description: "The page number to return", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.bamboohr.listApplications({ + $, + params: { + jobId: this.jobId, + applicationStatusId: this.statusId, + applicationStatus: this.statusGroup, + jobStatusGroups: this.jobStatusGroup, + searchString: this.searchString, + sortBy: this.sortBy, + sortOrder: this.sortOrder, + newSince: this.newSince, + page: this.page, + }, + }); + $.export("$summary", `Found ${response.applications.length} applications`); + return response; + }, +}; diff --git a/components/bamboohr/actions/update-application-status/update-application-status.mjs b/components/bamboohr/actions/update-application-status/update-application-status.mjs new file mode 100644 index 0000000000000..c3a37f2a72c3c --- /dev/null +++ b/components/bamboohr/actions/update-application-status/update-application-status.mjs @@ -0,0 +1,35 @@ +import bamboohr from "../../bamboohr.app.mjs"; + +export default { + key: "bamboohr-update-application-status", + name: "Update Application Status", + description: "Update the status of an application. [See the documentation](https://documentation.bamboohr.com/reference/post-applicant-status-1)", + version: "0.0.1", + type: "action", + props: { + bamboohr, + applicationId: { + propDefinition: [ + bamboohr, + "applicationId", + ], + }, + statusId: { + propDefinition: [ + bamboohr, + "statusId", + ], + }, + }, + async run({ $ }) { + const response = await this.bamboohr.updateApplicationStatus({ + $, + applicationId: this.applicationId, + data: { + status: this.statusId, + }, + }); + $.export("$summary", "Updated status of application."); + return response; + }, +}; diff --git a/components/bamboohr/bamboohr.app.mjs b/components/bamboohr/bamboohr.app.mjs index 923dd7fd5655f..2a4b083bdb43f 100644 --- a/components/bamboohr/bamboohr.app.mjs +++ b/components/bamboohr/bamboohr.app.mjs @@ -1,11 +1,119 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "bamboohr", - propDefinitions: {}, + propDefinitions: { + applicationId: { + type: "string", + label: "Application ID", + description: "The ID of an application", + async options({ page }) { + const { applications } = await this.listApplications({ + params: { + page: page + 1, + }, + }); + return applications?.map((application) => ({ + label: `${application.applicant.firstName} ${application.applicant.lastName}`, + value: application.id, + })) || []; + }, + }, + jobId: { + type: "string", + label: "Job ID", + description: "The ID of a job", + optional: true, + async options() { + const jobs = await this.listJobs(); + return jobs?.map((job) => ({ + label: job.title.label, + value: job.id, + })) || []; + }, + }, + statusId: { + type: "string", + label: "Status ID", + description: "The ID of a job status", + async options() { + const statuses = await this.listStatuses(); + return statuses?.map((status) => ({ + label: status.name, + value: status.id, + })) || []; + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return `https://api.bamboohr.com/api/gateway.php/${this.$auth.company_domain}/v1`; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + auth: { + username: `${this.$auth.api_key}`, + password: "x", + }, + ...opts, + }); + }, + getApplication({ + applicationId, ...opts + }) { + return this._makeRequest({ + path: `/applicant_tracking/applications/${applicationId}`, + ...opts, + }); + }, + listApplications(opts = {}) { + return this._makeRequest({ + path: "/applicant_tracking/applications", + ...opts, + }); + }, + listJobs(opts = {}) { + return this._makeRequest({ + path: "/applicant_tracking/jobs", + ...opts, + }); + }, + listStatuses(opts = {}) { + return this._makeRequest({ + path: "/applicant_tracking/statuses", + ...opts, + }); + }, + addApplicationComment({ + applicationId, ...opts + }) { + return this._makeRequest({ + path: `/applicant_tracking/applications/${applicationId}/comments`, + method: "POST", + ...opts, + }); + }, + updateApplicationStatus({ + applicationId, ...opts + }) { + return this._makeRequest({ + path: `/applicant_tracking/applications/${applicationId}/status`, + method: "POST", + ...opts, + }); + }, + downloadFile({ + fileId, ...opts + }) { + return this._makeRequest({ + path: `/files/${fileId}`, + responseType: "arraybuffer", + ...opts, + }); }, }, }; diff --git a/components/bamboohr/common/constants.mjs b/components/bamboohr/common/constants.mjs new file mode 100644 index 0000000000000..816bbc6b65517 --- /dev/null +++ b/components/bamboohr/common/constants.mjs @@ -0,0 +1,35 @@ +const APPLICATION_STATUS_GROUPS = [ + "ALL", + "ALL_ACTIVE", + "NEW", + "ACTIVE", + "INACTIVE", + "HIRED", +]; + +const JOB_STATUS_GROUPS = [ + "ALL", + "DRAFT_AND_OPEN", + "Open", + "Filled", + "Draft", + "Deleted", + "On Hold", + "Canceled", +]; + +const APPLICATION_SORT_FIELDS = [ + "first_name", + "job_title", + "rating", + "phone", + "status", + "last_updated", + "created_date", +]; + +export default { + APPLICATION_STATUS_GROUPS, + JOB_STATUS_GROUPS, + APPLICATION_SORT_FIELDS, +}; diff --git a/components/bamboohr/package.json b/components/bamboohr/package.json index a59711aa7bfd2..8e7ada15ae2c5 100644 --- a/components/bamboohr/package.json +++ b/components/bamboohr/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/bamboohr", - "version": "0.6.0", + "version": "0.7.0", "description": "Pipedream bamboohr Components", "main": "bamboohr.app.mjs", "keywords": [ From a6887ecc7f64f7f0e49a2260fba535dd12b14c22 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 27 Aug 2025 13:34:57 -0400 Subject: [PATCH 2/2] pnpm-lock.yaml --- pnpm-lock.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b9f7515fed9bc..6d7058bcaf9cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1626,8 +1626,7 @@ importers: components/bill: {} - components/billbee: - specifiers: {} + components/billbee: {} components/billplz: {} @@ -3456,8 +3455,7 @@ importers: components/danny_test_app: {} - components/dante_ai: - specifiers: {} + components/dante_ai: {} components/dappier: {}