Skip to content

Commit 851c2c9

Browse files
committed
fix(fathom): address PR review feedback
- Add response.ok checks to all 5 tool transformResponse functions - Fix include_summary default to respect explicit false (check undefined) - Add externalId validation before URL interpolation in webhook deletion
1 parent 8592fe0 commit 851c2c9

File tree

6 files changed

+78
-3
lines changed

6 files changed

+78
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,14 @@ export async function deleteFathomWebhook(webhook: any, requestId: string): Prom
817817
return
818818
}
819819

820+
const idValidation = validateAlphanumericId(externalId, 'Fathom webhook ID', 100)
821+
if (!idValidation.isValid) {
822+
fathomLogger.warn(
823+
`[${requestId}] Invalid externalId format for Fathom webhook deletion ${webhook.id}, skipping cleanup`
824+
)
825+
return
826+
}
827+
820828
const fathomApiUrl = `https://api.fathom.ai/external/v1/webhooks/${externalId}`
821829

822830
const fathomResponse = await fetch(fathomApiUrl, {
@@ -1391,12 +1399,10 @@ export async function createFathomWebhookSubscription(
13911399

13921400
const triggeredForValue = triggeredFor || 'my_recordings'
13931401

1394-
const hasInclude =
1395-
includeSummary || includeTranscript || includeActionItems || includeCrmMatches
13961402
const requestBody: Record<string, any> = {
13971403
destination_url: notificationUrl,
13981404
triggered_for: [triggeredForValue],
1399-
include_summary: hasInclude ? Boolean(includeSummary) : true,
1405+
include_summary: includeSummary !== undefined ? Boolean(includeSummary) : true,
14001406
include_transcript: Boolean(includeTranscript),
14011407
include_action_items: Boolean(includeActionItems),
14021408
include_crm_matches: Boolean(includeCrmMatches),

apps/sim/tools/fathom/get_summary.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ export const getSummaryTool: ToolConfig<FathomGetSummaryParams, FathomGetSummary
3333
},
3434

3535
transformResponse: async (response: Response) => {
36+
if (!response.ok) {
37+
const errorData = await response.json().catch(() => ({}))
38+
return {
39+
success: false,
40+
error:
41+
(errorData as Record<string, string>).message ||
42+
`Fathom API error: ${response.status} ${response.statusText}`,
43+
output: {
44+
template_name: null,
45+
markdown_formatted: null,
46+
},
47+
}
48+
}
49+
3650
const data = await response.json()
3751
const summary = data.summary ?? data
3852

apps/sim/tools/fathom/get_transcript.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ export const getTranscriptTool: ToolConfig<FathomGetTranscriptParams, FathomGetT
3434
},
3535

3636
transformResponse: async (response: Response) => {
37+
if (!response.ok) {
38+
const errorData = await response.json().catch(() => ({}))
39+
return {
40+
success: false,
41+
error:
42+
(errorData as Record<string, string>).message ||
43+
`Fathom API error: ${response.status} ${response.statusText}`,
44+
output: {
45+
transcript: [],
46+
},
47+
}
48+
}
49+
3750
const data = await response.json()
3851
const transcript = (data.transcript ?? []).map(
3952
(entry: { speaker?: Record<string, unknown>; text?: string; timestamp?: string }) => ({

apps/sim/tools/fathom/list_meetings.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ export const listMeetingsTool: ToolConfig<FathomListMeetingsParams, FathomListMe
9494
},
9595

9696
transformResponse: async (response: Response) => {
97+
if (!response.ok) {
98+
const errorData = await response.json().catch(() => ({}))
99+
return {
100+
success: false,
101+
error:
102+
(errorData as Record<string, string>).message ||
103+
`Fathom API error: ${response.status} ${response.statusText}`,
104+
output: {
105+
meetings: [],
106+
next_cursor: null,
107+
},
108+
}
109+
}
110+
97111
const data = await response.json()
98112

99113
const meetings = (data.items ?? []).map(

apps/sim/tools/fathom/list_team_members.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ export const listTeamMembersTool: ToolConfig<
4949
},
5050

5151
transformResponse: async (response: Response) => {
52+
if (!response.ok) {
53+
const errorData = await response.json().catch(() => ({}))
54+
return {
55+
success: false,
56+
error:
57+
(errorData as Record<string, string>).message ||
58+
`Fathom API error: ${response.status} ${response.statusText}`,
59+
output: {
60+
members: [],
61+
next_cursor: null,
62+
},
63+
}
64+
}
65+
5266
const data = await response.json()
5367
const members = (data.items ?? []).map(
5468
(member: { name?: string; email?: string; created_at?: string }) => ({

apps/sim/tools/fathom/list_teams.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ export const listTeamsTool: ToolConfig<FathomListTeamsParams, FathomListTeamsRes
3636
},
3737

3838
transformResponse: async (response: Response) => {
39+
if (!response.ok) {
40+
const errorData = await response.json().catch(() => ({}))
41+
return {
42+
success: false,
43+
error:
44+
(errorData as Record<string, string>).message ||
45+
`Fathom API error: ${response.status} ${response.statusText}`,
46+
output: {
47+
teams: [],
48+
next_cursor: null,
49+
},
50+
}
51+
}
52+
3953
const data = await response.json()
4054
const teams = (data.items ?? []).map((team: { name?: string; created_at?: string }) => ({
4155
name: team.name ?? '',

0 commit comments

Comments
 (0)