1 | |
2 | |
3 | * Add New Candidate |
4 | * Add a new candidate application to a job opening. The owner of the API key used must have access to ATS settings. |
5 | */ |
6 | export async function main(auth: RT.BambooHr, body: Body) { |
7 | const url = new URL( |
8 | `https://${auth.companyDomain}.bamboohr.com/api/v1/applicant_tracking/application` |
9 | ) |
10 |
|
11 | const formData = new FormData() |
12 | for (const [k, v] of Object.entries(body)) { |
13 | if (v !== undefined && v !== '') { |
14 | formData.append(k, String(v)) |
15 | } |
16 | } |
17 | const response = await fetch(url, { |
18 | method: 'POST', |
19 | headers: { |
20 | Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`) |
21 | }, |
22 | body: formData |
23 | }) |
24 | if (!response.ok) { |
25 | const text = await response.text() |
26 | throw new Error(`${response.status} ${text}`) |
27 | } |
28 | return await response.json() |
29 | } |
30 |
|
31 | |
32 | |
33 | * This file was automatically generated by json-schema-to-typescript. |
34 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
35 | * and run json-schema-to-typescript to regenerate this file. |
36 | */ |
37 |
|
38 | export interface Body { |
39 | |
40 | * The first name of the candidate. |
41 | */ |
42 | firstName: string |
43 | |
44 | * The last name of the candidate. |
45 | */ |
46 | lastName: string |
47 | |
48 | * The email address of the candidate. |
49 | */ |
50 | email?: string |
51 | |
52 | * The phone number of the candidate. |
53 | */ |
54 | phoneNumber?: string |
55 | |
56 | * The source of the candidate application, e.g. LinkedIn, Indeed, etc. |
57 | */ |
58 | source?: string |
59 | |
60 | * The id of the job opening for the candidate application. |
61 | */ |
62 | jobId: number |
63 | |
64 | * The street address of the candidate. |
65 | */ |
66 | address?: string |
67 | |
68 | * The city of the candidate. |
69 | */ |
70 | city?: string |
71 | |
72 | * The state or province of the candidate. Accepts state name, abbreviation, or ISO code. |
73 | */ |
74 | state?: string |
75 | |
76 | * The zip code or postal code of the candidate. |
77 | */ |
78 | zip?: string |
79 | |
80 | * The country of the candidate. Accepts country name or ISO code. |
81 | */ |
82 | country?: string |
83 | |
84 | * The LinkedIn profile url of the candidate. |
85 | */ |
86 | linkedinUrl?: string |
87 | |
88 | * The available start date of the candidate with the format YYYY-MM-DD. |
89 | */ |
90 | dateAvailable?: string |
91 | |
92 | * The desired salary of the candidate. |
93 | */ |
94 | desiredSalary?: string |
95 | |
96 | * The person or entity that referred the candidate. |
97 | */ |
98 | referredBy?: string |
99 | |
100 | * The personal website, blog, or online portfolio of the candidate. |
101 | */ |
102 | websiteUrl?: string |
103 | |
104 | * The highest completed education level of the candidate. |
105 | */ |
106 | highestEducation?: |
107 | | 'GED or Equivalent' |
108 | | 'High School' |
109 | | 'Some College' |
110 | | 'College - Associates' |
111 | | 'College - Bachelor of Arts' |
112 | | 'College - Bachelor of Fine Arts' |
113 | | 'College - Bachelor of Science' |
114 | | 'College - Master of Arts' |
115 | | 'College - Master of Fine Arts' |
116 | | 'College - Master of Science' |
117 | | 'College - Master of Business Administration' |
118 | | 'College - Doctorate' |
119 | | 'Medical Doctor' |
120 | | 'Other' |
121 | |
122 | * The college or university of the candidate. |
123 | */ |
124 | collegeName?: string |
125 | |
126 | * A list of references supplied by the candidate. |
127 | */ |
128 | references?: string |
129 | |
130 | * Resume of the candidate. |
131 | */ |
132 | resume?: string |
133 | |
134 | * Cover letter of the candidate. |
135 | */ |
136 | coverLetter?: string |
137 | [k: string]: unknown |
138 | } |
139 |
|