Skip to content

Commit 8e7d153

Browse files
committed
[Components] Ashby - new components
1 parent 4cb881e commit 8e7d153

File tree

11 files changed

+1001
-7
lines changed

11 files changed

+1001
-7
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import app from "../../ashby.app.mjs";
2+
3+
export default {
4+
key: "ashby-create-application",
5+
name: "Create Application",
6+
description: "Considers a candidate for a job (e.g., when sourcing a candidate for a job posting). [See the documentation](https://developers.ashbyhq.com/reference/applicationcreate)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
readOnlyHint: false,
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
},
14+
props: {
15+
app,
16+
candidateId: {
17+
propDefinition: [
18+
app,
19+
"candidateId",
20+
],
21+
description: "The ID of the candidate to create an application for",
22+
},
23+
jobId: {
24+
propDefinition: [
25+
app,
26+
"jobId",
27+
],
28+
description: "The ID of the job to apply for",
29+
},
30+
interviewPlanId: {
31+
optional: true,
32+
propDefinition: [
33+
app,
34+
"interviewPlanId",
35+
],
36+
},
37+
interviewStageId: {
38+
optional: true,
39+
propDefinition: [
40+
app,
41+
"interviewStageId",
42+
({ interviewPlanId }) => ({
43+
interviewPlanId,
44+
}),
45+
],
46+
},
47+
sourceId: {
48+
optional: true,
49+
propDefinition: [
50+
app,
51+
"sourceId",
52+
],
53+
},
54+
creditedToUserId: {
55+
label: "Credited To User ID",
56+
description: "The ID of the user the application will be credited to",
57+
optional: true,
58+
propDefinition: [
59+
app,
60+
"userId",
61+
],
62+
},
63+
createdAt: {
64+
type: "string",
65+
label: "Created At",
66+
description: "An ISO date string to set the application's createdAt timestamp (e.g., `2024-01-15T10:30:00Z`). Defaults to the current time if not provided.",
67+
optional: true,
68+
},
69+
},
70+
async run({ $ }) {
71+
const {
72+
app,
73+
candidateId,
74+
jobId,
75+
interviewPlanId,
76+
interviewStageId,
77+
sourceId,
78+
creditedToUserId,
79+
createdAt,
80+
} = this;
81+
82+
const response = await app.createApplication({
83+
$,
84+
data: {
85+
candidateId,
86+
jobId,
87+
interviewPlanId,
88+
interviewStageId,
89+
sourceId,
90+
creditedToUserId,
91+
createdAt,
92+
},
93+
});
94+
95+
$.export("$summary", `Successfully created application with ID \`${response.results?.id}\``);
96+
97+
return response;
98+
},
99+
};
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
import app from "../../ashby.app.mjs";
2+
3+
export default {
4+
key: "ashby-create-candidate",
5+
name: "Create Candidate",
6+
description: "Creates a new candidate in Ashby. [See the documentation](https://developers.ashbyhq.com/reference/candidatecreate)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
name: {
17+
propDefinition: [
18+
app,
19+
"name",
20+
],
21+
},
22+
email: {
23+
propDefinition: [
24+
app,
25+
"email",
26+
],
27+
description: "Primary, personal email of the candidate to be created",
28+
},
29+
phoneNumber: {
30+
type: "string",
31+
label: "Phone Number",
32+
description: "Primary, personal phone number of the candidate to be created",
33+
optional: true,
34+
},
35+
linkedInUrl: {
36+
type: "string",
37+
label: "LinkedIn URL",
38+
description: "URL to the candidate's LinkedIn profile. Must be a valid URL.",
39+
optional: true,
40+
},
41+
githubUrl: {
42+
type: "string",
43+
label: "GitHub URL",
44+
description: "URL to the candidate's GitHub profile. Must be a valid URL.",
45+
optional: true,
46+
},
47+
website: {
48+
type: "string",
49+
label: "Website",
50+
description: "URL of the candidate's website. Must be a valid URL.",
51+
optional: true,
52+
},
53+
alternateEmailAddresses: {
54+
type: "string[]",
55+
label: "Alternate Email Addresses",
56+
description: "Array of alternate email addresses to add to the candidate's profile",
57+
optional: true,
58+
},
59+
sourceId: {
60+
propDefinition: [
61+
app,
62+
"sourceId",
63+
],
64+
description: "The source to set on the candidate being created",
65+
optional: true,
66+
},
67+
creditedToUserId: {
68+
propDefinition: [
69+
app,
70+
"userId",
71+
],
72+
label: "Credited To User ID",
73+
description: "The ID of the user the candidate will be credited to",
74+
optional: true,
75+
},
76+
city: {
77+
type: "string",
78+
label: "City",
79+
description: "The city of the candidate's location",
80+
optional: true,
81+
},
82+
region: {
83+
type: "string",
84+
label: "Region",
85+
description: "The region (state, province, etc.) of the candidate's location",
86+
optional: true,
87+
},
88+
country: {
89+
type: "string",
90+
label: "Country",
91+
description: "The country of the candidate's location",
92+
optional: true,
93+
},
94+
},
95+
async run({ $ }) {
96+
const {
97+
app,
98+
email,
99+
name,
100+
phoneNumber,
101+
linkedInUrl,
102+
githubUrl,
103+
website,
104+
alternateEmailAddresses,
105+
sourceId,
106+
creditedToUserId,
107+
city,
108+
region,
109+
country,
110+
} = this;
111+
112+
const response = await app.createCandidate({
113+
$,
114+
data: {
115+
name,
116+
email,
117+
phoneNumber,
118+
linkedInUrl,
119+
githubUrl,
120+
website,
121+
alternateEmailAddresses,
122+
sourceId,
123+
creditedToUserId,
124+
...(city || region || country
125+
? {
126+
location: {
127+
city,
128+
region,
129+
country,
130+
},
131+
}
132+
: undefined
133+
),
134+
},
135+
});
136+
137+
$.export("$summary", "Successfully created candidate");
138+
139+
return response;
140+
},
141+
};
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import app from "../../ashby.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "ashby-create-interview-schedule",
6+
name: "Create Interview Schedule",
7+
description: "Creates a scheduled interview. [See the documentation](https://developers.ashbyhq.com/reference/interviewschedulecreate)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
app,
17+
applicationId: {
18+
propDefinition: [
19+
app,
20+
"applicationId",
21+
],
22+
description: "The ID of the application to schedule an interview for",
23+
},
24+
interviewEvents: {
25+
type: "string[]",
26+
label: "Interview Events",
27+
description: `Array of interview events. Each event should contain:
28+
- **startTime** (string, required): Interview start time in ISO 8601 format (e.g., 2023-01-30T15:00:00.000Z)
29+
- **endTime** (string, required): Interview end time in ISO 8601 format (e.g., 2023-01-30T16:00:00.000Z)
30+
- **interviewers** (array, required): Array of interviewer objects with:
31+
- **email** (string, required): Email address of the interviewer
32+
- **feedbackRequired** (boolean, optional): Whether feedback from this interviewer is required
33+
34+
Example:
35+
\`\`\`json
36+
[
37+
{
38+
"startTime": "2023-01-30T15:00:00.000Z",
39+
"endTime": "2023-01-30T16:00:00.000Z",
40+
"interviewers": [
41+
{
42+
"email": "interview@example.com",
43+
"feedbackRequired": true
44+
}
45+
]
46+
}
47+
]
48+
\`\`\`
49+
`,
50+
},
51+
},
52+
async run({ $ }) {
53+
const {
54+
app,
55+
applicationId,
56+
interviewEvents,
57+
} = this;
58+
59+
const response = await app.createInterviewSchedule({
60+
$,
61+
data: {
62+
applicationId,
63+
interviewEvents: utils.parseJson(interviewEvents),
64+
},
65+
});
66+
67+
$.export("$summary", "Successfully created interview schedule");
68+
69+
return response;
70+
},
71+
};
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import app from "../../ashby.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "ashby-create-offer",
6+
name: "Create Offer",
7+
description: "Creates a new offer. [See the documentation](https://developers.ashbyhq.com/reference/offercreate)",
8+
version: "0.0.1",
9+
type: "action",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: false,
14+
},
15+
props: {
16+
app,
17+
offerProcessId: {
18+
propDefinition: [
19+
app,
20+
"offerProcessId",
21+
],
22+
},
23+
offerFormId: {
24+
type: "string",
25+
label: "Offer Form ID",
26+
description: "The ID of the form associated with the offer. The ID is included in the response of the [offer.start API](https://developers.ashbyhq.com/reference/offerstart).",
27+
},
28+
fieldSubmissions: {
29+
type: "string[]",
30+
label: "Field Submissions",
31+
description: `Array of field submission objects. Each object should contain:
32+
- **path** (string, required): The form field's "path" value
33+
- **value** (string, required): The field value (can be a primitive or complex type depending on field type)
34+
35+
You can find these referebce values in the response of the [offer.start API](https://developers.ashbyhq.com/reference/offerstart).
36+
37+
Each item can be a JSON string or object with the structure:
38+
\`\`\`json
39+
[
40+
{
41+
"path": "96377e55-cd34-49e2-aff0-5870ec102360",
42+
"value": "2025-11-07"
43+
},
44+
{
45+
"path": "ded2358d-443f-484f-91fa-ec7a13de842b",
46+
"value": {
47+
"value": 10000,
48+
"currencyCode": "USD"
49+
}
50+
}
51+
]
52+
\`\`\``,
53+
},
54+
},
55+
async run({ $ }) {
56+
const {
57+
app,
58+
offerProcessId,
59+
offerFormId,
60+
fieldSubmissions,
61+
} = this;
62+
63+
const response = await app.createOffer({
64+
$,
65+
data: {
66+
offerProcessId,
67+
offerFormId,
68+
offerForm: {
69+
fieldSubmissions: utils.parseJson(fieldSubmissions),
70+
},
71+
},
72+
});
73+
74+
$.export("$summary", `Successfully created offer for process ${offerProcessId}`);
75+
76+
return response;
77+
},
78+
};

0 commit comments

Comments
 (0)