Skip to content

Commit c14fabb

Browse files
committed
fix(ashby): address PR review feedback - paramVisibility, stageType, json catch
- Add paramVisibility: 'user-only' to apiKey extra field - Remove stageType from candidateStageChange/candidateHire outputs (TriggerOutput type conflict with 'type' field) - Add .catch() fallback to .json() parse in createAshbyWebhookSubscription - Fix candidateStageChange outputs to match actual Ashby application payload structure
1 parent aba787e commit c14fabb

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

apps/sim/lib/webhooks/provider-subscriptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,7 @@ export async function createAshbyWebhookSubscription(
22242224
body: JSON.stringify(requestBody),
22252225
})
22262226

2227-
const responseBody = await ashbyResponse.json()
2227+
const responseBody = await ashbyResponse.json().catch(() => ({}))
22282228

22292229
if (!ashbyResponse.ok || !responseBody.success) {
22302230
const errorMessage =

apps/sim/triggers/ashby/utils.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export function buildAshbyExtraFields(triggerId: string): SubBlockConfig[] {
4747
description: 'Required to create the webhook in Ashby. Must have apiKeysWrite permission.',
4848
password: true,
4949
required: true,
50+
paramVisibility: 'user-only',
5051
mode: 'trigger',
5152
condition: { field: 'selectedTriggerId', value: triggerId },
5253
},
@@ -87,36 +88,37 @@ export function buildApplicationSubmitOutputs(): Record<string, TriggerOutput> {
8788

8889
/**
8990
* Build outputs for candidateStageChange events.
90-
* Payload: { action, data: { candidate: { id, firstName, lastName, email },
91-
* application: { id, stage: { id, name } },
92-
* stageChange: { fromStage: { id, name }, toStage: { id, name }, changedAt } } }
91+
* Payload matches the application object structure (same as applicationUpdate).
92+
* Payload: { action, data: { application: { id, createdAt, updatedAt, status,
93+
* candidate: { id, name }, currentInterviewStage: { id, title, type },
94+
* job: { id, title } } } }
9395
*/
9496
export function buildCandidateStageChangeOutputs(): Record<string, TriggerOutput> {
9597
return {
9698
...coreOutputs,
97-
candidate: {
98-
id: { type: 'string', description: 'Candidate UUID' },
99-
firstName: { type: 'string', description: 'Candidate first name' },
100-
lastName: { type: 'string', description: 'Candidate last name' },
101-
email: { type: 'string', description: 'Candidate email address' },
102-
},
10399
application: {
104100
id: { type: 'string', description: 'Application UUID' },
105-
stage: {
106-
id: { type: 'string', description: 'Current stage UUID' },
107-
name: { type: 'string', description: 'Current stage name' },
101+
createdAt: { type: 'string', description: 'Application creation timestamp (ISO 8601)' },
102+
updatedAt: {
103+
type: 'string',
104+
description: 'Application last update timestamp (ISO 8601)',
108105
},
109-
},
110-
stageChange: {
111-
fromStage: {
112-
id: { type: 'string', description: 'Previous stage UUID' },
113-
name: { type: 'string', description: 'Previous stage name' },
106+
status: {
107+
type: 'string',
108+
description: 'Application status (Active, Hired, Archived, Lead)',
114109
},
115-
toStage: {
116-
id: { type: 'string', description: 'New stage UUID' },
117-
name: { type: 'string', description: 'New stage name' },
110+
candidate: {
111+
id: { type: 'string', description: 'Candidate UUID' },
112+
name: { type: 'string', description: 'Candidate name' },
113+
},
114+
currentInterviewStage: {
115+
id: { type: 'string', description: 'Current interview stage UUID' },
116+
title: { type: 'string', description: 'Current interview stage title' },
117+
},
118+
job: {
119+
id: { type: 'string', description: 'Job UUID' },
120+
title: { type: 'string', description: 'Job title' },
118121
},
119-
changedAt: { type: 'string', description: 'Stage change timestamp' },
120122
},
121123
} as Record<string, TriggerOutput>
122124
}
@@ -145,7 +147,6 @@ export function buildCandidateHireOutputs(): Record<string, TriggerOutput> {
145147
currentInterviewStage: {
146148
id: { type: 'string', description: 'Current interview stage UUID' },
147149
title: { type: 'string', description: 'Current interview stage title' },
148-
stageType: { type: 'string', description: 'Interview stage type' },
149150
},
150151
job: {
151152
id: { type: 'string', description: 'Job UUID' },

0 commit comments

Comments
 (0)