Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
},
};
57 changes: 57 additions & 0 deletions components/bamboohr/actions/download-resume/download-resume.mjs
Original file line number Diff line number Diff line change
@@ -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,
};
},
};
26 changes: 26 additions & 0 deletions components/bamboohr/actions/get-application/get-application.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
Original file line number Diff line number Diff line change
@@ -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;
},
};
Original file line number Diff line number Diff line change
@@ -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;
},
};
116 changes: 112 additions & 4 deletions components/bamboohr/bamboohr.app.mjs
Original file line number Diff line number Diff line change
@@ -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,
});
},
},
};
Loading
Loading