Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(fathom): list meeting types and users, download recordings and give AI agents meeting tools (#16133)

Odai Ahmad3b7d59e923a8
diff --git a/bun.lock b/bun.lock
index c79aeb70e2e..889ba24f799 100644
--- a/bun.lock
+++ b/bun.lock
@@ -3094,7 +3094,7 @@
},
"packages/pieces/community/fathom": {
"name": "@activepieces/piece-fathom",
- "version": "0.2.5",
+ "version": "0.3.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -3104,6 +3104,7 @@
},
"devDependencies": {
"tslib": "^2.3.0",
+ "vitest": "3.2.6",
},
},
"packages/pieces/community/fathom-analytics": {
diff --git a/packages/pieces/community/fathom/package.json b/packages/pieces/community/fathom/package.json
index c72b3e9c00b..ec7f647f95b 100644
--- a/packages/pieces/community/fathom/package.json
+++ b/packages/pieces/community/fathom/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-fathom",
- "version": "0.2.5",
+ "version": "0.3.0",
"type": "commonjs",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
@@ -12,11 +12,13 @@
"@activepieces/core-utils": "workspace:*"
},
"devDependencies": {
- "tslib": "^2.3.0"
+ "tslib": "^2.3.0",
+ "vitest": "3.2.6"
},
"scripts": {
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
"bundle": "node ../../../../dist/packages/cli/src/index.js pieces bundle",
- "lint": "eslint 'src/**/*.ts'"
+ "lint": "eslint 'src/**/*.ts'",
+ "test": "vitest run"
}
}
diff --git a/packages/pieces/community/fathom/src/i18n/translation.json b/packages/pieces/community/fathom/src/i18n/translation.json
index ed9147bfec6..a3c1447251a 100644
--- a/packages/pieces/community/fathom/src/i18n/translation.json
+++ b/packages/pieces/community/fathom/src/i18n/translation.json
@@ -5,11 +5,29 @@
"List Meetings": "List Meetings",
"Find Team": "Find Team",
"Find Team Member": "Find Team Member",
- "Get the AI-generated summary of a meeting recording. Note: This action requires API Key authentication and is not available when using OAuth2.": "Get the AI-generated summary of a meeting recording. Note: This action requires API Key authentication and is not available when using OAuth2.",
- "Get the AI-generated transcript of a meeting recording. Note: This action requires API Key authentication and is not available when using OAuth2.": "Get the AI-generated transcript of a meeting recording. Note: This action requires API Key authentication and is not available when using OAuth2.",
- "List meetings with optional filtering and pagination": "List meetings with optional filtering and pagination",
- "Find team based on name": "Find team based on name",
- "Find team member based on email": "Find team member based on email",
+ "Find Team Member by Email": "Find Team Member by Email",
+ "List Meeting Types": "List Meeting Types",
+ "List Users and Permissions": "List Users and Permissions",
+ "Request Recording Download": "Request Recording Download",
+ "Get Recording Download": "Get Recording Download",
+ "List Meetings (AI)": "List Meetings (AI)",
+ "Get Recording Summary (AI)": "Get Recording Summary (AI)",
+ "Get Recording Transcript (AI)": "Get Recording Transcript (AI)",
+ "Custom API Call": "Custom API Call",
+ "Get the AI-generated summary of a meeting recording. Works with both OAuth and API key connections.": "Get the AI-generated summary of a meeting recording. Works with both OAuth and API key connections.",
+ "Get the transcript of a meeting recording. Works with both OAuth and API key connections.": "Get the transcript of a meeting recording. Works with both OAuth and API key connections.",
+ "List meetings with optional filters. Follows every page unless you set Max Pages.": "List meetings with optional filters. Follows every page unless you set Max Pages.",
+ "List the teams in your Fathom account, one page at a time.": "List the teams in your Fathom account, one page at a time.",
+ "List the members of your Fathom account, optionally only those of one team. To look up one person, use Find Team Member by Email.": "List the members of your Fathom account, optionally only those of one team. To look up one person, use Find Team Member by Email.",
+ "Look up one Fathom team member by their exact email address.": "Look up one Fathom team member by their exact email address.",
+ "List the meeting types defined in your Fathom organization.": "List the meeting types defined in your Fathom organization.",
+ "List the users of your Fathom account with their status and permissions. Needs an account admin connection.": "List the users of your Fathom account with their status and permissions. Needs an account admin connection.",
+ "Ask Fathom to prepare a video or audio file of a recording. Then use Get Recording Download to get the file link.": "Ask Fathom to prepare a video or audio file of a recording. Then use Get Recording Download to get the file link.",
+ "Check a download started with Request Recording Download and get the file link once it is ready.": "Check a download started with Request Recording Download and get the file link once it is ready.",
+ "Returns one page of Fathom meetings with optional filters. Built for AI agents.": "Returns one page of Fathom meetings with optional filters. Built for AI agents.",
+ "Gets the AI summary of one recording by its recording ID. Built for AI agents.": "Gets the AI summary of one recording by its recording ID. Built for AI agents.",
+ "Gets the transcript of one recording by its recording ID. Built for AI agents.": "Gets the transcript of one recording by its recording ID. Built for AI agents.",
+ "Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Meeting Recording": "Meeting Recording",
"Destination URL": "Destination URL",
"Calendar Invitees": "Calendar Invitees",
@@ -24,33 +42,89 @@
"Include Action Items": "Include Action Items",
"Include CRM Matches": "Include CRM Matches",
"Cursor": "Cursor",
+ "Max Pages": "Max Pages",
"Team": "Team",
+ "Email": "Email",
+ "Status": "Status",
+ "Admin Level": "Admin Level",
+ "Recording ID": "Recording ID",
+ "Download ID": "Download ID",
+ "Company Domains": "Company Domains",
+ "Internal or External": "Internal or External",
+ "Meeting Type": "Meeting Type",
+ "Include Highlights": "Include Highlights",
+ "Method": "Method",
+ "Headers": "Headers",
+ "Query Parameters": "Query Parameters",
+ "Body Type": "Body Type",
+ "Body": "Body",
+ "Response is Binary": "Response is Binary",
+ "Return Error as Output": "Return Error as Output",
+ "Timeout": "Timeout",
+ "Follow redirects": "Follow redirects",
"Select the meeting recording to get the summary for": "Select the meeting recording to get the summary for",
"Optional: URL where Fathom will POST the summary. Leave empty to get data directly in response.": "Optional: URL where Fathom will POST the summary. Leave empty to get data directly in response.",
"Select the meeting recording to get the transcript for": "Select the meeting recording to get the transcript for",
"Optional: URL where Fathom will POST the transcript. Leave empty to get data directly in response.": "Optional: URL where Fathom will POST the transcript. Leave empty to get data directly in response.",
- "Email addresses of calendar invitees to filter by": "Email addresses of calendar invitees to filter by",
+ "Email addresses of calendar invitees to filter by. Fathom no longer documents this filter and may ignore it; prefer Calendar Invitees Domains or Recorded By.": "Email addresses of calendar invitees to filter by. Fathom no longer documents this filter and may ignore it; prefer Calendar Invitees Domains or Recorded By.",
"Domains of the companies to filter by (e.g., acme.com)": "Domains of the companies to filter by (e.g., acme.com)",
"Filter by whether calendar invitee list includes external email domains": "Filter by whether calendar invitee list includes external email domains",
"Email addresses of users who recorded meetings": "Email addresses of users who recorded meetings",
"Team names to filter by (e.g., Sales, Engineering)": "Team names to filter by (e.g., Sales, Engineering)",
"Filter to meetings created after this timestamp (e.g., 2025-01-01T00:00:00Z)": "Filter to meetings created after this timestamp (e.g., 2025-01-01T00:00:00Z)",
"Filter to meetings created before this timestamp (e.g., 2025-01-01T00:00:00Z)": "Filter to meetings created before this timestamp (e.g., 2025-01-01T00:00:00Z)",
- "Include the transcript for each meeting": "Include the transcript for each meeting",
- "Include the summary for each meeting": "Include the summary for each meeting",
+ "Include the transcript for each meeting. API key connections only; with OAuth use Get Recording Transcript.": "Include the transcript for each meeting. API key connections only; with OAuth use Get Recording Transcript.",
+ "Include the summary for each meeting. API key connections only; with OAuth use Get Recording Summary.": "Include the summary for each meeting. API key connections only; with OAuth use Get Recording Summary.",
"Include the action items for each meeting": "Include the action items for each meeting",
"Include CRM matches for each meeting": "Include CRM matches for each meeting",
"Cursor for pagination (from previous response)": "Cursor for pagination (from previous response)",
+ "Stop after this many pages of meetings. Leave empty to fetch every page (each page holds about 10 meetings).": "Stop after this many pages of meetings. Leave empty to fetch every page (each page holds about 10 meetings).",
"Team name to filter by": "Team name to filter by",
+ "Email address of the member, e.g. [email protected].": "Email address of the member, e.g. [email protected].",
+ "Optional exact team name to search within.": "Optional exact team name to search within.",
+ "Active types can be assigned to new meetings; inactive ones only appear on older meetings.": "Active types can be assigned to new meetings; inactive ones only appear on older meetings.",
+ "Exact team name to filter by (see Find Team).": "Exact team name to filter by (see Find Team).",
+ "Filter by settings access. Not available together with Status = Invited.": "Filter by settings access. Not available together with Status = Invited.",
+ "next_cursor from the previous call.": "next_cursor from the previous call.",
+ "The numeric recording_id from New Recording or List Meetings.": "The numeric recording_id from New Recording or List Meetings.",
+ "The numeric recording_id the download was requested for.": "The numeric recording_id the download was requested for.",
+ "The download_id returned by Request Recording Download.": "The download_id returned by Request Recording Download.",
+ "Only meetings created after this ISO 8601 date-time.": "Only meetings created after this ISO 8601 date-time.",
+ "Only meetings created before this ISO 8601 date-time.": "Only meetings created before this ISO 8601 date-time.",
+ "Emails of the Fathom users who recorded the meetings.": "Emails of the Fathom users who recorded the meetings.",
+ "Exact team names (see Find Team).": "Exact team names (see Find Team).",
+ "Company domains of the invitees, exact match (e.g. acme.com).": "Company domains of the invitees, exact match (e.g. acme.com).",
+ "Only internal meetings, or only meetings with at least one external invitee.": "Only internal meetings, or only meetings with at least one external invitee.",
+ "Exact meeting type name from List Meeting Types. An unknown name returns no meetings.": "Exact meeting type name from List Meeting Types. An unknown name returns no meetings.",
+ "API key connections only.": "API key connections only.",
+ "Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
+ "Appended to the URL as ?key=value.": "Appended to the URL as ?key=value.",
+ "Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
+ "On a failed request, output the error instead of failing the step.": "On a failed request, output the error instead of failing the step.",
+ "Seconds to wait for a response. Empty: up to the flow limit (10 min).": "Seconds to wait for a response. Empty: up to the flow limit (10 min).",
+ "Follow 3xx redirects instead of returning them as the response.": "Follow 3xx redirects instead of returning them as the response.",
"All": "All",
"Only Internal": "Only Internal",
"One or More External": "One or More External",
+ "Active": "Active",
+ "Inactive": "Inactive",
+ "Deactivated": "Deactivated",
+ "Invited": "Invited",
+ "None": "None",
+ "Team Admin": "Team Admin",
+ "Account Admin": "Account Admin",
+ "GET": "GET",
+ "POST": "POST",
+ "PATCH": "PATCH",
+ "PUT": "PUT",
+ "DELETE": "DELETE",
+ "HEAD": "HEAD",
"New Recording": "New Recording",
- "Fires when a meeting is recorded (i.e. a new meeting recording is produced)": "Fires when a meeting is recorded (i.e. a new meeting recording is produced)",
+ "Fires when Fathom finishes processing a new meeting recording. Turn on at least one of the Include options.": "Fires when Fathom finishes processing a new meeting recording. Turn on at least one of the Include options.",
"Trigger For": "Trigger For",
"Select which types of recordings should trigger this webhook": "Select which types of recordings should trigger this webhook",
"Include the transcript in the webhook payload": "Include the transcript in the webhook payload",
- "Include the summary in the webhook payload": "Include the summary in the webhook payload",
+ "Include the summary in the webhook payload. Fathom needs at least one Include option turned on.": "Include the summary in the webhook payload. Fathom needs at least one Include option turned on.",
"Include the action items in the webhook payload": "Include the action items in the webhook payload",
"Include CRM matches in the webhook payload": "Include CRM matches in the webhook payload"
}
\ No newline at end of file
diff --git a/packages/pieces/community/fathom/src/index.ts b/packages/pieces/community/fathom/src/index.ts
index 383eeadb5a4..5fac37f50dd 100644
--- a/packages/pieces/community/fathom/src/index.ts
+++ b/packages/pieces/community/fathom/src/index.ts
@@ -1,23 +1,78 @@
-import { createPiece } from '@activepieces/pieces-framework';
-import { PieceCategory } from '@activepieces/pieces-framework';
+import { createCustomApiCallAction } from '@activepieces/pieces-common';
+import { createPiece, PieceCategory } from '@activepieces/pieces-framework';
import { getRecordingSummary } from './lib/actions/get-recording-summary';
import { getRecordingTranscript } from './lib/actions/get-recording-transcript';
import { listMeetings } from './lib/actions/list-meetings';
import { findTeam } from './lib/actions/find-team';
import { findTeamMember } from './lib/actions/find-team-member';
+import { aiListMeetings } from './lib/actions/ai/list-meetings';
+import { aiGetRecordingSummary } from './lib/actions/ai/get-recording-summary';
+import { aiGetRecordingTranscript } from './lib/actions/ai/get-recording-transcript';
+import { listMeetingTypes } from './lib/actions/list-meeting-types';
+import { listUsers } from './lib/actions/list-users';
+import { findTeamMemberByEmail } from './lib/actions/find-team-member-by-email';
+import { requestRecordingDownload } from './lib/actions/request-recording-download';
+import { getRecordingDownload } from './lib/actions/get-recording-download';
import { newRecording } from './lib/triggers/new-recording';
import { fathomAuth } from './lib/common/auth';
+import { fathomClient } from './lib/common/client';
export { fathomAuth };
export const fathom = createPiece({
displayName: 'Fathom',
auth: fathomAuth,
- minimumSupportedRelease: '0.36.1',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/fathom.png',
- authors: ["fortunamide", "onyedikachi-david"],
+ authors: ['fortunamide', 'onyedikachi-david'],
categories: [PieceCategory.PRODUCTIVITY],
- description: 'Fathom is an AI meeting assistant that automatically records, transcribes, highlights, and generates AI summaries and action items from your meetings. Integrate with workflows to react to meeting events and retrieve meeting data.',
- actions: [getRecordingSummary, getRecordingTranscript, listMeetings, findTeam, findTeamMember],
+ description:
+ 'Fathom is an AI meeting assistant that automatically records, transcribes, highlights, and generates AI summaries and action items from your meetings. Integrate with workflows to react to meeting events and retrieve meeting data.',
+ actions: [
+ getRecordingSummary,
+ getRecordingTranscript,
+ listMeetings,
+ findTeam,
+ findTeamMember,
+ findTeamMemberByEmail,
+ listMeetingTypes,
+ listUsers,
+ requestRecordingDownload,
+ getRecordingDownload,
+ aiListMeetings,
+ aiGetRecordingSummary,
+ aiGetRecordingTranscript,
+ createCustomApiCallAction({
+ baseUrl: () => fathomClient.baseUrl,
+ auth: fathomAuth,
+ authMapping: async (auth, propsValue) => {
+ assertFathomUrl({ propsValue });
+ return fathomClient.authHeaders(auth);
+ },
+ }),
+ ],
triggers: [newRecording],
});
+
+function assertFathomUrl({ propsValue }: { propsValue: Record<string, unknown> }): void {
+ const urlProp = propsValue['url'];
+ const url = typeof urlProp === 'object' && urlProp !== null && 'url' in urlProp ? urlProp.url : undefined;
+ if (typeof url !== 'string') {
+ return;
+ }
+ const isAbsolute = /^[a-z][a-z0-9+.-]*:/i.test(url) || url.startsWith('//');
+ if (!isAbsolute) {
+ const path = url.split('?')[0];
+ if (path.includes('..') || path.includes('\\') || path.includes('@')) {
+ throw new Error('The URL must be a path on the Fathom API, such as /meetings.');
+ }
+ return;
+ }
+ if (!url.startsWith(`${fathomClient.baseUrl}/`) && url !== fathomClient.baseUrl) {
+ throw new Error(`Custom API Call only sends your Fathom credentials to ${fathomClient.baseUrl}. Use a path such as /meetings.`);
+ }
+ const rest = url.slice(fathomClient.baseUrl.length).split('?')[0];
+ if (rest.includes('..') || rest.includes('\\') || rest.includes('@')) {
+ throw new Error('The URL must be a path on the Fathom API, such as /meetings.');
+ }
+}
diff --git a/packages/pieces/community/fathom/src/lib/actions/ai/get-recording-summary.ts b/packages/pieces/community/fathom/src/lib/actions/ai/get-recording-summary.ts
new file mode 100644
index 00000000000..575d8a477e2
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/ai/get-recording-summary.ts
@@ -0,0 +1,29 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../../common/auth';
+import { fathomClient } from '../../common/client';
+import { fathomInputs, fathomProps } from '../../common/props';
+import { fathomOutputSchemas } from '../../output-schemas';
+
+export const aiGetRecordingSummary = createAction({
+ name: 'fathom_get_recording_summary',
+ classification: 'READ',
+ displayName: 'Get Recording Summary (AI)',
+ description: 'Gets the AI summary of one recording by its recording ID. Built for AI agents.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ "Gets the Fathom AI summary of one recording as markdown, with the template name. Use after a trigger or List Meetings gives you a recording_id, when a recap is enough; use Get Recording Transcript for verbatim text. Counts against Fathom's heavy-request limit (30/min, sometimes 5/min). Read-only and idempotent.",
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ recording_id: fathomProps.recordingIdText({ description: 'The numeric recording_id from New Recording or List Meetings.' }),
+ },
+ outputSchema: fathomOutputSchemas.recordingSummary,
+ async run({ auth, propsValue }) {
+ const recordingId = fathomInputs.parseRecordingId({ value: propsValue.recording_id });
+ const body = await fathomClient.requestObject({ auth, method: HttpMethod.GET, path: `recordings/${recordingId}/summary` });
+ return { recording_id: recordingId, summary: body['summary'] ?? null };
+ },
+});
diff --git a/packages/pieces/community/fathom/src/lib/actions/ai/get-recording-transcript.ts b/packages/pieces/community/fathom/src/lib/actions/ai/get-recording-transcript.ts
new file mode 100644
index 00000000000..83c7e4f3b44
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/ai/get-recording-transcript.ts
@@ -0,0 +1,29 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../../common/auth';
+import { fathomClient } from '../../common/client';
+import { fathomInputs, fathomProps } from '../../common/props';
+import { fathomOutputSchemas } from '../../output-schemas';
+
+export const aiGetRecordingTranscript = createAction({
+ name: 'fathom_get_recording_transcript',
+ classification: 'READ',
+ displayName: 'Get Recording Transcript (AI)',
+ description: 'Gets the transcript of one recording by its recording ID. Built for AI agents.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Gets the full speaker-attributed transcript of one Fathom recording, each line with speaker name, matched invitee email and HH:MM:SS timestamp. Use when exact wording or who-said-what matters; prefer Get Recording Summary for a recap. Heavy-request limit applies. Read-only and idempotent.',
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ recording_id: fathomProps.recordingIdText({ description: 'The numeric recording_id from New Recording or List Meetings.' }),
+ },
+ outputSchema: fathomOutputSchemas.recordingTranscript,
+ async run({ auth, propsValue }) {
+ const recordingId = fathomInputs.parseRecordingId({ value: propsValue.recording_id });
+ const body = await fathomClient.requestObject({ auth, method: HttpMethod.GET, path: `recordings/${recordingId}/transcript` });
+ return { recording_id: recordingId, transcript: Array.isArray(body['transcript']) ? body['transcript'] : [] };
+ },
+});
diff --git a/packages/pieces/community/fathom/src/lib/actions/ai/list-meetings.ts b/packages/pieces/community/fathom/src/lib/actions/ai/list-meetings.ts
new file mode 100644
index 00000000000..69bd3679e3e
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/ai/list-meetings.ts
@@ -0,0 +1,74 @@
+import { AppConnectionType, createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../../common/auth';
+import { fathomClient } from '../../common/client';
+import { fathomInputs } from '../../common/props';
+import { fathomOutputSchemas } from '../../output-schemas';
+
+export const aiListMeetings = createAction({
+ name: 'fathom_list_meetings',
+ classification: 'SEARCH',
+ displayName: 'List Meetings (AI)',
+ description: 'Returns one page of Fathom meetings with optional filters. Built for AI agents.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of Fathom meetings, newest first, with recording IDs, links, invitees and recorder, optionally filtered by date window, recorder email, team, company domain, internal/external or meeting type, and optionally embedding action items, highlights, CRM matches, summary or transcript. Use it to find a recording ID before getting its summary or transcript; pass next_cursor to continue. Summary and transcript flags work only on API-key connections (use the Get Recording actions under OAuth). Read-only and idempotent.',
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ created_after: Property.DateTime({ displayName: 'Created After', description: 'Only meetings created after this ISO 8601 date-time.', required: false }),
+ created_before: Property.DateTime({ displayName: 'Created Before', description: 'Only meetings created before this ISO 8601 date-time.', required: false }),
+ recorded_by: Property.Array({ displayName: 'Recorded By', description: 'Emails of the Fathom users who recorded the meetings.', required: false }),
+ teams: Property.Array({ displayName: 'Teams', description: 'Exact team names (see Find Team).', required: false }),
+ calendar_invitees_domains: Property.Array({ displayName: 'Company Domains', description: 'Company domains of the invitees, exact match (e.g. acme.com).', required: false }),
+ calendar_invitees_domains_type: Property.StaticDropdown({
+ displayName: 'Internal or External',
+ description: 'Only internal meetings, or only meetings with at least one external invitee.',
+ required: false,
+ options: {
+ options: [
+ { label: 'All', value: 'all' },
+ { label: 'Only Internal', value: 'only_internal' },
+ { label: 'One or More External', value: 'one_or_more_external' },
+ ],
+ },
+ }),
+ meeting_type: Property.ShortText({ displayName: 'Meeting Type', description: 'Exact meeting type name from List Meeting Types. An unknown name returns no meetings.', required: false }),
+ include_action_items: Property.Checkbox({ displayName: 'Include Action Items', required: false, defaultValue: false }),
+ include_highlights: Property.Checkbox({ displayName: 'Include Highlights', required: false, defaultValue: false }),
+ include_crm_matches: Property.Checkbox({ displayName: 'Include CRM Matches', required: false, defaultValue: false }),
+ include_summary: Property.Checkbox({ displayName: 'Include Summary', description: 'API key connections only.', required: false, defaultValue: false }),
+ include_transcript: Property.Checkbox({ displayName: 'Include Transcript', description: 'API key connections only.', required: false, defaultValue: false }),
+ cursor: Property.ShortText({ displayName: 'Cursor', description: 'next_cursor from the previous call.', required: false }),
+ },
+ outputSchema: fathomOutputSchemas.meetingsPage,
+ async run({ auth, propsValue }) {
+ if ((propsValue.include_summary === true || propsValue.include_transcript === true) && auth.type !== AppConnectionType.SECRET_TEXT) {
+ throw new Error(
+ 'Fathom does not return summaries or transcripts in List Meetings for OAuth connections. Set include_summary and include_transcript to false and call Get Recording Summary (AI) or Get Recording Transcript (AI) with the recording_id instead.'
+ );
+ }
+ const domainsType = propsValue.calendar_invitees_domains_type;
+ const page = await fathomClient.listPage({
+ auth,
+ path: 'meetings',
+ query: {
+ created_after: fathomInputs.optionalTimestamp({ value: propsValue.created_after, label: 'Created After' }),
+ created_before: fathomInputs.optionalTimestamp({ value: propsValue.created_before, label: 'Created Before' }),
+ recorded_by: fathomInputs.stringList({ value: propsValue.recorded_by }),
+ teams: fathomInputs.stringList({ value: propsValue.teams }),
+ calendar_invitees_domains: fathomInputs.stringList({ value: propsValue.calendar_invitees_domains }),
+ calendar_invitees_domains_type: domainsType === 'only_internal' || domainsType === 'one_or_more_external' ? domainsType : undefined,
+ meeting_type: fathomInputs.optionalText({ value: propsValue.meeting_type }),
+ include_action_items: propsValue.include_action_items === true || undefined,
+ include_highlights: propsValue.include_highlights === true || undefined,
+ include_crm_matches: propsValue.include_crm_matches === true || undefined,
+ include_summary: propsValue.include_summary === true || undefined,
+ include_transcript: propsValue.include_transcript === true || undefined,
+ cursor: fathomInputs.optionalText({ value: propsValue.cursor }),
+ },
+ });
+ return { items: page.items, next_cursor: page.next_cursor, has_more: page.next_cursor !== null };
+ },
+});
diff --git a/packages/pieces/community/fathom/src/lib/actions/find-team-member-by-email.ts b/packages/pieces/community/fathom/src/lib/actions/find-team-member-by-email.ts
new file mode 100644
index 00000000000..c89fa1a7d26
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/find-team-member-by-email.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { fathomClient } from '../common/client';
+import { fathomInputs } from '../common/props';
+import { fathomOutputSchemas } from '../output-schemas';
+
+export const findTeamMemberByEmail = createAction({
+ name: 'find_team_member_by_email',
+ classification: 'READ',
+ displayName: 'Find Team Member by Email',
+ description: 'Look up one Fathom team member by their exact email address.',
+ audience: 'both',
+ aiMetadata: {
+ description:
+ 'Looks up one Fathom team member by exact email (case-insensitive), optionally within a team, and returns their name, email and join date, or found=false. Use to check whether someone is on the Fathom account before filtering meetings by recorder. Read-only and idempotent.',
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ email: Property.ShortText({ displayName: 'Email', description: 'Email address of the member, e.g. [email protected].', required: true }),
+ team: Property.ShortText({ displayName: 'Team', description: 'Optional exact team name to search within.', required: false }),
+ },
+ outputSchema: fathomOutputSchemas.teamMemberLookup,
+ async run({ auth, propsValue }) {
+ const email = fathomInputs.optionalText({ value: propsValue.email })?.toLowerCase();
+ if (email === undefined || !email.includes('@')) {
+ throw new Error('Enter the full email address of the team member, e.g. [email protected].');
+ }
+ const matches = (items: Record<string, unknown>[]) => items.find((item) => typeof item['email'] === 'string' && item['email'].toLowerCase() === email);
+ const result = await fathomClient.listPages({
+ auth,
+ path: 'team_members',
+ query: { team: fathomInputs.optionalText({ value: propsValue.team }) },
+ maxPages: MAX_PAGES,
+ stopWhen: (items) => matches(items) !== undefined,
+ });
+ const member = matches(result.items);
+ if (member !== undefined) {
+ return { found: true, member };
+ }
+ if (result.truncated) {
+ throw new Error(`No member with this email in the first ${MAX_PAGES} pages of team members. Narrow the search with Team.`);
+ }
+ return { found: false, member: null };
+ },
+});
+
+const MAX_PAGES = 50;
diff --git a/packages/pieces/community/fathom/src/lib/actions/find-team-member.ts b/packages/pieces/community/fathom/src/lib/actions/find-team-member.ts
index 9b669e76dcf..561f49ca26b 100644
--- a/packages/pieces/community/fathom/src/lib/actions/find-team-member.ts
+++ b/packages/pieces/community/fathom/src/lib/actions/find-team-member.ts
@@ -1,42 +1,37 @@
-import { fathomAuth, getFathomClient } from '../common/auth';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { ListTeamMembersRequest } from 'fathom-typescript/dist/esm/sdk/models/operations';
+import { fathomAuth } from '../common/auth';
+import { fathomInputs } from '../common/props';
+import { fathomLegacy } from '../common/legacy';
+import { fathomOutputSchemas } from '../output-schemas';
export const findTeamMember = createAction({
name: 'findTeamMember',
classification: 'SEARCH',
displayName: 'Find Team Member',
- description: 'Find team member based on email',
+ description: 'List the members of your Fathom account, optionally only those of one team. To look up one person, use Find Team Member by Email.',
audience: 'both',
- aiMetadata: { description: 'List team members in the connected Fathom workspace, optionally narrowed to a single team by name; with no team supplied it returns members across all teams. Use to look up who belongs to a team. Read-only and repeatable; use the cursor for pagination.', idempotent: true },
+ aiMetadata: {
+ description:
+ 'Lists members (name, email, join date) of the Fathom account, optionally only those of one team given by exact team name, one page per call with a cursor. Use Find Team Member by Email for a single-person lookup. Read-only and idempotent.',
+ idempotent: true,
+ },
auth: fathomAuth,
props: {
team: Property.ShortText({
displayName: 'Team',
description: 'Team name to filter by',
- required: false
+ required: false,
}),
cursor: Property.ShortText({
displayName: 'Cursor',
description: 'Cursor for pagination (from previous response)',
- required: false
- })
+ required: false,
+ }),
},
+ outputSchema: fathomOutputSchemas.legacyTeamMembers,
async run({ auth, propsValue }) {
- const fathom = getFathomClient(auth);
-
- const params: Partial<ListTeamMembersRequest> = {};
-
- if (propsValue.team) {
- params.team = propsValue.team;
- }
-
- if (propsValue.cursor) {
- params.cursor = propsValue.cursor;
- }
-
- const response = await fathom.listTeamMembers(params);
-
- return response;
- }
+ const team = fathomInputs.optionalText({ value: propsValue.team });
+ const cursor = fathomInputs.optionalText({ value: propsValue.cursor });
+ return fathomLegacy.listInSdkShape({ auth, path: 'team_members', query: { team, cursor }, fields: ['name', 'email'] });
+ },
});
diff --git a/packages/pieces/community/fathom/src/lib/actions/find-team.ts b/packages/pieces/community/fathom/src/lib/actions/find-team.ts
index ff6d1eb00dd..db9ddaa52ef 100644
--- a/packages/pieces/community/fathom/src/lib/actions/find-team.ts
+++ b/packages/pieces/community/fathom/src/lib/actions/find-team.ts
@@ -1,14 +1,20 @@
-import { fathomAuth, getFathomClient } from '../common/auth';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { ListTeamsRequest } from 'fathom-typescript/dist/esm/sdk/models/operations';
+import { fathomAuth } from '../common/auth';
+import { fathomInputs } from '../common/props';
+import { fathomLegacy } from '../common/legacy';
+import { fathomOutputSchemas } from '../output-schemas';
export const findTeam = createAction({
name: 'findTeam',
classification: 'SEARCH',
displayName: 'Find Team',
- description: 'Find team based on name',
+ description: 'List the teams in your Fathom account, one page at a time.',
audience: 'both',
- aiMetadata: { description: 'List the teams in the connected Fathom workspace, used to look up or enumerate teams by name. Read-only and repeatable; use the cursor for pagination across large team lists.', idempotent: true },
+ aiMetadata: {
+ description:
+ 'Lists the teams in the connected Fathom account, one page per call; pass the returned cursor to get the next page. Use to get exact team names for the team filters of List Meetings or List Team Members. Read-only and idempotent.',
+ idempotent: true,
+ },
auth: fathomAuth,
props: {
cursor: Property.ShortText({
@@ -17,16 +23,9 @@ export const findTeam = createAction({
required: false,
}),
},
+ outputSchema: fathomOutputSchemas.legacyTeams,
async run({ auth, propsValue }) {
- const fathom = getFathomClient(auth);
-
- const params: Partial<ListTeamsRequest> = {};
- if (propsValue.cursor) {
- params.cursor = propsValue.cursor;
- }
-
- const response = await fathom.listTeams(params);
-
- return response;
+ const cursor = fathomInputs.optionalText({ value: propsValue.cursor });
+ return fathomLegacy.listInSdkShape({ auth, path: 'teams', query: { cursor }, fields: ['name'] });
},
});
diff --git a/packages/pieces/community/fathom/src/lib/actions/get-recording-download.ts b/packages/pieces/community/fathom/src/lib/actions/get-recording-download.ts
new file mode 100644
index 00000000000..0909554b9d9
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/get-recording-download.ts
@@ -0,0 +1,33 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { fathomClient } from '../common/client';
+import { fathomInputs, fathomProps } from '../common/props';
+import { fathomOutputSchemas } from '../output-schemas';
+
+export const getRecordingDownload = createAction({
+ name: 'get_recording_download',
+ classification: 'READ',
+ displayName: 'Get Recording Download',
+ description: 'Check a download started with Request Recording Download and get the file link once it is ready.',
+ audience: 'both',
+ aiMetadata: {
+ description:
+ 'Gets the status of a Fathom recording download (processing, completed, failed, expired) and, once completed, the signed file URL, content type, size and expiry. Only works for downloads created by this same connection. Read-only and idempotent.',
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ recording_id: fathomProps.recordingIdText({ description: 'The numeric recording_id the download was requested for.' }),
+ download_id: Property.ShortText({ displayName: 'Download ID', description: 'The download_id returned by Request Recording Download.', required: true }),
+ },
+ outputSchema: fathomOutputSchemas.download,
+ async run({ auth, propsValue }) {
+ const recordingId = fathomInputs.parseRecordingId({ value: propsValue.recording_id });
+ const downloadId = fathomInputs.optionalText({ value: propsValue.download_id });
+ if (downloadId === undefined || !/^[A-Za-z0-9_-]{1,128}$/.test(downloadId)) {
+ throw new Error('Download ID must be the download_id returned by Request Recording Download (letters, digits, _ and -).');
+ }
+ return fathomClient.requestObject({ auth, method: HttpMethod.GET, path: `recordings/${recordingId}/downloads/${downloadId}` });
+ },
+});
diff --git a/packages/pieces/community/fathom/src/lib/actions/get-recording-summary.ts b/packages/pieces/community/fathom/src/lib/actions/get-recording-summary.ts
index bb72b9bed72..dd526df08fa 100644
--- a/packages/pieces/community/fathom/src/lib/actions/get-recording-summary.ts
+++ b/packages/pieces/community/fathom/src/lib/actions/get-recording-summary.ts
@@ -1,77 +1,37 @@
-import { fathomAuth, getFathomClient } from '../common/auth';
import { createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { fathomProps } from '../common/props';
+import { fathomSdk } from '../common/sdk';
+import { fathomOutputSchemas } from '../output-schemas';
export const getRecordingSummary = createAction({
name: 'getRecordingSummary',
classification: 'READ',
displayName: 'Get Recording Summary',
- description: 'Get the AI-generated summary of a meeting recording. Note: This action requires API Key authentication and is not available when using OAuth2.',
- audience: 'both',
- aiMetadata: { description: 'Retrieve the AI-generated summary of a single Fathom meeting recording, identified by its recording ID. Use to pull a concise recap of what a recorded meeting covered. Read-only and repeatable; optionally supply a destination URL to have Fathom POST the summary there instead of returning it inline. Requires API Key auth (not available under OAuth2).', idempotent: true },
+ description: 'Get the AI-generated summary of a meeting recording. Works with both OAuth and API key connections.',
+ audience: 'human',
+ aiMetadata: {
+ description:
+ 'Retrieves the AI summary (markdown) of one Fathom recording picked from a list of recent meetings, or asks Fathom to POST it to a destination URL instead. Agents should use Get Recording Summary (AI), which takes a recording ID. Read-only and idempotent.',
+ idempotent: true,
+ },
auth: fathomAuth,
props: {
- recording_id: Property.Dropdown({
- auth: fathomAuth,
- displayName: 'Meeting Recording',
- description: 'Select the meeting recording to get the summary for',
- required: true,
- refreshers: [],
- options: async ({ auth }) => {
- if (!auth) {
- return {
- disabled: true,
- options: [],
- placeholder: 'Please authenticate first'
- };
- }
-
- try {
- const fathom = getFathomClient(auth);
-
- const meetingsIterator = await fathom.listMeetings();
-
- const options: { label: string; value: number }[] = [];
- for await (const response of meetingsIterator) {
- if (response && response.result && response.result.items) {
- response.result.items.forEach((meeting) => {
- const label = meeting.title || `Meeting on ${meeting.scheduledStartTime.toLocaleDateString()}`;
- options.push({
- label: label,
- value: meeting.recordingId
- });
- });
- }
- }
-
- return {
- disabled: false,
- options: options
- };
- } catch (error) {
- return {
- disabled: true,
- options: [],
- placeholder: 'Failed to load meetings. Please check your connection.'
- };
- }
- }
- }),
+ recording_id: fathomProps.recordingDropdown({ description: 'Select the meeting recording to get the summary for' }),
destination_url: Property.ShortText({
displayName: 'Destination URL',
description: 'Optional: URL where Fathom will POST the summary. Leave empty to get data directly in response.',
required: false,
}),
},
+ outputSchema: fathomOutputSchemas.legacySummary,
async run({ auth, propsValue }) {
- const fathom = getFathomClient(auth);
-
- const request = {
+ const { sdk, requireResult } = fathomSdk.create({ auth });
+ const destinationUrl = propsValue.destination_url?.trim();
+ const response = await sdk.getRecordingSummary({
recordingId: propsValue.recording_id,
- ...(propsValue.destination_url && { destinationUrl: propsValue.destination_url })
- };
-
- const response = await fathom.getRecordingSummary(request);
-
- return response;
+ ...(destinationUrl ? { destinationUrl } : {}),
+ });
+ return requireResult({ value: response, operation: 'Get Recording Summary' });
},
});
diff --git a/packages/pieces/community/fathom/src/lib/actions/get-recording-transcript.ts b/packages/pieces/community/fathom/src/lib/actions/get-recording-transcript.ts
index b294f7a6124..581d268950c 100644
--- a/packages/pieces/community/fathom/src/lib/actions/get-recording-transcript.ts
+++ b/packages/pieces/community/fathom/src/lib/actions/get-recording-transcript.ts
@@ -1,78 +1,58 @@
-import { fathomAuth, getFathomClient } from '../common/auth';
+import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
-import { GetRecordingTranscriptRequest } from 'fathom-typescript/dist/esm/sdk/models/operations';
+import { fathomAuth } from '../common/auth';
+import { fathomClient } from '../common/client';
+import { fathomProps } from '../common/props';
+import { fathomSdk } from '../common/sdk';
+import { fathomOutputSchemas } from '../output-schemas';
export const getRecordingTranscript = createAction({
name: 'getRecordingTranscript',
classification: 'READ',
displayName: 'Get Recording Transcript',
- description: 'Get the AI-generated transcript of a meeting recording. Note: This action requires API Key authentication and is not available when using OAuth2.',
- audience: 'both',
- aiMetadata: { description: 'Retrieve the full transcript of a single Fathom meeting recording, identified by its recording ID. Use when you need the verbatim spoken content rather than the summary. Read-only and repeatable; optionally supply a destination URL to have Fathom POST the transcript there instead of returning it inline. Requires API Key auth (not available under OAuth2).', idempotent: true },
+ description: 'Get the transcript of a meeting recording. Works with both OAuth and API key connections.',
+ audience: 'human',
+ aiMetadata: {
+ description:
+ 'Retrieves the speaker-attributed transcript of one Fathom recording picked from a list of recent meetings, or asks Fathom to POST it to a destination URL instead. Agents should use Get Recording Transcript (AI), which takes a recording ID. Read-only and idempotent.',
+ idempotent: true,
+ },
auth: fathomAuth,
props: {
- recording_id: Property.Dropdown({
- auth: fathomAuth,
- displayName: 'Meeting Recording',
- description: 'Select the meeting recording to get the transcript for',
- required: true,
- refreshers: [],
- options: async ({ auth }) => {
- if (!auth) {
- return {
- disabled: true,
- options: [],
- placeholder: 'Please authenticate first'
- };
- }
-
- try {
- const fathom = getFathomClient(auth);
-
- const meetingsIterator = await fathom.listMeetings();
-
- const options: { label: string; value: number }[] = [];
- for await (const response of meetingsIterator) {
- if (response && response.result && response.result.items) {
- response.result.items.forEach((meeting) => {
- const label = meeting.title || `Meeting on ${meeting.scheduledStartTime.toLocaleDateString()}`;
- options.push({
- label: label,
- value: meeting.recordingId
- });
- });
- }
- }
-
- return {
- disabled: false,
- options: options
- };
- } catch (error) {
- return {
- disabled: true,
- options: [],
- placeholder: 'Failed to load meetings. Please check your connection.'
- };
- }
- }
- }),
+ recording_id: fathomProps.recordingDropdown({ description: 'Select the meeting recording to get the transcript for' }),
destination_url: Property.ShortText({
displayName: 'Destination URL',
description: 'Optional: URL where Fathom will POST the transcript. Leave empty to get data directly in response.',
required: false,
}),
},
+ outputSchema: fathomOutputSchemas.legacyTranscript,
async run({ auth, propsValue }) {
- const fathom = getFathomClient(auth);
-
- const request = {
- recordingId: propsValue.recording_id,
- ...(propsValue.destination_url && { destinationUrl: propsValue.destination_url })
- } as GetRecordingTranscriptRequest;
-
- const response = await fathom.getRecordingTranscript(request);
-
- return response;
+ const { sdk, requireResult } = fathomSdk.create({ auth });
+ const destinationUrl = propsValue.destination_url?.trim();
+ if (destinationUrl) {
+ const response = await sdk.getRecordingTranscript({ recordingId: propsValue.recording_id, destinationUrl });
+ return requireResult({ value: response, operation: 'Get Recording Transcript' });
+ }
+ const body = await fathomClient.requestObject({
+ auth,
+ method: HttpMethod.GET,
+ path: `recordings/${propsValue.recording_id}/transcript`,
+ });
+ const lines = Array.isArray(body['transcript']) ? body['transcript'].filter(fathomClient.isRecord) : [];
+ return { transcript: lines.map(toCamelLine) };
},
});
+
+function toCamelLine(line: Record<string, unknown>) {
+ const speaker = fathomClient.isRecord(line['speaker']) ? line['speaker'] : {};
+ const email = speaker['matched_calendar_invitee_email'];
+ return {
+ speaker: {
+ displayName: speaker['display_name'],
+ ...(email === undefined ? {} : { matchedCalendarInviteeEmail: email }),
+ },
+ text: line['text'],
+ timestamp: line['timestamp'],
+ };
+}
diff --git a/packages/pieces/community/fathom/src/lib/actions/list-meeting-types.ts b/packages/pieces/community/fathom/src/lib/actions/list-meeting-types.ts
new file mode 100644
index 00000000000..fe261e877c8
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/list-meeting-types.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { fathomClient } from '../common/client';
+import { fathomOutputSchemas } from '../output-schemas';
+
+export const listMeetingTypes = createAction({
+ name: 'list_meeting_types',
+ classification: 'SEARCH',
+ displayName: 'List Meeting Types',
+ description: 'List the meeting types defined in your Fathom organization.',
+ audience: 'both',
+ aiMetadata: {
+ description:
+ 'Lists the meeting types defined in the Fathom org (name, active/inactive, created date), optionally only active or only inactive ones. Use to get the exact name for the meeting_type filter of List Meetings; an unknown name there returns nothing. Read-only and idempotent.',
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ description: 'Active types can be assigned to new meetings; inactive ones only appear on older meetings.',
+ required: false,
+ defaultValue: 'all',
+ options: {
+ options: [
+ { label: 'All', value: 'all' },
+ { label: 'Active', value: 'active' },
+ { label: 'Inactive', value: 'inactive' },
+ ],
+ },
+ }),
+ },
+ outputSchema: fathomOutputSchemas.meetingTypes,
+ async run({ auth, propsValue }) {
+ const result = await fathomClient.listPages({ auth, path: 'meeting_types', maxPages: MAX_PAGES });
+ if (result.truncated) {
+ throw new Error(`Fathom returned more than ${MAX_PAGES} pages of meeting types; this action stopped instead of returning a partial list.`);
+ }
+ const status = propsValue.status;
+ const items = status === 'active' || status === 'inactive' ? result.items.filter((item) => item['status'] === status) : result.items;
+ return { items, count: items.length };
+ },
+});
+
+const MAX_PAGES = 20;
diff --git a/packages/pieces/community/fathom/src/lib/actions/list-meetings.ts b/packages/pieces/community/fathom/src/lib/actions/list-meetings.ts
index 0687a148d12..6c619f626f5 100644
--- a/packages/pieces/community/fathom/src/lib/actions/list-meetings.ts
+++ b/packages/pieces/community/fathom/src/lib/actions/list-meetings.ts
@@ -1,19 +1,26 @@
-import { fathomAuth, getFathomClient } from '../common/auth';
-import { createAction, Property } from '@activepieces/pieces-framework';
-import { ListMeetingsRequest } from 'fathom-typescript/dist/esm/sdk/models/operations';
+import { AppConnectionType, createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { FathomApiError } from '../common/client';
+import { fathomInputs } from '../common/props';
+import { fathomSdk } from '../common/sdk';
+import { fathomOutputSchemas } from '../output-schemas';
export const listMeetings = createAction({
name: 'listMeetings',
classification: 'SEARCH',
displayName: 'List Meetings',
- description: 'List meetings with optional filtering and pagination',
- audience: 'both',
- aiMetadata: { description: 'List Fathom meeting recordings, optionally narrowed by filters such as calendar invitees, invitee domains, recorder email, team, and created-before/after timestamps; with no filters it returns all accessible meetings. Use to discover meetings or find a recording ID for other actions. Set the include-transcript / summary / action-items / CRM-matches flags to embed that data per meeting. Read-only and repeatable; use the cursor for pagination.', idempotent: true },
+ description: 'List meetings with optional filters. Follows every page unless you set Max Pages.',
+ audience: 'human',
+ aiMetadata: {
+ description:
+ 'Lists Fathom meetings with filters (invitee domains, internal/external, recorder, team, created window) and optional embedded transcript, summary, action items and CRM matches, following pages to the end unless a page limit is set. Agents should prefer List Meetings (AI), which returns one page at a time. Transcript and summary flags need an API-key connection. Read-only and idempotent.',
+ idempotent: true,
+ },
auth: fathomAuth,
props: {
calendar_invitees: Property.Array({
displayName: 'Calendar Invitees',
- description: 'Email addresses of calendar invitees to filter by',
+ description: 'Email addresses of calendar invitees to filter by. Fathom no longer documents this filter and may ignore it; prefer Calendar Invitees Domains or Recorded By.',
required: false,
}),
calendar_invitees_domains: Property.Array({
@@ -56,13 +63,13 @@ export const listMeetings = createAction({
}),
include_transcript: Property.Checkbox({
displayName: 'Include Transcript',
- description: 'Include the transcript for each meeting',
+ description: 'Include the transcript for each meeting. API key connections only; with OAuth use Get Recording Transcript.',
required: false,
defaultValue: false,
}),
include_summary: Property.Checkbox({
displayName: 'Include Summary',
- description: 'Include the summary for each meeting',
+ description: 'Include the summary for each meeting. API key connections only; with OAuth use Get Recording Summary.',
required: false,
defaultValue: false,
}),
@@ -83,67 +90,75 @@ export const listMeetings = createAction({
description: 'Cursor for pagination (from previous response)',
required: false,
}),
+ max_pages: Property.Number({
+ displayName: 'Max Pages',
+ description: 'Stop after this many pages of meetings. Leave empty to fetch every page (each page holds about 10 meetings).',
+ required: false,
+ }),
},
+ outputSchema: fathomOutputSchemas.legacyMeetingPages,
async run({ auth, propsValue }) {
- const fathom = getFathomClient(auth);
-
- const request: Partial<ListMeetingsRequest> = {};
-
- if (propsValue.calendar_invitees && Array.isArray(propsValue.calendar_invitees)) {
- request.calendarInvitees = propsValue.calendar_invitees as string[];
- }
-
- if (propsValue.calendar_invitees_domains && Array.isArray(propsValue.calendar_invitees_domains)) {
- request.calendarInviteesDomains = propsValue.calendar_invitees_domains as string[];
- }
-
- if (propsValue.calendar_invitees_domains_type && propsValue.calendar_invitees_domains_type !== 'all') {
- request.calendarInviteesDomainsType = propsValue.calendar_invitees_domains_type as 'only_internal' | 'one_or_more_external';
- }
-
- if (propsValue.recorded_by && Array.isArray(propsValue.recorded_by)) {
- request.recordedBy = propsValue.recorded_by as string[];
- }
-
- if (propsValue.teams && Array.isArray(propsValue.teams)) {
- request.teams = propsValue.teams as string[];
- }
-
- if (propsValue.created_after) {
- request.createdAfter = propsValue.created_after;
+ const maxPages = parseMaxPages({ value: propsValue.max_pages });
+ const wantsHeavyContent = propsValue.include_summary === true || propsValue.include_transcript === true;
+ if (wantsHeavyContent && auth.type !== AppConnectionType.SECRET_TEXT) {
+ throw new Error(
+ 'Fathom does not return summaries or transcripts in List Meetings for OAuth connections. Turn off Include Summary and Include Transcript and use Get Recording Summary or Get Recording Transcript, or connect with an API key.'
+ );
}
-
- if (propsValue.created_before) {
- request.createdBefore = propsValue.created_before;
+ const { sdk, requireResult } = fathomSdk.create({ auth });
+ const calendarInvitees = fathomInputs.stringList({ value: propsValue.calendar_invitees });
+ const calendarInviteesDomains = fathomInputs.stringList({ value: propsValue.calendar_invitees_domains });
+ const recordedBy = fathomInputs.stringList({ value: propsValue.recorded_by });
+ const teams = fathomInputs.stringList({ value: propsValue.teams });
+ const domainsType = propsValue.calendar_invitees_domains_type;
+ const createdAfter = fathomInputs.optionalText({ value: propsValue.created_after });
+ const createdBefore = fathomInputs.optionalText({ value: propsValue.created_before });
+ const cursor = fathomInputs.optionalText({ value: propsValue.cursor });
+
+ const iterator = await sdk.listMeetings({
+ ...(calendarInvitees ? { calendarInvitees } : {}),
+ ...(calendarInviteesDomains ? { calendarInviteesDomains } : {}),
+ ...(domainsType === 'only_internal' || domainsType === 'one_or_more_external' ? { calendarInviteesDomainsType: domainsType } : {}),
+ ...(recordedBy ? { recordedBy } : {}),
+ ...(teams ? { teams } : {}),
+ ...(createdAfter ? { createdAfter } : {}),
+ ...(createdBefore ? { createdBefore } : {}),
+ ...(propsValue.include_transcript ? { includeTranscript: true } : {}),
+ ...(propsValue.include_summary ? { includeSummary: true } : {}),
+ ...(propsValue.include_action_items ? { includeActionItems: true } : {}),
+ ...(propsValue.include_crm_matches ? { includeCrmMatches: true } : {}),
+ ...(cursor ? { cursor } : {}),
+ });
+
+ const pages = [];
+ try {
+ for await (const page of iterator) {
+ pages.push(requireResult({ value: page, operation: 'List Meetings' }));
+ if (maxPages !== undefined && pages.length >= maxPages) {
+ break;
+ }
+ }
+ } catch (error) {
+ if (error instanceof FathomApiError && pages.length > 0) {
+ throw new FathomApiError({
+ status: error.status,
+ responseBody: error.responseBody,
+ message: `${error.message} ${pages.length} page(s) were read before the failure; set Max Pages to fetch fewer pages per run.`,
+ });
+ }
+ throw error;
}
-
- if (propsValue.include_transcript) {
- request.includeTranscript = true;
- }
-
- if (propsValue.include_summary) {
- request.includeSummary = true;
- }
-
- if (propsValue.include_action_items) {
- request.includeActionItems = true;
- }
-
- if (propsValue.include_crm_matches) {
- request.includeCrmMatches = true;
- }
-
- if (propsValue.cursor) {
- request.cursor = propsValue.cursor;
- }
-
- const response = await fathom.listMeetings(request);
-
- const meetings = [];
- for await (const meeting of response) {
- meetings.push(meeting);
- }
-
- return meetings;
+ return pages;
},
});
+
+function parseMaxPages({ value }: { value: unknown }): number | undefined {
+ if (value === undefined || value === null || value === '') {
+ return undefined;
+ }
+ const pages = Number(value);
+ if (!Number.isInteger(pages) || pages < 1) {
+ throw new Error('Max Pages must be a whole number of 1 or more, or empty to fetch every page.');
+ }
+ return pages;
+}
diff --git a/packages/pieces/community/fathom/src/lib/actions/list-users.ts b/packages/pieces/community/fathom/src/lib/actions/list-users.ts
new file mode 100644
index 00000000000..3515557654b
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/list-users.ts
@@ -0,0 +1,65 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { fathomClient } from '../common/client';
+import { fathomInputs } from '../common/props';
+import { fathomOutputSchemas } from '../output-schemas';
+
+export const listUsers = createAction({
+ name: 'list_users',
+ classification: 'SEARCH',
+ displayName: 'List Users and Permissions',
+ description: 'List the users of your Fathom account with their status and permissions. Needs an account admin connection.',
+ audience: 'both',
+ aiMetadata: {
+ description:
+ 'Lists users of the Fathom account with status and their settings and view permissions, one page per call with a cursor, optionally filtered by team, status or admin level. Requires the connected user to be an account admin (403 otherwise); the invited status cannot be combined with an admin level filter. Read-only and idempotent.',
+ idempotent: true,
+ },
+ auth: fathomAuth,
+ props: {
+ team: Property.ShortText({ displayName: 'Team', description: 'Exact team name to filter by (see Find Team).', required: false }),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: {
+ options: [
+ { label: 'Active', value: 'active' },
+ { label: 'Deactivated', value: 'deactivated' },
+ { label: 'Invited', value: 'invited' },
+ ],
+ },
+ }),
+ settings_access: Property.StaticDropdown({
+ displayName: 'Admin Level',
+ description: 'Filter by settings access. Not available together with Status = Invited.',
+ required: false,
+ options: {
+ options: [
+ { label: 'None', value: 'none' },
+ { label: 'Team Admin', value: 'team_admin' },
+ { label: 'Account Admin', value: 'account_admin' },
+ ],
+ },
+ }),
+ cursor: Property.ShortText({ displayName: 'Cursor', description: 'next_cursor from the previous call.', required: false }),
+ },
+ outputSchema: fathomOutputSchemas.users,
+ async run({ auth, propsValue }) {
+ const status = fathomInputs.optionalText({ value: propsValue.status });
+ const settingsAccess = fathomInputs.optionalText({ value: propsValue.settings_access });
+ if (status === 'invited' && settingsAccess !== undefined) {
+ throw new Error('Fathom cannot filter invited users by admin level. Clear Admin Level or pick another status.');
+ }
+ const page = await fathomClient.listPage({
+ auth,
+ path: 'users',
+ query: {
+ team: fathomInputs.optionalText({ value: propsValue.team }),
+ status,
+ settings_access: settingsAccess,
+ cursor: fathomInputs.optionalText({ value: propsValue.cursor }),
+ },
+ });
+ return { items: page.items, next_cursor: page.next_cursor, has_more: page.next_cursor !== null };
+ },
+});
diff --git a/packages/pieces/community/fathom/src/lib/actions/request-recording-download.ts b/packages/pieces/community/fathom/src/lib/actions/request-recording-download.ts
new file mode 100644
index 00000000000..bc791a9d52d
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/actions/request-recording-download.ts
@@ -0,0 +1,28 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { createAction } from '@activepieces/pieces-framework';
+import { fathomAuth } from '../common/auth';
+import { fathomClient } from '../common/client';
+import { fathomInputs, fathomProps } from '../common/props';
+import { fathomOutputSchemas } from '../output-schemas';
+
+export const requestRecordingDownload = createAction({
+ name: 'request_recording_download',
+ classification: 'WRITE',
+ displayName: 'Request Recording Download',
+ description: 'Ask Fathom to prepare a video or audio file of a recording. Then use Get Recording Download to get the file link.',
+ audience: 'both',
+ aiMetadata: {
+ description:
+ 'Starts generating a downloadable video or audio file for one Fathom recording and returns a download_id with status; audio-only recordings may complete immediately with the file URL. Then call Get Recording Download until status is completed; URLs expire after about 24 hours. Fails with 403 for limited-access shares and 422 when there is no media. Not idempotent: each call creates a new download job.',
+ idempotent: false,
+ },
+ auth: fathomAuth,
+ props: {
+ recording_id: fathomProps.recordingIdText({ description: 'The numeric recording_id from New Recording or List Meetings.' }),
+ },
+ outputSchema: fathomOutputSchemas.download,
+ async run({ auth, propsValue }) {
+ const recordingId = fathomInputs.parseRecordingId({ value: propsValue.recording_id });
+ return fathomClient.requestObject({ auth, method: HttpMethod.POST, path: `recordings/${recordingId}/download`, body: {} });
+ },
+});
diff --git a/packages/pieces/community/fathom/src/lib/common/auth.ts b/packages/pieces/community/fathom/src/lib/common/auth.ts
index 26bf59cfc8e..d5201b86f9a 100644
--- a/packages/pieces/community/fathom/src/lib/common/auth.ts
+++ b/packages/pieces/community/fathom/src/lib/common/auth.ts
@@ -1,10 +1,9 @@
+import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { PieceAuth, AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
-import { AppConnectionType } from '@activepieces/pieces-framework';
-import { Fathom } from 'fathom-typescript';
const fathomOAuth2Auth = PieceAuth.OAuth2({
displayName: 'Sign in with Fathom',
- description: 'Connect your Fathom account using OAuth2.',
+ description: 'Connect your Fathom account using OAuth2. Under OAuth, List Meetings cannot embed summaries or transcripts; use Get Recording Summary and Get Recording Transcript instead.',
authUrl: 'https://fathom.video/external/v1/oauth2/authorize',
tokenUrl: 'https://fathom.video/external/v1/oauth2/token',
required: true,
@@ -13,17 +12,42 @@ const fathomOAuth2Auth = PieceAuth.OAuth2({
const fathomApiKeyAuth = PieceAuth.SecretText({
displayName: 'API Key',
- description: 'Enter your Fathom API key',
+ description: `To get your Fathom API key:
+1. Sign in to Fathom and open **Settings**.
+2. Go to **API Access**.
+3. Click **Generate API Key**, give it a name and copy the key.
+4. Paste it here.`,
required: true,
+ validate: async ({ auth }) => {
+ try {
+ await httpClient.sendRequest({
+ method: HttpMethod.GET,
+ url: 'https://api.fathom.ai/external/v1/teams',
+ headers: { 'X-Api-Key': auth.trim(), Accept: 'application/json' },
+ timeout: 30000,
+ });
+ return { valid: true };
+ } catch (error) {
+ const status = statusOf(error);
+ if (status === 401 || status === 403) {
+ return { valid: false, error: 'Fathom did not accept this API key. Generate a new one in Settings > API Access.' };
+ }
+ return { valid: false, error: `Could not reach Fathom to check the API key${status === undefined ? '' : ` (HTTP ${status})`}. Try again in a minute.` };
+ }
+ },
});
-export const fathomAuth = [fathomOAuth2Auth, fathomApiKeyAuth];
-
-export function getFathomClient(auth: FathomAuthValue): Fathom {
- if (auth.type === AppConnectionType.SECRET_TEXT) {
- return new Fathom({ security: { apiKeyAuth: auth.secret_text } });
+function statusOf(error: unknown): number | undefined {
+ if (typeof error !== 'object' || error === null || !('response' in error)) {
+ return undefined;
+ }
+ const response = error.response;
+ if (typeof response !== 'object' || response === null || !('status' in response)) {
+ return undefined;
}
- return new Fathom({ security: { bearerAuth: auth.access_token } });
+ return typeof response.status === 'number' ? response.status : undefined;
}
+export const fathomAuth = [fathomOAuth2Auth, fathomApiKeyAuth];
+
export type FathomAuthValue = AppConnectionValueForAuthProperty<typeof fathomAuth>;
diff --git a/packages/pieces/community/fathom/src/lib/common/client.ts b/packages/pieces/community/fathom/src/lib/common/client.ts
new file mode 100644
index 00000000000..33ee4a1648c
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/common/client.ts
@@ -0,0 +1,227 @@
+import { httpClient, HttpMethod, HttpResponse } from '@activepieces/pieces-common';
+import { AppConnectionType } from '@activepieces/pieces-framework';
+import { FathomAuthValue } from './auth';
+
+const FATHOM_BASE_URL = 'https://api.fathom.ai/external/v1';
+const RATE_LIMIT_WAITS_MS = [10000, 20000];
+const REQUEST_TIMEOUT_MS = 60000;
+
+export class FathomApiError extends Error {
+ readonly status: number;
+ readonly responseBody: unknown;
+
+ constructor({ status, message, responseBody }: { status: number; message: string; responseBody: unknown }) {
+ super(message);
+ this.name = 'FathomApiError';
+ this.status = status;
+ this.responseBody = responseBody;
+ }
+}
+
+function isRecord(value: unknown): value is Record<string, unknown> {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+}
+
+function vendorDetail(body: unknown): string {
+ if (isRecord(body)) {
+ for (const key of ['message', 'error', 'detail', 'errors']) {
+ const value = body[key];
+ if (typeof value === 'string' && value.trim().length > 0) {
+ return withoutTrailingPeriods({ text: value.trim().slice(0, 300) });
+ }
+ if (Array.isArray(value) && value.length > 0) {
+ return JSON.stringify(value).slice(0, 300);
+ }
+ }
+ return JSON.stringify(body).slice(0, 300);
+ }
+ if (typeof body === 'string' && body.trim().length > 0) {
+ return withoutTrailingPeriods({ text: body.trim().slice(0, 300) });
+ }
+ return 'no details returned';
+}
+
+function withoutTrailingPeriods({ text }: { text: string }): string {
+ let end = text.length;
+ while (end > 0 && text[end - 1] === '.') {
+ end--;
+ }
+ return text.slice(0, end);
+}
+
+function fathomErrorMessage({ status, responseBody }: { status: number; responseBody: unknown }): string {
+ const detail = vendorDetail(responseBody);
+ switch (status) {
+ case 400:
+ return `Fathom rejected the request (400): ${detail}. Check the values you entered (dates as ISO 8601, exact team and meeting type names).`;
+ case 401:
+ return `Fathom did not accept the connection (401): ${detail}. Reconnect your Fathom account or generate a new API key.`;
+ case 403:
+ return `Fathom refused access (403): ${detail}. The connected Fathom user lacks permission for this data: listing users needs an account admin, and limited-access shares cannot be downloaded.`;
+ case 404:
+ return `Fathom could not find it (404): ${detail}. Check the recording or download ID.`;
+ case 422:
+ return `Fathom could not process the request (422): ${detail}. Only recordings with video or audio can be downloaded.`;
+ case 429:
+ return `Fathom rate limit reached (429): ${detail}. Fathom allows about 60 requests per minute (fewer for summaries and transcripts); wait a minute and try again.`;
+ default:
+ return `Fathom request failed with HTTP ${status}: ${detail}.`;
+ }
+}
+
+function authHeaders(auth: FathomAuthValue): Record<string, string> {
+ if (auth.type === AppConnectionType.SECRET_TEXT) {
+ return { 'X-Api-Key': auth.secret_text.trim() };
+ }
+ return { Authorization: `Bearer ${auth.access_token}` };
+}
+
+function assertRelativePath(path: string): void {
+ if (path.length === 0 || path.startsWith('/') || path.includes('://') || path.includes('..') || path.includes('\\') || path.includes('?') || path.includes('#')) {
+ throw new Error(`Refusing to call an unexpected Fathom path: "${path}".`);
+ }
+}
+
+function buildQueryString(query: Record<string, QueryValue>): string {
+ const params = new URLSearchParams();
+ for (const [key, value] of Object.entries(query)) {
+ if (value === undefined) {
+ continue;
+ }
+ if (Array.isArray(value)) {
+ for (const item of value) {
+ params.append(`${key}[]`, item);
+ }
+ continue;
+ }
+ params.append(key, String(value));
+ }
+ const text = params.toString();
+ return text.length > 0 ? `?${text}` : '';
+}
+
+function statusOf(error: unknown): { status: number; responseBody: unknown } | undefined {
+ const response = isRecord(error) && isRecord(error['response']) ? error['response'] : undefined;
+ const status = response?.['status'];
+ if (typeof status !== 'number') {
+ return undefined;
+ }
+ return { status, responseBody: response?.['body'] };
+}
+
+function wait(ms: number): Promise<void> {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+}
+
+async function request<T>({
+ auth,
+ method,
+ path,
+ query,
+ body,
+}: {
+ auth: FathomAuthValue;
+ method: HttpMethod;
+ path: string;
+ query?: Record<string, QueryValue>;
+ body?: Record<string, unknown>;
+}): Promise<HttpResponse<T>> {
+ assertRelativePath(path);
+ const url = `${FATHOM_BASE_URL}/${path}${buildQueryString(query ?? {})}`;
+ for (let attempt = 0; ; attempt++) {
+ try {
+ return await httpClient.sendRequest<T>({
+ method,
+ url,
+ headers: { ...authHeaders(auth), Accept: 'application/json', ...(body === undefined ? {} : { 'Content-Type': 'application/json' }) },
+ body,
+ timeout: REQUEST_TIMEOUT_MS,
+ });
+ } catch (error) {
+ const failure = statusOf(error);
+ if (failure === undefined) {
+ throw error;
+ }
+ if (failure.status === 429 && attempt < RATE_LIMIT_WAITS_MS.length) {
+ await wait(RATE_LIMIT_WAITS_MS[attempt]);
+ continue;
+ }
+ throw new FathomApiError({ ...failure, message: fathomErrorMessage(failure) });
+ }
+ }
+}
+
+async function requestObject({
+ auth,
+ method,
+ path,
+ query,
+ body,
+}: Parameters<typeof request>[0]): Promise<Record<string, unknown>> {
+ const response = await request<unknown>({ auth, method, path, query, body });
+ if (!isRecord(response.body)) {
+ throw new Error(`Fathom returned an unexpected response for ${path}: ${JSON.stringify(response.body ?? null).slice(0, 200)}`);
+ }
+ return response.body;
+}
+
+async function listPage({
+ auth,
+ path,
+ query,
+}: {
+ auth: FathomAuthValue;
+ path: string;
+ query?: Record<string, QueryValue>;
+}): Promise<FathomPage> {
+ const body = await requestObject({ auth, method: HttpMethod.GET, path, query });
+ const items = Array.isArray(body['items']) ? body['items'].filter(isRecord) : [];
+ const cursor = body['next_cursor'];
+ const limit = body['limit'];
+ return {
+ items,
+ next_cursor: typeof cursor === 'string' && cursor.length > 0 ? cursor : null,
+ limit: typeof limit === 'number' ? limit : null,
+ };
+}
+
+async function listPages({
+ auth,
+ path,
+ query,
+ maxPages,
+ stopWhen,
+}: {
+ auth: FathomAuthValue;
+ path: string;
+ query?: Record<string, QueryValue>;
+ maxPages: number;
+ stopWhen?: (items: Record<string, unknown>[]) => boolean;
+}): Promise<{ items: Record<string, unknown>[]; truncated: boolean; pages: number }> {
+ const items: Record<string, unknown>[] = [];
+ let cursor: string | undefined = undefined;
+ for (let pages = 1; pages <= maxPages; pages++) {
+ const page: FathomPage = await listPage({ auth, path, query: { ...query, cursor } });
+ items.push(...page.items);
+ if (page.next_cursor === null || (stopWhen !== undefined && stopWhen(page.items))) {
+ return { items, truncated: false, pages };
+ }
+ cursor = page.next_cursor;
+ }
+ return { items, truncated: true, pages: maxPages };
+}
+
+export const fathomClient = {
+ baseUrl: FATHOM_BASE_URL,
+ request,
+ requestObject,
+ listPage,
+ listPages,
+ authHeaders,
+ isRecord,
+ errorMessage: fathomErrorMessage,
+ buildQueryString,
+};
+
+export type QueryValue = string | number | boolean | string[] | undefined;
+export type FathomPage = { items: Record<string, unknown>[]; next_cursor: string | null; limit: number | null };
diff --git a/packages/pieces/community/fathom/src/lib/common/legacy.ts b/packages/pieces/community/fathom/src/lib/common/legacy.ts
new file mode 100644
index 00000000000..efe06a5a172
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/common/legacy.ts
@@ -0,0 +1,42 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { FathomAuthValue } from './auth';
+import { fathomClient, QueryValue } from './client';
+
+async function listInSdkShape({
+ auth,
+ path,
+ query,
+ fields,
+}: {
+ auth: FathomAuthValue;
+ path: string;
+ query: Record<string, QueryValue>;
+ fields: string[];
+}): Promise<{ result: { limit: number | null; nextCursor: string | null; items: Record<string, unknown>[] } }> {
+ const body = await fathomClient.requestObject({ auth, method: HttpMethod.GET, path, query });
+ const rawItems = Array.isArray(body['items']) ? body['items'].filter(fathomClient.isRecord) : [];
+ const limit = body['limit'];
+ const cursor = body['next_cursor'];
+ return {
+ result: {
+ limit: typeof limit === 'number' ? limit : null,
+ nextCursor: typeof cursor === 'string' ? cursor : null,
+ items: rawItems.map((item) => toCamelItem({ item, fields })),
+ },
+ };
+}
+
+function toCamelItem({ item, fields }: { item: Record<string, unknown>; fields: string[] }): Record<string, unknown> {
+ const picked = Object.fromEntries(fields.map((field) => [field, item[field]]));
+ return { ...picked, createdAt: isoWithMillis({ value: item['created_at'] }) };
+}
+
+function isoWithMillis({ value }: { value: unknown }): unknown {
+ if (typeof value !== 'string') {
+ return value;
+ }
+ const date = new Date(value);
+ return Number.isNaN(date.getTime()) ? value : date.toISOString();
+}
+
+export const fathomLegacy = { listInSdkShape, isoWithMillis };
diff --git a/packages/pieces/community/fathom/src/lib/common/props.ts b/packages/pieces/community/fathom/src/lib/common/props.ts
new file mode 100644
index 00000000000..3c632475e34
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/common/props.ts
@@ -0,0 +1,118 @@
+import { Property } from '@activepieces/pieces-framework';
+import { fathomAuth } from './auth';
+import { FathomApiError, fathomClient } from './client';
+
+function recordingDropdown({ description }: { description: string }) {
+ return Property.Dropdown({
+ auth: fathomAuth,
+ displayName: 'Meeting Recording',
+ description,
+ required: true,
+ refreshers: [],
+ options: async ({ auth }) => {
+ if (!auth) {
+ return { disabled: true, options: [], placeholder: 'Please connect your Fathom account first' };
+ }
+ try {
+ const result = await fathomClient.listPages({ auth, path: 'meetings', maxPages: DROPDOWN_MAX_PAGES });
+ const options = result.items.flatMap((meeting) => {
+ const recordingId = meeting['recording_id'];
+ return typeof recordingId === 'number' ? [{ label: meetingLabel(meeting), value: recordingId }] : [];
+ });
+ if (options.length === 0) {
+ return { disabled: false, options: [], placeholder: 'No recorded meetings found in this Fathom account' };
+ }
+ return {
+ disabled: false,
+ options,
+ placeholder: result.truncated
+ ? `Showing the ${DROPDOWN_MAX_PAGES} most recent pages of meetings; for older ones use the recording ID from List Meetings`
+ : undefined,
+ };
+ } catch (error) {
+ return { disabled: true, options: [], placeholder: dropdownError(error) };
+ }
+ },
+ });
+}
+
+function meetingLabel(meeting: Record<string, unknown>): string {
+ const title = typeof meeting['title'] === 'string' && meeting['title'].length > 0 ? meeting['title'] : 'Untitled meeting';
+ const when = [meeting['scheduled_start_time'], meeting['created_at']].find((v): v is string => typeof v === 'string');
+ return when === undefined ? title : `${title} · ${when.slice(0, 10)}`;
+}
+
+function dropdownError(error: unknown): string {
+ if (error instanceof FathomApiError) {
+ if (error.status === 401) {
+ return 'Fathom did not accept the connection (401). Reconnect your Fathom account.';
+ }
+ if (error.status === 429) {
+ return 'Fathom rate limit reached (429). Wait a minute and reopen this list.';
+ }
+ return `Failed to load meetings (HTTP ${error.status}).`;
+ }
+ return 'Failed to load meetings. Please check your connection.';
+}
+
+function recordingIdText({ description }: { description: string }) {
+ return Property.ShortText({
+ displayName: 'Recording ID',
+ description,
+ required: true,
+ });
+}
+
+function parseRecordingId({ value }: { value: unknown }): number {
+ const text = typeof value === 'number' ? String(value) : typeof value === 'string' ? value.trim() : '';
+ if (!/^\d{1,15}$/.test(text)) {
+ throw new Error('Recording ID must be the numeric recording_id from New Recording or List Meetings (for example 123456789).');
+ }
+ return Number(text);
+}
+
+function stringList({ value }: { value: unknown }): string[] | undefined {
+ if (!Array.isArray(value)) {
+ return undefined;
+ }
+ const items = value
+ .map((item) => (typeof item === 'string' ? item.trim() : typeof item === 'number' ? String(item) : ''))
+ .filter((item) => item.length > 0);
+ return items.length > 0 ? items : undefined;
+}
+
+function optionalText({ value }: { value: unknown }): string | undefined {
+ if (typeof value !== 'string') {
+ return undefined;
+ }
+ const text = value.trim();
+ return text.length > 0 ? text : undefined;
+}
+
+function optionalTimestamp({ value, label }: { value: unknown; label: string }): string | undefined {
+ const text = optionalText({ value });
+ if (text === undefined) {
+ return undefined;
+ }
+ const parsed = new Date(text);
+ if (Number.isNaN(parsed.getTime())) {
+ throw new Error(`${label} must be an ISO 8601 date-time such as 2026-01-31T00:00:00Z.`);
+ }
+ return parsed.toISOString().replace('.000Z', 'Z');
+}
+
+const DROPDOWN_MAX_PAGES = 10;
+
+export const fathomProps = {
+ recordingDropdown,
+ recordingIdText,
+};
+
+export const fathomInputs = {
+ parseRecordingId,
+ stringList,
+ optionalText,
+ optionalTimestamp,
+ meetingLabel,
+ DROPDOWN_MAX_PAGES,
+};
diff --git a/packages/pieces/community/fathom/src/lib/common/sdk.ts b/packages/pieces/community/fathom/src/lib/common/sdk.ts
new file mode 100644
index 00000000000..9887d2bd130
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/common/sdk.ts
@@ -0,0 +1,58 @@
+import { AppConnectionType } from '@activepieces/pieces-framework';
+import { Fathom, HTTPClient } from 'fathom-typescript';
+import { FathomAuthValue } from './auth';
+import { FathomApiError, fathomClient } from './client';
+
+function createSdk({ auth }: { auth: FathomAuthValue }): FathomSdk {
+ const failures: Failure[] = [];
+ const httpClient = new HTTPClient();
+ httpClient.addHook('response', async (response) => {
+ if (response.ok) {
+ return;
+ }
+ const text = await response.clone().text().catch(() => '');
+ failures.push({ status: response.status, responseBody: parseBody(text) });
+ });
+ const security = auth.type === AppConnectionType.SECRET_TEXT ? { apiKeyAuth: auth.secret_text.trim() } : { bearerAuth: auth.access_token };
+ const sdk = new Fathom({
+ security,
+ httpClient,
+ timeoutMs: 60000,
+ retryConfig: {
+ strategy: 'backoff',
+ backoff: { initialInterval: 5000, maxInterval: 20000, exponent: 1.5, maxElapsedTime: 45000 },
+ retryConnectionErrors: false,
+ },
+ });
+ function requireResult<T>({ value, operation }: { value: T | undefined | null; operation: string }): T {
+ if (value !== undefined && value !== null) {
+ return value;
+ }
+ const failure = failures[failures.length - 1];
+ if (failure === undefined) {
+ throw new Error(`Fathom returned no data for ${operation}. Try again; if it keeps happening, reconnect your Fathom account.`);
+ }
+ throw new FathomApiError({ ...failure, message: fathomClient.errorMessage(failure) });
+ }
+ return { sdk, requireResult };
+}
+
+function parseBody(text: string): unknown {
+ if (text.length === 0) {
+ return '';
+ }
+ try {
+ const parsed: unknown = JSON.parse(text);
+ return parsed;
+ } catch {
+ return text;
+ }
+}
+
+export const fathomSdk = { create: createSdk };
+
+type Failure = { status: number; responseBody: unknown };
+export type FathomSdk = {
+ sdk: Fathom;
+ requireResult: <T>(args: { value: T | undefined | null; operation: string }) => T;
+};
diff --git a/packages/pieces/community/fathom/src/lib/common/webhook.ts b/packages/pieces/community/fathom/src/lib/common/webhook.ts
new file mode 100644
index 00000000000..022aa75b6fc
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/common/webhook.ts
@@ -0,0 +1,115 @@
+import { createHash, createHmac, timingSafeEqual } from 'node:crypto';
+
+function verifySignature({
+ secret,
+ headers,
+ rawBody,
+ nowSeconds,
+}: {
+ secret: string;
+ headers: Record<string, string | string[] | undefined>;
+ rawBody: unknown;
+ nowSeconds: number;
+}): { valid: true; webhookId: string; timestamp: number } | { valid: false; reason: string } {
+ const lower = lowerCaseHeaders({ headers });
+ const webhookId = lower['webhook-id'];
+ const timestamp = lower['webhook-timestamp'];
+ const signatures = lower['webhook-signature'];
+ if (webhookId === undefined || timestamp === undefined || signatures === undefined) {
+ return { valid: false, reason: 'missing signature headers' };
+ }
+ if (!/^\d{1,12}$/.test(timestamp)) {
+ return { valid: false, reason: 'bad timestamp' };
+ }
+ if (Math.abs(nowSeconds - Number(timestamp)) > TOLERANCE_SECONDS) {
+ return { valid: false, reason: 'timestamp outside the tolerance window' };
+ }
+ const body = typeof rawBody === 'string' ? rawBody : Buffer.isBuffer(rawBody) ? rawBody.toString('utf8') : undefined;
+ if (body === undefined) {
+ return { valid: false, reason: 'raw body unavailable' };
+ }
+ const key = secretKey({ secret });
+ if (key.length === 0) {
+ return { valid: false, reason: 'empty secret' };
+ }
+ const expected = createHmac('sha256', key).update(`${webhookId}.${timestamp}.${body}`).digest();
+ const matches = signatures
+ .split(' ')
+ .filter((entry) => entry.startsWith('v1,'))
+ .some((entry) => {
+ const given = Buffer.from(entry.slice(3), 'base64');
+ return given.length === expected.length && timingSafeEqual(given, expected);
+ });
+ return matches ? { valid: true, webhookId, timestamp: Number(timestamp) } : { valid: false, reason: 'signature mismatch' };
+}
+
+function secretKey({ secret }: { secret: string }): Buffer {
+ const trimmed = secret.trim();
+ const encoded = trimmed.startsWith('whsec_') ? trimmed.slice('whsec_'.length) : trimmed;
+ return Buffer.from(encoded, 'base64');
+}
+
+function lowerCaseHeaders({ headers }: { headers: Record<string, string | string[] | undefined> }): Record<string, string | undefined> {
+ return Object.fromEntries(
+ Object.entries(headers).map(([name, value]) => [name.toLowerCase(), Array.isArray(value) ? value.join(' ') : value])
+ );
+}
+
+function rememberDelivery({
+ seen,
+ deliveryKey,
+ timestamp,
+ nowSeconds,
+}: {
+ seen: unknown;
+ deliveryKey: string;
+ timestamp: number;
+ nowSeconds: number;
+}): { status: 'new' | 'duplicate' | 'full'; seen: SeenDelivery[]; expired: string[] } {
+ const entries = Array.isArray(seen) ? seen.filter(isSeenDelivery) : [];
+ const live = entries.filter((entry) => nowSeconds - entry.ts <= TOLERANCE_SECONDS);
+ const expired = entries.filter((entry) => nowSeconds - entry.ts > TOLERANCE_SECONDS).map((entry) => entry.id);
+ if (live.some((entry) => entry.id === deliveryKey)) {
+ return { status: 'duplicate', seen: live, expired };
+ }
+ if (live.length >= MAX_SEEN_IDS) {
+ return { status: 'full', seen: live, expired };
+ }
+ return { status: 'new', seen: [...live, { id: deliveryKey, ts: timestamp }], expired };
+}
+
+function seenDeliveryKeys({ seen }: { seen: unknown }): string[] {
+ return Array.isArray(seen) ? seen.filter(isSeenDelivery).map((entry) => entry.id) : [];
+}
+
+function deliveryKeyOf({ webhookId }: { webhookId: string }): string {
+ return createHash('sha256').update(webhookId).digest('hex').slice(0, 40);
+}
+
+function isSeenDelivery(value: unknown): value is SeenDelivery {
+ if (typeof value !== 'object' || value === null) {
+ return false;
+ }
+ const id: unknown = Reflect.get(value, 'id');
+ const ts: unknown = Reflect.get(value, 'ts');
+ return typeof id === 'string' && typeof ts === 'number' && Number.isFinite(ts);
+}
+
+function sign({ secret, webhookId, timestamp, body }: { secret: string; webhookId: string; timestamp: number; body: string }): string {
+ return `v1,${createHmac('sha256', secretKey({ secret })).update(`${webhookId}.${timestamp}.${body}`).digest('base64')}`;
+}
+
+const TOLERANCE_SECONDS = 900;
+const MAX_SEEN_IDS = 2000;
+
+type SeenDelivery = { id: string; ts: number };
+
+export const fathomWebhook = {
+ verifySignature,
+ rememberDelivery,
+ deliveryKeyOf,
+ seenDeliveryKeys,
+ sign,
+ TOLERANCE_SECONDS,
+ MAX_SEEN_IDS,
+};
diff --git a/packages/pieces/community/fathom/src/lib/output-schemas.ts b/packages/pieces/community/fathom/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..bcf4cdc711f
--- /dev/null
+++ b/packages/pieces/community/fathom/src/lib/output-schemas.ts
@@ -0,0 +1,420 @@
+import { OutputSchema, OutputSchemaField } from '@activepieces/pieces-framework';
+
+const transcriptSnake: OutputSchemaField[] = [
+ {
+ key: 'speaker',
+ label: 'Speaker',
+ children: [
+ { key: 'display_name', label: 'Name' },
+ { key: 'matched_calendar_invitee_email', label: 'Matched Invitee Email', format: 'email' },
+ ],
+ },
+ { key: 'text', label: 'Text' },
+ { key: 'timestamp', label: 'Timestamp (HH:MM:SS)' },
+];
+
+const summarySnake: OutputSchemaField[] = [
+ { key: 'template_name', label: 'Template' },
+ { key: 'markdown_formatted', label: 'Summary (Markdown)' },
+];
+
+const meetingFieldsSnake: OutputSchemaField[] = [
+ { key: 'recording_id', label: 'Recording ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'meeting_title', label: 'Calendar Event Title' },
+ { key: 'meeting_type', label: 'Meeting Type' },
+ { key: 'url', label: 'Fathom URL', format: 'url' },
+ { key: 'share_url', label: 'Share URL', format: 'url' },
+ { key: 'meeting_url', label: 'Meeting Link', format: 'url', description: 'The Zoom, Meet or Teams link of the call, when known.' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'scheduled_start_time', label: 'Scheduled Start', format: 'datetime' },
+ { key: 'scheduled_end_time', label: 'Scheduled End', format: 'datetime' },
+ { key: 'recording_start_time', label: 'Recording Start', format: 'datetime' },
+ { key: 'recording_end_time', label: 'Recording End', format: 'datetime' },
+ { key: 'calendar_invitees_domains_type', label: 'Invitee Domains Type', description: 'only_internal or one_or_more_external.' },
+ { key: 'shared_with', label: 'Shared With', description: 'no_teams, single_team, multiple_teams or all_teams.' },
+ { key: 'transcript_language', label: 'Transcript Language' },
+ {
+ key: 'recorded_by',
+ label: 'Recorded By',
+ children: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'email_domain', label: 'Email Domain' },
+ { key: 'team', label: 'Team' },
+ ],
+ },
+ {
+ key: 'calendar_invitees',
+ label: 'Calendar Invitees',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'email_domain', label: 'Email Domain' },
+ { key: 'is_external', label: 'External', format: 'boolean' },
+ { key: 'matched_speaker_display_name', label: 'Matched Speaker' },
+ ],
+ },
+ { key: 'default_summary', label: 'Summary', description: 'Only when summaries are included.', children: summarySnake },
+ {
+ key: 'action_items',
+ label: 'Action Items',
+ labelKey: 'description',
+ description: 'Only when action items are included.',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'completed', label: 'Completed', format: 'boolean' },
+ { key: 'user_generated', label: 'Added by a User', format: 'boolean' },
+ { key: 'recording_timestamp', label: 'Recording Timestamp' },
+ { key: 'recording_playback_url', label: 'Playback URL', format: 'url' },
+ {
+ key: 'assignee',
+ label: 'Assignee',
+ children: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'team', label: 'Team' },
+ ],
+ },
+ ],
+ },
+ {
+ key: 'highlights',
+ label: 'Highlights',
+ labelKey: 'summary',
+ description: 'Only when highlights are included.',
+ listItems: [
+ { key: 'type', label: 'Type' },
+ { key: 'summary', label: 'Summary' },
+ { key: 'text', label: 'Text' },
+ { key: 'start_time', label: 'Start (seconds)', format: 'number' },
+ { key: 'end_time', label: 'End (seconds)', format: 'number' },
+ ],
+ },
+ { key: 'transcript', label: 'Transcript', description: 'Only when the transcript is included.', listItems: transcriptSnake },
+ {
+ key: 'crm_matches',
+ label: 'CRM Matches',
+ description: 'Only when CRM matches are included.',
+ children: [
+ {
+ key: 'contacts',
+ label: 'Contacts',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'record_url', label: 'Record URL', format: 'url' },
+ ],
+ },
+ {
+ key: 'companies',
+ label: 'Companies',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'record_url', label: 'Record URL', format: 'url' },
+ ],
+ },
+ {
+ key: 'deals',
+ label: 'Deals',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'amount', label: 'Amount', format: 'number' },
+ { key: 'record_url', label: 'Record URL', format: 'url' },
+ ],
+ },
+ { key: 'error', label: 'CRM Error', description: 'Set when no CRM is connected.' },
+ ],
+ },
+];
+
+const meetingFieldsCamel: OutputSchemaField[] = [
+ { key: 'recordingId', label: 'Recording ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'meetingTitle', label: 'Calendar Event Title' },
+ { key: 'url', label: 'Fathom URL', format: 'url' },
+ { key: 'shareUrl', label: 'Share URL', format: 'url' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ { key: 'scheduledStartTime', label: 'Scheduled Start', format: 'datetime' },
+ { key: 'scheduledEndTime', label: 'Scheduled End', format: 'datetime' },
+ { key: 'recordingStartTime', label: 'Recording Start', format: 'datetime' },
+ { key: 'recordingEndTime', label: 'Recording End', format: 'datetime' },
+ { key: 'calendarInviteesDomainsType', label: 'Invitee Domains Type' },
+ { key: 'transcriptLanguage', label: 'Transcript Language' },
+ {
+ key: 'recordedBy',
+ label: 'Recorded By',
+ children: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'emailDomain', label: 'Email Domain' },
+ { key: 'team', label: 'Team' },
+ ],
+ },
+ {
+ key: 'calendarInvitees',
+ label: 'Calendar Invitees',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'emailDomain', label: 'Email Domain' },
+ { key: 'isExternal', label: 'External', format: 'boolean' },
+ { key: 'matchedSpeakerDisplayName', label: 'Matched Speaker' },
+ ],
+ },
+ {
+ key: 'defaultSummary',
+ label: 'Summary',
+ description: 'Only when Include Summary is on.',
+ children: [
+ { key: 'templateName', label: 'Template' },
+ { key: 'markdownFormatted', label: 'Summary (Markdown)' },
+ ],
+ },
+ {
+ key: 'actionItems',
+ label: 'Action Items',
+ labelKey: 'description',
+ description: 'Only when Include Action Items is on.',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'completed', label: 'Completed', format: 'boolean' },
+ { key: 'userGenerated', label: 'Added by a User', format: 'boolean' },
+ { key: 'recordingTimestamp', label: 'Recording Timestamp' },
+ { key: 'recordingPlaybackUrl', label: 'Playback URL', format: 'url' },
+ {
+ key: 'assignee',
+ label: 'Assignee',
+ children: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'team', label: 'Team' },
+ ],
+ },
+ ],
+ },
+ {
+ key: 'transcript',
+ label: 'Transcript',
+ description: 'Only when Include Transcript is on.',
+ listItems: [
+ {
+ key: 'speaker',
+ label: 'Speaker',
+ children: [
+ { key: 'displayName', label: 'Name' },
+ { key: 'matchedCalendarInviteeEmail', label: 'Matched Invitee Email', format: 'email' },
+ ],
+ },
+ { key: 'text', label: 'Text' },
+ { key: 'timestamp', label: 'Timestamp (HH:MM:SS)' },
+ ],
+ },
+ {
+ key: 'crmMatches',
+ label: 'CRM Matches',
+ description: 'Only when Include CRM Matches is on.',
+ children: [
+ { key: 'contacts', label: 'Contacts', labelKey: 'name', listItems: [{ key: 'name', label: 'Name' }, { key: 'email', label: 'Email', format: 'email' }, { key: 'recordUrl', label: 'Record URL', format: 'url' }] },
+ { key: 'companies', label: 'Companies', labelKey: 'name', listItems: [{ key: 'name', label: 'Name' }, { key: 'recordUrl', label: 'Record URL', format: 'url' }] },
+ { key: 'deals', label: 'Deals', labelKey: 'name', listItems: [{ key: 'name', label: 'Name' }, { key: 'amount', label: 'Amount', format: 'number' }, { key: 'recordUrl', label: 'Record URL', format: 'url' }] },
+ { key: 'error', label: 'CRM Error' },
+ ],
+ },
+];
+
+const downloadFile: OutputSchemaField[] = [
+ { key: 'url', label: 'File URL', format: 'url', description: 'Signed URL; expires about 24 hours after generation.' },
+ { key: 'content_type', label: 'Content Type' },
+ { key: 'file_size_bytes', label: 'File Size', format: 'filesize' },
+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },
+];
+
+const download: OutputSchema = {
+ fields: [
+ { key: 'download_id', label: 'Download ID' },
+ { key: 'recording_id', label: 'Recording ID', format: 'number' },
+ { key: 'status', label: 'Status', description: 'processing, completed, failed or expired.' },
+ { key: 'video', label: 'Video File', description: 'Present once the video is generated.', children: downloadFile },
+ { key: 'audio', label: 'Audio File', description: 'Present for audio-only recordings.', children: downloadFile },
+ { key: 'failure_reason', label: 'Failure Reason', description: 'generation_failed or generation_timeout.' },
+ ],
+};
+
+const teamMemberSnake: OutputSchemaField[] = [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'created_at', label: 'Joined At', format: 'datetime' },
+];
+
+const accessLevel = ({ key, label }: { key: string; label: string }): OutputSchemaField => ({
+ key,
+ label,
+ children: [
+ { key: 'level', label: 'Level' },
+ { key: 'teams', label: 'Teams' },
+ ],
+});
+
+export const fathomOutputSchemas = {
+ legacyMeetingPages: {
+ itemLabel: 'Page {index}',
+ fields: [
+ {
+ key: 'pages',
+ value: '',
+ label: 'Pages',
+ listItems: [
+ {
+ key: 'result',
+ label: 'Page',
+ children: [
+ { key: 'items', label: 'Meetings', labelKey: 'title', listItems: meetingFieldsCamel },
+ { key: 'nextCursor', label: 'Next Cursor', description: 'Empty on the last page.' },
+ { key: 'limit', label: 'Page Size', format: 'number' },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ legacySummary: {
+ fields: [
+ {
+ key: 'summary',
+ label: 'Summary',
+ children: [
+ { key: 'templateName', label: 'Template' },
+ { key: 'markdownFormatted', label: 'Summary (Markdown)' },
+ ],
+ },
+ { key: 'destinationUrl', label: 'Destination URL', format: 'url', description: 'Only when a destination URL was given; the summary is then POSTed there.' },
+ ],
+ },
+ legacyTranscript: {
+ fields: [
+ {
+ key: 'transcript',
+ label: 'Transcript',
+ listItems: [
+ {
+ key: 'speaker',
+ label: 'Speaker',
+ children: [
+ { key: 'displayName', label: 'Name' },
+ { key: 'matchedCalendarInviteeEmail', label: 'Matched Invitee Email', format: 'email' },
+ ],
+ },
+ { key: 'text', label: 'Text' },
+ { key: 'timestamp', label: 'Timestamp (HH:MM:SS)' },
+ ],
+ },
+ { key: 'destinationUrl', label: 'Destination URL', format: 'url', description: 'Only when a destination URL was given; the transcript is then POSTed there.' },
+ ],
+ },
+ legacyTeams: {
+ fields: [
+ {
+ key: 'result',
+ label: 'Result',
+ children: [
+ { key: 'items', label: 'Teams', labelKey: 'name', listItems: [{ key: 'name', label: 'Name' }, { key: 'createdAt', label: 'Created At', format: 'datetime' }] },
+ { key: 'nextCursor', label: 'Next Cursor' },
+ { key: 'limit', label: 'Page Size', format: 'number' },
+ ],
+ },
+ ],
+ },
+ legacyTeamMembers: {
+ fields: [
+ {
+ key: 'result',
+ label: 'Result',
+ children: [
+ {
+ key: 'items',
+ label: 'Members',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'createdAt', label: 'Joined At', format: 'datetime' },
+ ],
+ },
+ { key: 'nextCursor', label: 'Next Cursor' },
+ { key: 'limit', label: 'Page Size', format: 'number' },
+ ],
+ },
+ ],
+ },
+ meetingsPage: {
+ fields: [
+ { key: 'items', label: 'Meetings', labelKey: 'title', listItems: meetingFieldsSnake },
+ { key: 'next_cursor', label: 'Next Cursor', description: 'Pass to the next call to continue; empty on the last page.' },
+ { key: 'has_more', label: 'Has More', format: 'boolean' },
+ ],
+ },
+ recordingSummary: {
+ fields: [
+ { key: 'recording_id', label: 'Recording ID', format: 'number' },
+ { key: 'summary', label: 'Summary', children: summarySnake },
+ ],
+ },
+ recordingTranscript: {
+ fields: [
+ { key: 'recording_id', label: 'Recording ID', format: 'number' },
+ { key: 'transcript', label: 'Transcript', listItems: transcriptSnake },
+ ],
+ },
+ meetingTypes: {
+ fields: [
+ {
+ key: 'items',
+ label: 'Meeting Types',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'status', label: 'Status', description: 'active or inactive.' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+ },
+ users: {
+ fields: [
+ {
+ key: 'items',
+ label: 'Users',
+ labelKey: 'email',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'status', label: 'Status', description: 'active, deactivated or invited.' },
+ { key: 'created_at', label: 'Created At', format: 'datetime', description: 'For invited users, the invite date.' },
+ {
+ key: 'permissions',
+ label: 'Permissions',
+ description: 'Missing for invited users.',
+ children: [accessLevel({ key: 'settings_access', label: 'Settings Access' }), accessLevel({ key: 'view_access', label: 'View Access' })],
+ },
+ ],
+ },
+ { key: 'next_cursor', label: 'Next Cursor' },
+ { key: 'has_more', label: 'Has More', format: 'boolean' },
+ ],
+ },
+ teamMemberLookup: {
+ fields: [
+ { key: 'found', label: 'Found', format: 'boolean' },
+ { key: 'member', label: 'Member', description: 'Empty when no member has this email.', children: teamMemberSnake },
+ ],
+ },
+ download,
+ newRecording: { fields: meetingFieldsSnake },
+} satisfies Record<string, OutputSchema>;
diff --git a/packages/pieces/community/fathom/src/lib/triggers/new-recording.ts b/packages/pieces/community/fathom/src/lib/triggers/new-recording.ts
index 5ad14d652b5..6e28eb46a58 100644
--- a/packages/pieces/community/fathom/src/lib/triggers/new-recording.ts
+++ b/packages/pieces/community/fathom/src/lib/triggers/new-recording.ts
@@ -1,24 +1,20 @@
-import { fathomAuth, getFathomClient } from '../common/auth';
-import {
- createTrigger,
- TriggerStrategy,
- Property
-} from '@activepieces/pieces-framework';
-import { CreateWebhookRequest } from 'fathom-typescript/dist/esm/sdk/models/operations';
-
-interface WebhookInformation {
- webhookId: string;
-}
+import { HttpMethod } from '@activepieces/pieces-common';
+import { randomUUID } from 'node:crypto';
+import { AppConnectionType, createTrigger, Property, Store, TriggerStrategy } from '@activepieces/pieces-framework';
+import { fathomAuth, FathomAuthValue } from '../common/auth';
+import { FathomApiError, fathomClient } from '../common/client';
+import { fathomWebhook } from '../common/webhook';
+import { fathomOutputSchemas } from '../output-schemas';
export const newRecording = createTrigger({
auth: fathomAuth,
name: 'newRecording',
classification: 'READ',
displayName: 'New Recording',
- description:
- 'Fires when a meeting is recorded (i.e. a new meeting recording is produced)',
+ description: 'Fires when Fathom finishes processing a new meeting recording. Turn on at least one of the Include options.',
aiMetadata: {
- description: 'Fires when Fathom finishes producing a new meeting recording, delivering the meeting metadata (and optionally the transcript, summary, action items, and CRM matches). Scope is configurable to any combination of your own recordings, shared external recordings, recordings you shared with your team, and recordings shared across the team.',
+ description:
+ 'Fires when Fathom finishes processing a new meeting recording, delivering its metadata plus whichever of transcript, summary, action items and CRM matches are enabled (at least one must be). Scope is configurable: your own recordings, recordings shared with you externally, recordings you shared with teams, and team recordings you can access. Deliveries are signature-checked and retries de-duplicated.',
},
props: {
triggered_for: Property.MultiSelectDropdown({
@@ -34,42 +30,44 @@ export const newRecording = createTrigger({
{ label: 'My Recordings', value: 'my_recordings' },
{ label: 'Shared External Recordings', value: 'shared_external_recordings' },
{ label: 'My Shared With Team Recordings', value: 'my_shared_with_team_recordings' },
- { label: 'Shared Team Recordings', value: 'shared_team_recordings' }
- ]
+ { label: 'Shared Team Recordings', value: 'shared_team_recordings' },
+ ],
};
},
- defaultValue: ['my_recordings']
+ defaultValue: ['my_recordings'],
}),
include_transcript: Property.Checkbox({
displayName: 'Include Transcript',
description: 'Include the transcript in the webhook payload',
required: false,
- defaultValue: false
+ defaultValue: false,
}),
include_summary: Property.Checkbox({
displayName: 'Include Summary',
- description: 'Include the summary in the webhook payload',
+ description: 'Include the summary in the webhook payload. Fathom needs at least one Include option turned on.',
required: false,
- defaultValue: false
+ defaultValue: true,
}),
include_action_items: Property.Checkbox({
displayName: 'Include Action Items',
description: 'Include the action items in the webhook payload',
required: false,
- defaultValue: false
+ defaultValue: false,
}),
include_crm_matches: Property.Checkbox({
displayName: 'Include CRM Matches',
description: 'Include CRM matches in the webhook payload',
required: false,
- defaultValue: false
- })
+ defaultValue: false,
+ }),
},
sampleData: {
title: 'Quarterly Business Review',
meeting_title: 'QBR 2025 Q1',
+ meeting_type: 'Quarterly Business Review',
recording_id: 123456789,
url: 'https://fathom.video/xyz123',
+ meeting_url: 'https://us02web.zoom.us/j/123456789',
share_url: 'https://fathom.video/share/xyz123',
created_at: '2025-03-01T17:01:30Z',
scheduled_start_time: '2025-03-01T16:00:00Z',
@@ -77,61 +75,258 @@ export const newRecording = createTrigger({
recording_start_time: '2025-03-01T16:01:12Z',
recording_end_time: '2025-03-01T17:00:55Z',
calendar_invitees_domains_type: 'one_or_more_external',
- transcript_language: 'en'
+ shared_with: 'single_team',
+ transcript_language: 'en',
+ transcript: [
+ {
+ speaker: { display_name: 'Jane Doe', matched_calendar_invitee_email: '[email protected]' },
+ text: "Let's revisit the budget allocations.",
+ timestamp: '00:05:32',
+ },
+ ],
+ default_summary: {
+ template_name: 'general',
+ markdown_formatted: '## Summary\nWe reviewed Q1 OKRs, identified budget risks, and agreed to revisit projections next month.\n',
+ },
+ action_items: [
+ {
+ description: 'Email revised proposal to client',
+ user_generated: false,
+ completed: false,
+ recording_timestamp: '00:10:45',
+ recording_playback_url: 'https://fathom.video/calls/xyz123?timestamp=645',
+ assignee: { name: 'Jane Doe', email: '[email protected]', team: 'Marketing' },
+ },
+ ],
+ calendar_invitees: [
+ { name: 'Jane Doe', matched_speaker_display_name: 'Jane Doe', email: '[email protected]', is_external: false, email_domain: 'example.com' },
+ { name: 'John Smith', matched_speaker_display_name: 'John Smith', email: '[email protected]', is_external: true, email_domain: 'client.example.com' },
+ ],
+ recorded_by: { name: 'Alice Johnson', email: '[email protected]', team: 'Customer Success', email_domain: 'example.com' },
+ crm_matches: {
+ contacts: [{ name: 'John Smith', email: '[email protected]', record_url: 'https://app.hubspot.com/contacts/123' }],
+ companies: [{ name: 'Acme Corp', record_url: 'https://app.hubspot.com/companies/456' }],
+ deals: [{ name: 'Q1 Renewal', amount: 50000, record_url: 'https://app.hubspot.com/deals/789' }],
+ },
},
+ outputSchema: fathomOutputSchemas.newRecording,
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
- const fathom = getFathomClient(context.auth);
-
- const webhookParams: CreateWebhookRequest = {
- destinationUrl: context.webhookUrl,
- triggeredFor: context.propsValue.triggered_for as ('my_recordings' | 'shared_external_recordings' | 'my_shared_with_team_recordings' | 'shared_team_recordings')[],
- includeTranscript: context.propsValue.include_transcript || false,
- includeSummary: context.propsValue.include_summary || false,
- includeActionItems: context.propsValue.include_action_items || false,
- includeCrmMatches: context.propsValue.include_crm_matches || false
- };
-
- const webhook = await fathom.createWebhook(webhookParams);
-
- if (webhook?.id) {
- await context.store?.put<WebhookInformation>('_new_recording_webhook', {
- webhookId: webhook.id
- });
+ const includes = includeFlags({ propsValue: context.propsValue });
+ if (!includes.include_transcript && !includes.include_summary && !includes.include_action_items && !includes.include_crm_matches) {
+ throw new Error('Fathom needs at least one of Include Transcript, Include Summary, Include Action Items or Include CRM Matches turned on. Turn one on and publish again.');
+ }
+ const triggeredFor = (context.propsValue.triggered_for ?? []).filter((value): value is string => typeof value === 'string');
+ if (triggeredFor.length === 0) {
+ throw new Error('Pick at least one recording type in Trigger For.');
+ }
+ const webhook = await fathomClient.requestObject({
+ auth: context.auth,
+ method: HttpMethod.POST,
+ path: 'webhooks',
+ body: { destination_url: context.webhookUrl, triggered_for: triggeredFor, ...includes },
+ });
+ const webhookId = webhook['id'];
+ const secret = webhook['secret'];
+ if (typeof webhookId !== 'string' || webhookId.length === 0 || typeof secret !== 'string' || secret.length === 0) {
+ throw new Error('Fathom created the webhook but did not return its ID and signing secret. Try publishing again.');
+ }
+ try {
+ await context.store.put<WebhookInformation>(STORE_KEY, { webhookId, secret });
+ } catch (error) {
+ await deleteWebhook({ auth: context.auth, webhookId }).catch(() => undefined);
+ throw error;
}
},
async onDisable(context) {
- const webhookInfo = await context.store.get<WebhookInformation>(
- '_new_recording_webhook'
- );
-
+ const webhookInfo = await context.store.get<WebhookInformation>(STORE_KEY);
if (webhookInfo?.webhookId) {
- const fathom = getFathomClient(context.auth);
-
- await fathom.deleteWebhook({ id: webhookInfo.webhookId });
+ await deleteWebhook({ auth: context.auth, webhookId: webhookInfo.webhookId });
}
+ const seenKeys = fathomWebhook.seenDeliveryKeys({ seen: await context.store.get<unknown>(SEEN_KEY) });
+ await Promise.all(seenKeys.map((key) => context.store.delete(claimKey({ deliveryKey: key }))));
+ await context.store.delete(STORE_KEY);
+ await context.store.delete(SEEN_KEY);
},
async test(context) {
- const fathom = getFathomClient(context.auth);
-
- const params = {
- includeTranscript: context.propsValue.include_transcript || false,
- includeSummary: context.propsValue.include_summary || false,
- includeActionItems: context.propsValue.include_action_items || false,
- includeCrmMatches: context.propsValue.include_crm_matches || false
- };
-
- const response = await fathom.listMeetings(params);
- const meetings = [];
- for await (const meetingResponse of response) {
- if (meetingResponse?.result?.items) {
- meetings.push(...meetingResponse.result.items.slice(0, 3));
- if (meetings.length >= 3) break;
- }
- }
- return meetings.slice(0, 3);
+ const includes = includeFlags({ propsValue: context.propsValue });
+ const isOAuth = context.auth.type !== AppConnectionType.SECRET_TEXT;
+ const page = await fathomClient.listPage({
+ auth: context.auth,
+ path: 'meetings',
+ query: {
+ include_action_items: includes.include_action_items || undefined,
+ include_crm_matches: includes.include_crm_matches || undefined,
+ include_summary: (!isOAuth && includes.include_summary) || undefined,
+ include_transcript: (!isOAuth && includes.include_transcript) || undefined,
+ },
+ });
+ const meetings = page.items.slice(0, 3);
+ if (!isOAuth || (!includes.include_summary && !includes.include_transcript)) {
+ return meetings;
+ }
+ const enriched = [];
+ for (const meeting of meetings) {
+ enriched.push(await attachRecordingContent({ auth: context.auth, meeting, includes }));
+ }
+ return enriched;
},
async run(context) {
+ const webhookInfo = await context.store.get<WebhookInformation>(STORE_KEY);
+ if (!webhookInfo) {
+ return [];
+ }
+ if (!webhookInfo.secret) {
+ throw new Error(
+ 'This Fathom trigger was turned on with an older piece version that did not save the signing secret, so this delivery cannot be verified and was not processed. Turn the flow off and on again (or publish it again) to re-register the webhook.'
+ );
+ }
+ const verification = fathomWebhook.verifySignature({
+ secret: webhookInfo.secret,
+ headers: context.payload.headers ?? {},
+ rawBody: context.payload.rawBody,
+ nowSeconds: Math.floor(Date.now() / 1000),
+ });
+ if (!verification.valid) {
+ return [];
+ }
+ const deliveryKey = fathomWebhook.deliveryKeyOf({ webhookId: verification.webhookId });
+ const remembered = fathomWebhook.rememberDelivery({
+ seen: await context.store.get<unknown>(SEEN_KEY),
+ deliveryKey,
+ timestamp: verification.timestamp,
+ nowSeconds: Math.floor(Date.now() / 1000),
+ });
+ if (remembered.status === 'duplicate') {
+ return [];
+ }
+ if (remembered.status === 'full') {
+ throw seenListFullError();
+ }
+ const claimed = await claimDelivery({ store: context.store, deliveryKey, timestamp: verification.timestamp });
+ if (!claimed) {
+ return [];
+ }
+ const recorded = await recordSeen({ store: context.store, deliveryKey, timestamp: verification.timestamp });
+ await Promise.all(recorded.expired.map((key) => context.store.delete(claimKey({ deliveryKey: key }))));
+ if (recorded.full) {
+ await context.store.delete(claimKey({ deliveryKey }));
+ throw seenListFullError();
+ }
return [context.payload.body];
- }
+ },
});
+
+async function recordSeen({
+ store,
+ deliveryKey,
+ timestamp,
+}: {
+ store: Store;
+ deliveryKey: string;
+ timestamp: number;
+}): Promise<{ full: boolean; expired: string[] }> {
+ let expired: string[] = [];
+ for (let attempt = 0; attempt < SEEN_WRITE_ATTEMPTS; attempt++) {
+ const merged = fathomWebhook.rememberDelivery({
+ seen: await store.get<unknown>(SEEN_KEY),
+ deliveryKey,
+ timestamp,
+ nowSeconds: Math.floor(Date.now() / 1000),
+ });
+ expired = [...expired, ...merged.expired];
+ if (merged.status !== 'new') {
+ return { full: merged.status === 'full', expired };
+ }
+ await store.put(SEEN_KEY, merged.seen);
+ const stored = await store.get<unknown>(SEEN_KEY);
+ if (fathomWebhook.seenDeliveryKeys({ seen: stored }).includes(deliveryKey)) {
+ return { full: false, expired };
+ }
+ }
+ return { full: false, expired };
+}
+
+function seenListFullError(): Error {
+ return new Error(
+ `Fathom sent more than ${fathomWebhook.MAX_SEEN_IDS} recordings within ${fathomWebhook.TOLERANCE_SECONDS / 60} minutes, so this delivery could not be recorded for duplicate protection and was not processed.`
+ );
+}
+
+async function claimDelivery({ store, deliveryKey, timestamp }: { store: Store; deliveryKey: string; timestamp: number }): Promise<boolean> {
+ const key = claimKey({ deliveryKey });
+ const existing = await store.get<DeliveryClaim>(key);
+ if (existing) {
+ return false;
+ }
+ const token = randomUUID();
+ await store.put<DeliveryClaim>(key, { token, ts: timestamp });
+ await new Promise((resolve) => setTimeout(resolve, CLAIM_SETTLE_MS));
+ const winner = await store.get<DeliveryClaim>(key);
+ return winner?.token === token;
+}
+
+function claimKey({ deliveryKey }: { deliveryKey: string }): string {
+ return `${CLAIM_KEY_PREFIX}${deliveryKey}`;
+}
+
+function includeFlags({ propsValue }: { propsValue: Record<string, unknown> }): IncludeFlags {
+ return {
+ include_transcript: propsValue['include_transcript'] === true,
+ include_summary: propsValue['include_summary'] === true,
+ include_action_items: propsValue['include_action_items'] === true,
+ include_crm_matches: propsValue['include_crm_matches'] === true,
+ };
+}
+
+async function deleteWebhook({ auth, webhookId }: { auth: FathomAuthValue; webhookId: string }): Promise<void> {
+ try {
+ await fathomClient.request({ auth, method: HttpMethod.DELETE, path: `webhooks/${encodeURIComponent(webhookId)}` });
+ } catch (error) {
+ if (error instanceof FathomApiError && error.status === 404) {
+ return;
+ }
+ throw error;
+ }
+}
+
+async function attachRecordingContent({
+ auth,
+ meeting,
+ includes,
+}: {
+ auth: FathomAuthValue;
+ meeting: Record<string, unknown>;
+ includes: IncludeFlags;
+}): Promise<Record<string, unknown>> {
+ const recordingId = meeting['recording_id'];
+ if (typeof recordingId !== 'number') {
+ return meeting;
+ }
+ const summary = includes.include_summary
+ ? (await fathomClient.requestObject({ auth, method: HttpMethod.GET, path: `recordings/${recordingId}/summary` }))['summary']
+ : undefined;
+ const transcript = includes.include_transcript
+ ? (await fathomClient.requestObject({ auth, method: HttpMethod.GET, path: `recordings/${recordingId}/transcript` }))['transcript']
+ : undefined;
+ return {
+ ...meeting,
+ ...(includes.include_summary ? { default_summary: summary ?? null } : {}),
+ ...(includes.include_transcript ? { transcript: transcript ?? null } : {}),
+ };
+}
+
+const STORE_KEY = '_new_recording_webhook';
+const SEEN_KEY = '_fathom_seen_ids';
+const CLAIM_KEY_PREFIX = '_fathom_delivery_';
+const CLAIM_SETTLE_MS = 500;
+const SEEN_WRITE_ATTEMPTS = 3;
+
+type WebhookInformation = { webhookId: string; secret?: string };
+type DeliveryClaim = { token: string; ts: number };
+type IncludeFlags = {
+ include_transcript: boolean;
+ include_summary: boolean;
+ include_action_items: boolean;
+ include_crm_matches: boolean;
+};
diff --git a/packages/pieces/community/fathom/test/actions.test.ts b/packages/pieces/community/fathom/test/actions.test.ts
new file mode 100644
index 00000000000..01324056ee6
--- /dev/null
+++ b/packages/pieces/community/fathom/test/actions.test.ts
@@ -0,0 +1,185 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { getRecordingSummary } from '../src/lib/actions/get-recording-summary';
+import { getRecordingTranscript } from '../src/lib/actions/get-recording-transcript';
+import { listMeetings } from '../src/lib/actions/list-meetings';
+import { findTeam } from '../src/lib/actions/find-team';
+import { findTeamMember } from '../src/lib/actions/find-team-member';
+import { findTeamMemberByEmail } from '../src/lib/actions/find-team-member-by-email';
+import { listMeetingTypes } from '../src/lib/actions/list-meeting-types';
+import { listUsers } from '../src/lib/actions/list-users';
+import { requestRecordingDownload } from '../src/lib/actions/request-recording-download';
+import { getRecordingDownload } from '../src/lib/actions/get-recording-download';
+import { aiListMeetings } from '../src/lib/actions/ai/list-meetings';
+import { aiGetRecordingSummary } from '../src/lib/actions/ai/get-recording-summary';
+import { fathomProps } from '../src/lib/common/props';
+import { apiKeyAuth, installFetch, jsonResponse, meeting, oauthAuth, requestOf, runAction } from './helpers';
+
+let fetchMock: ReturnType<typeof installFetch>;
+
+beforeEach(() => {
+ fetchMock = installFetch();
+});
+
+afterEach(() => {
+ vi.useRealTimers();
+ vi.unstubAllGlobals();
+});
+
+describe('legacy SDK actions now fail instead of returning empty success', () => {
+ it('Get Recording Summary throws a reconnect error on 401', async () => {
+ fetchMock.mockResolvedValue(jsonResponse({ status: 401, body: { error: 'invalid token' } }));
+ await expect(runAction({ action: getRecordingSummary, propsValue: { recording_id: 5 } })).rejects.toThrow(
+ 'Fathom did not accept the connection (401): invalid token. Reconnect'
+ );
+ });
+
+ it('Get Recording Summary throws a rate limit error on a persistent 429', async () => {
+ vi.useFakeTimers();
+ fetchMock.mockImplementation(async () => jsonResponse({ status: 429, body: { error: 'slow down' } }));
+ const pending = runAction({ action: getRecordingSummary, propsValue: { recording_id: 5 } }).catch((e: unknown) => e);
+ await vi.advanceTimersByTimeAsync(120000);
+ expect(String(await pending)).toContain('Fathom rate limit reached (429): slow down');
+ expect(fetchMock.mock.calls.length).toBeGreaterThan(1);
+ });
+
+ it('Get Recording Summary keeps the SDK camelCase output on success', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { summary: { template_name: 'general', markdown_formatted: '## Hi' } } }));
+ const result = await runAction({ action: getRecordingSummary, propsValue: { recording_id: 5 } });
+ expect(result).toEqual({ summary: { templateName: 'general', markdownFormatted: '## Hi' } });
+ expect(requestOf({ fetchMock, call: 0 }).url).toBe('https://api.fathom.ai/external/v1/recordings/5/summary');
+ });
+
+ it('List Meetings throws on 400 instead of returning [undefined]', async () => {
+ fetchMock.mockResolvedValue(jsonResponse({ status: 400, body: { error: 'bad created_after' } }));
+ await expect(runAction({ action: listMeetings, propsValue: { created_after: 'yesterday' } })).rejects.toThrow(
+ 'Fathom rejected the request (400): bad created_after'
+ );
+ });
+
+ it('List Meetings blocks summary/transcript flags on OAuth before calling Fathom', async () => {
+ await expect(runAction({ action: listMeetings, propsValue: { include_summary: true } })).rejects.toThrow('OAuth connections');
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('List Meetings follows every page by default and stops at Max Pages when set', async () => {
+ const page = (cursor: string | null) => jsonResponse({ body: { limit: 10, next_cursor: cursor, items: [meeting({})] } });
+ fetchMock.mockResolvedValueOnce(page('c2')).mockResolvedValueOnce(page('c3')).mockResolvedValueOnce(page(null));
+ const all = await runAction({ action: listMeetings, propsValue: {} });
+ expect(all).toHaveLength(3);
+ fetchMock.mockReset();
+ fetchMock.mockImplementation(async () => page('more'));
+ const capped = await runAction({ action: listMeetings, propsValue: { max_pages: 2 } });
+ expect(capped).toHaveLength(2);
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ });
+
+ it('Get Recording Transcript without a destination URL returns the SDK camelCase shape', async () => {
+ fetchMock.mockResolvedValueOnce(
+ jsonResponse({ body: { transcript: [{ speaker: { display_name: 'Jo', matched_calendar_invitee_email: null }, text: 'Hi', timestamp: '00:00:01' }] } })
+ );
+ const result = await runAction({ action: getRecordingTranscript, propsValue: { recording_id: 7 } });
+ expect(result).toEqual({ transcript: [{ speaker: { displayName: 'Jo', matchedCalendarInviteeEmail: null }, text: 'Hi', timestamp: '00:00:01' }] });
+ });
+
+ it('Find Team works when Fathom returns limit null and keeps the SDK shape', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { limit: null, next_cursor: null, items: [{ name: 'Sales', created_at: '2026-01-02T03:04:05Z' }] } }));
+ const result = await runAction({ action: findTeam, propsValue: {} });
+ expect(result).toEqual({ result: { limit: null, nextCursor: null, items: [{ name: 'Sales', createdAt: '2026-01-02T03:04:05.000Z' }] } });
+ });
+
+ it('Find Team Member passes the team filter and throws on 401', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 401, body: {} }));
+ await expect(runAction({ action: findTeamMember, propsValue: { team: ' Sales ' } })).rejects.toThrow('(401)');
+ expect(requestOf({ fetchMock, call: 0 }).url).toBe('https://api.fathom.ai/external/v1/team_members?team=Sales');
+ });
+});
+
+describe('new actions', () => {
+ it('List Meetings (AI) returns one page with has_more and sends repeated array filters', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { limit: 10, next_cursor: 'n2', items: [meeting({})] } }));
+ const result = await runAction({
+ action: aiListMeetings,
+ propsValue: { recorded_by: ['[email protected]'], meeting_type: 'QBR', include_highlights: true, created_after: '2026-01-01T00:00:00.000Z' },
+ auth: apiKeyAuth(),
+ });
+ expect(result).toMatchObject({ next_cursor: 'n2', has_more: true });
+ expect(requestOf({ fetchMock, call: 0 }).url).toBe(
+ 'https://api.fathom.ai/external/v1/meetings?created_after=2026-01-01T00%3A00%3A00Z&recorded_by%5B%5D=a%40example.com&meeting_type=QBR&include_highlights=true'
+ );
+ });
+
+ it('Get Recording Summary (AI) validates the recording ID before any request', async () => {
+ await expect(runAction({ action: aiGetRecordingSummary, propsValue: { recording_id: '12/../x' } })).rejects.toThrow('numeric recording_id');
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('List Meeting Types errors instead of returning a partial list past 20 pages', async () => {
+ fetchMock.mockImplementation(async () => jsonResponse({ body: { items: [{ name: 'QBR', status: 'active' }], next_cursor: 'more' } }));
+ await expect(runAction({ action: listMeetingTypes, propsValue: {} })).rejects.toThrow('more than 20 pages');
+ expect(fetchMock).toHaveBeenCalledTimes(20);
+ });
+
+ it('List Meeting Types filters by status', async () => {
+ fetchMock.mockResolvedValueOnce(
+ jsonResponse({ body: { items: [{ name: 'A', status: 'active' }, { name: 'B', status: 'inactive' }], next_cursor: null } })
+ );
+ expect(await runAction({ action: listMeetingTypes, propsValue: { status: 'inactive' } })).toEqual({ items: [{ name: 'B', status: 'inactive' }], count: 1 });
+ });
+
+ it('List Users refuses invited + admin level and maps 403', async () => {
+ await expect(runAction({ action: listUsers, propsValue: { status: 'invited', settings_access: 'none' } })).rejects.toThrow('cannot filter invited');
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 403, body: { error: 'Forbidden' } }));
+ await expect(runAction({ action: listUsers, propsValue: {} })).rejects.toThrow('Fathom refused access (403)');
+ });
+
+ it('Find Team Member by Email stops at the first page with a match', async () => {
+ fetchMock
+ .mockResolvedValueOnce(jsonResponse({ body: { items: [{ email: '[email protected]' }], next_cursor: 'c2' } }))
+ .mockResolvedValueOnce(jsonResponse({ body: { items: [{ name: 'Jo', email: '[email protected]' }], next_cursor: 'c3' } }));
+ const result = await runAction({ action: findTeamMemberByEmail, propsValue: { email: '[email protected]' } });
+ expect(result).toEqual({ found: true, member: { name: 'Jo', email: '[email protected]' } });
+ expect(fetchMock).toHaveBeenCalledTimes(2);
+ });
+
+ it('Find Team Member by Email returns found=false at the end and errors at the 50-page cap', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { items: [], next_cursor: null } }));
+ expect(await runAction({ action: findTeamMemberByEmail, propsValue: { email: '[email protected]' } })).toEqual({ found: false, member: null });
+ fetchMock.mockImplementation(async () => jsonResponse({ body: { items: [], next_cursor: 'more' } }));
+ await expect(runAction({ action: findTeamMemberByEmail, propsValue: { email: '[email protected]' } })).rejects.toThrow('first 50 pages');
+ });
+
+ it('Request Recording Download posts to the download endpoint and surfaces 422', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 422, body: { error: 'recording has no downloadable media' } }));
+ await expect(runAction({ action: requestRecordingDownload, propsValue: { recording_id: '157155195' } })).rejects.toThrow('(422)');
+ const req = requestOf({ fetchMock, call: 0 });
+ expect(req.method).toBe('POST');
+ expect(req.url).toBe('https://api.fathom.ai/external/v1/recordings/157155195/download');
+ });
+
+ it('Get Recording Download rejects a download ID with path characters', async () => {
+ await expect(runAction({ action: getRecordingDownload, propsValue: { recording_id: '1', download_id: '../../x' } })).rejects.toThrow('Download ID');
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+});
+
+describe('recording dropdown', () => {
+ it('stops after 10 pages and says so', async () => {
+ let n = 0;
+ fetchMock.mockImplementation(async () => {
+ n++;
+ return jsonResponse({ body: { items: [meeting({ recording_id: n, title: `M${n}` })], next_cursor: 'more' } });
+ });
+ const dropdown = fathomProps.recordingDropdown({ description: 'x' });
+ const result = await dropdown.options({ auth: oauthAuth() }, { searchValue: undefined, server: { apiUrl: '', publicUrl: '', token: '' } });
+ expect(fetchMock).toHaveBeenCalledTimes(10);
+ expect(result.options[0]).toEqual({ label: 'M1 · 2026-10-01', value: 1 });
+ expect(result.placeholder).toContain('10 most recent pages');
+ });
+
+ it('names the status on error', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 401, body: {} }));
+ const dropdown = fathomProps.recordingDropdown({ description: 'x' });
+ const result = await dropdown.options({ auth: oauthAuth() }, { searchValue: undefined, server: { apiUrl: '', publicUrl: '', token: '' } });
+ expect(result).toMatchObject({ disabled: true, placeholder: expect.stringContaining('Reconnect') });
+ });
+});
diff --git a/packages/pieces/community/fathom/test/client.test.ts b/packages/pieces/community/fathom/test/client.test.ts
new file mode 100644
index 00000000000..056da631d84
--- /dev/null
+++ b/packages/pieces/community/fathom/test/client.test.ts
@@ -0,0 +1,103 @@
+import { HttpMethod } from '@activepieces/pieces-common';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { FathomApiError, fathomClient } from '../src/lib/common/client';
+import { apiKeyAuth, installFetch, jsonResponse, oauthAuth, requestOf } from './helpers';
+
+let fetchMock: ReturnType<typeof installFetch>;
+
+beforeEach(() => {
+ fetchMock = installFetch();
+});
+
+afterEach(() => {
+ vi.useRealTimers();
+ vi.unstubAllGlobals();
+});
+
+describe('fathomClient.request', () => {
+ it('sends a bearer token for OAuth and repeats array filters as key[]', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { items: [], next_cursor: null, limit: 10 } }));
+ await fathomClient.listPage({ auth: oauthAuth(), path: 'meetings', query: { teams: ['Sales', 'Eng'], include_summary: undefined, cursor: 'c1' } });
+ const req = requestOf({ fetchMock, call: 0 });
+ expect(req.url).toBe('https://api.fathom.ai/external/v1/meetings?teams%5B%5D=Sales&teams%5B%5D=Eng&cursor=c1');
+ expect(req.method).toBe('GET');
+ expect(req.headers['authorization']).toBe('Bearer tok_test');
+ expect(req.headers['x-api-key']).toBeUndefined();
+ });
+
+ it('sends a trimmed X-Api-Key for API key connections', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { items: [] } }));
+ await fathomClient.listPage({ auth: apiKeyAuth(), path: 'teams' });
+ const req = requestOf({ fetchMock, call: 0 });
+ expect(req.headers['x-api-key']).toBe('key_test');
+ expect(req.headers['authorization']).toBeUndefined();
+ });
+
+ it.each(['/meetings', 'https://evil.io/x', '../oauth2/token', 'meetings?x=1', 'a\\b'])('refuses unexpected path %s', async (path) => {
+ await expect(fathomClient.request({ auth: oauthAuth(), method: HttpMethod.GET, path })).rejects.toThrow('unexpected Fathom path');
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('turns a 401 into a reconnect message with responseBody and no body field', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 401, body: { error: 'Unauthorized.' } }));
+ const error = await fathomClient.request({ auth: oauthAuth(), method: HttpMethod.GET, path: 'teams' }).catch((e: unknown) => e);
+ expect(error).toBeInstanceOf(FathomApiError);
+ expect(error).toMatchObject({ status: 401, responseBody: { error: 'Unauthorized.' } });
+ expect(error).not.toHaveProperty('body');
+ expect(String(error)).toContain('Fathom did not accept the connection (401): Unauthorized. Reconnect');
+ });
+
+ it('turns a 400 into a check-your-values message', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 400, body: { error: 'OAuth users are not allowed to include summary.' } }));
+ await expect(fathomClient.request({ auth: oauthAuth(), method: HttpMethod.GET, path: 'meetings' })).rejects.toThrow(
+ 'Fathom rejected the request (400): OAuth users are not allowed to include summary. Check the values'
+ );
+ });
+
+ it('retries a 429 twice with waits, then throws a rate limit error', async () => {
+ vi.useFakeTimers();
+ fetchMock.mockImplementation(async () => jsonResponse({ status: 429, body: { error: 'Too many requests' } }));
+ const pending = fathomClient.request({ auth: oauthAuth(), method: HttpMethod.GET, path: 'teams' }).catch((e: unknown) => e);
+ await vi.advanceTimersByTimeAsync(31000);
+ const error = await pending;
+ expect(fetchMock).toHaveBeenCalledTimes(3);
+ expect(String(error)).toContain('Fathom rate limit reached (429)');
+ });
+
+ it('recovers when a 429 is followed by success', async () => {
+ vi.useFakeTimers();
+ fetchMock
+ .mockResolvedValueOnce(jsonResponse({ status: 429, body: {} }))
+ .mockResolvedValueOnce(jsonResponse({ body: { items: [{ name: 'Sales' }], next_cursor: null } }));
+ const pending = fathomClient.listPage({ auth: oauthAuth(), path: 'teams' });
+ await vi.advanceTimersByTimeAsync(10000);
+ expect((await pending).items).toEqual([{ name: 'Sales' }]);
+ });
+
+ it('sends JSON content type only when there is a body', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 202, body: { download_id: 'dl_1', recording_id: 1, status: 'processing' } }));
+ await fathomClient.requestObject({ auth: oauthAuth(), method: HttpMethod.POST, path: 'recordings/1/download', body: {} });
+ const req = requestOf({ fetchMock, call: 0 });
+ expect(req.method).toBe('POST');
+ expect(req.headers['content-type']).toBe('application/json');
+ expect(req.body).toBe('{}');
+ });
+});
+
+describe('fathomClient.listPages', () => {
+ it('follows next_cursor until it is empty', async () => {
+ fetchMock
+ .mockResolvedValueOnce(jsonResponse({ body: { items: [{ n: 1 }], next_cursor: 'c2' } }))
+ .mockResolvedValueOnce(jsonResponse({ body: { items: [{ n: 2 }], next_cursor: '' } }));
+ const result = await fathomClient.listPages({ auth: oauthAuth(), path: 'meeting_types', maxPages: 5 });
+ expect(result).toMatchObject({ items: [{ n: 1 }, { n: 2 }], truncated: false, pages: 2 });
+ expect(requestOf({ fetchMock, call: 1 }).url).toBe('https://api.fathom.ai/external/v1/meeting_types?cursor=c2');
+ });
+
+ it('stops at the page cap and reports truncated', async () => {
+ fetchMock.mockImplementation(async () => jsonResponse({ body: { items: [{ n: 1 }], next_cursor: 'more' } }));
+ const result = await fathomClient.listPages({ auth: oauthAuth(), path: 'meetings', maxPages: 3 });
+ expect(fetchMock).toHaveBeenCalledTimes(3);
+ expect(result.truncated).toBe(true);
+ });
+});
diff --git a/packages/pieces/community/fathom/test/custom-api-call.test.ts b/packages/pieces/community/fathom/test/custom-api-call.test.ts
new file mode 100644
index 00000000000..2e9c1142de0
--- /dev/null
+++ b/packages/pieces/community/fathom/test/custom-api-call.test.ts
@@ -0,0 +1,70 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { fathom } from '../src/index';
+import { apiKeyAuth, installFetch, jsonResponse, requestOf, runAction } from './helpers';
+
+let fetchMock: ReturnType<typeof installFetch>;
+
+beforeEach(() => {
+ fetchMock = installFetch();
+});
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
+
+function customApiCall() {
+ const action = fathom.actions()['custom_api_call'];
+ if (action === undefined) {
+ throw new Error('custom_api_call is not registered');
+ }
+ return action;
+}
+
+function propsFor({ url }: { url: string }) {
+ return { method: 'GET', url: { url }, headers: {}, queryParams: {}, failsafe: false };
+}
+
+describe('Custom API Call credential host lock', () => {
+ it.each([
+ 'https://evil.example.com/meetings',
+ 'https://api.fathom.ai.evil.example.com/external/v1/meetings',
+ 'https://api.fathom.ai/external/v2/meetings',
+ 'http://api.fathom.ai/external/v1/meetings',
+ '//evil.example.com/meetings',
+ ])('refuses to send credentials to %s', async (url) => {
+ await expect(runAction({ action: customApiCall(), propsValue: propsFor({ url }) })).rejects.toThrow(
+ 'Custom API Call only sends your Fathom credentials to https://api.fathom.ai/external/v1'
+ );
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('refuses path traversal out of the Fathom API base', async () => {
+ await expect(
+ runAction({ action: customApiCall(), propsValue: propsFor({ url: 'https://api.fathom.ai/external/v1/../admin' }) })
+ ).rejects.toThrow('The URL must be a path on the Fathom API');
+ await expect(runAction({ action: customApiCall(), propsValue: propsFor({ url: '/../admin' }) })).rejects.toThrow(
+ 'The URL must be a path on the Fathom API'
+ );
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('accepts a relative path and sends it to the Fathom API base with the OAuth token', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { items: [] } }));
+ await runAction({ action: customApiCall(), propsValue: propsFor({ url: '/meetings' }) });
+ const request = requestOf({ fetchMock, call: 0 });
+ expect(request.url).toBe('https://api.fathom.ai/external/v1/meetings');
+ expect(request.headers['authorization']).toBe('Bearer tok_test');
+ });
+
+ it('accepts a full Fathom API URL with an API key connection', async () => {
+ fetchMock.mockResolvedValueOnce(jsonResponse({ body: { items: [] } }));
+ await runAction({
+ action: customApiCall(),
+ propsValue: propsFor({ url: 'https://api.fathom.ai/external/v1/teams' }),
+ auth: apiKeyAuth(),
+ });
+ const request = requestOf({ fetchMock, call: 0 });
+ expect(request.url).toBe('https://api.fathom.ai/external/v1/teams');
+ expect(request.headers['x-api-key']).toBe('key_test');
+ });
+});
diff --git a/packages/pieces/community/fathom/test/helpers.ts b/packages/pieces/community/fathom/test/helpers.ts
new file mode 100644
index 00000000000..f9caccd11ff
--- /dev/null
+++ b/packages/pieces/community/fathom/test/helpers.ts
@@ -0,0 +1,98 @@
+import { AppConnectionType } from '@activepieces/pieces-framework';
+import { vi } from 'vitest';
+import { createMockActionContext } from '../../../framework/src/lib/test';
+
+export function oauthAuth() {
+ return {
+ type: AppConnectionType.OAUTH2 as const,
+ access_token: 'tok_test',
+ client_id: 'client',
+ client_secret: 'secret',
+ redirect_url: 'https://example.com/redirect',
+ token_type: 'Bearer',
+ claimed_at: 0,
+ refresh_token: 'refresh',
+ scope: 'public_api',
+ token_url: 'https://fathom.video/external/v1/oauth2/token',
+ data: {},
+ };
+}
+
+export function apiKeyAuth() {
+ return { type: AppConnectionType.SECRET_TEXT as const, secret_text: ' key_test ' };
+}
+
+export function runAction({
+ action,
+ propsValue,
+ auth = oauthAuth(),
+}: {
+ action: { run: (context: never) => Promise<unknown> };
+ propsValue: Record<string, unknown>;
+ auth?: ReturnType<typeof oauthAuth> | ReturnType<typeof apiKeyAuth>;
+}): Promise<unknown> {
+ const context = { ...createMockActionContext({ propsValue: {} }), propsValue, auth };
+ return Reflect.apply(action.run, action, [context]);
+}
+
+export function memoryStore() {
+ const data = new Map<string, string>();
+ return {
+ data,
+ store: {
+ put: async <T>(key: string, value: T) => {
+ data.set(key, JSON.stringify(value));
+ return value;
+ },
+ get: async <T>(key: string): Promise<T | null> => {
+ const raw = data.get(key);
+ return raw === undefined ? null : JSON.parse(raw);
+ },
+ delete: async (key: string) => {
+ data.delete(key);
+ },
+ },
+ };
+}
+
+export function jsonResponse({ status = 200, body }: { status?: number; body: unknown }): Response {
+ return new Response(body === undefined ? null : JSON.stringify(body), {
+ status,
+ headers: { 'content-type': 'application/json' },
+ });
+}
+
+export function installFetch() {
+ const fetchMock = vi.fn();
+ vi.stubGlobal('fetch', fetchMock);
+ return fetchMock;
+}
+
+export function requestOf({ fetchMock, call }: { fetchMock: ReturnType<typeof vi.fn>; call: number }) {
+ const [input, init] = fetchMock.mock.calls[call];
+ if (input instanceof Request) {
+ return { url: input.url, method: input.method, headers: Object.fromEntries(input.headers.entries()) };
+ }
+ const headers = new Headers(init?.headers);
+ return { url: String(input), method: String(init?.method ?? 'GET'), headers: Object.fromEntries(headers.entries()), body: init?.body };
+}
+
+export function meeting(overrides: Record<string, unknown>) {
+ return {
+ title: 'Weekly Sync',
+ meeting_title: 'Weekly Sync',
+ recording_id: 111,
+ url: 'https://fathom.video/calls/1',
+ share_url: 'https://fathom.video/share/1',
+ created_at: '2026-10-01T10:00:00Z',
+ scheduled_start_time: '2026-10-01T09:00:00Z',
+ scheduled_end_time: '2026-10-01T09:30:00Z',
+ recording_start_time: '2026-10-01T09:01:00Z',
+ recording_end_time: '2026-10-01T09:29:00Z',
+ calendar_invitees_domains_type: 'only_internal',
+ transcript_language: 'en',
+ calendar_invitees: [],
+ recorded_by: { name: 'Jane', email: '[email protected]', email_domain: 'example.com', team: null },
+ ...overrides,
+ };
+}
diff --git a/packages/pieces/community/fathom/test/trigger.test.ts b/packages/pieces/community/fathom/test/trigger.test.ts
new file mode 100644
index 00000000000..0640a383f8b
--- /dev/null
+++ b/packages/pieces/community/fathom/test/trigger.test.ts
@@ -0,0 +1,312 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { newRecording } from '../src/lib/triggers/new-recording';
+import { fathomWebhook } from '../src/lib/common/webhook';
+import { installFetch, jsonResponse, meeting, memoryStore, oauthAuth, requestOf } from './helpers';
+
+const SECRET = `whsec_${Buffer.from('fathom-test-secret-key-32-bytes!!').toString('base64')}`;
+const DEFAULT_PROPS = {
+ triggered_for: ['my_recordings'],
+ include_transcript: false,
+ include_summary: true,
+ include_action_items: false,
+ include_crm_matches: false,
+};
+
+let fetchMock: ReturnType<typeof installFetch>;
+
+beforeEach(() => {
+ fetchMock = installFetch();
+});
+
+afterEach(() => {
+ vi.unstubAllGlobals();
+});
+
+function context({ store, propsValue = DEFAULT_PROPS, payload }: { store: ReturnType<typeof memoryStore>['store']; propsValue?: Record<string, unknown>; payload?: unknown }) {
+ return { auth: oauthAuth(), propsValue, store, webhookUrl: 'https://cloud.example.com/v1/webhooks/flow1', payload };
+}
+
+function call<T>({ fn, ctx }: { fn: (ctx: never) => Promise<T>; ctx: unknown }): Promise<T> {
+ return Reflect.apply(fn, newRecording, [ctx]);
+}
+
+function signedPayload({ id = 'msg_1', ts = Math.floor(Date.now() / 1000), body = JSON.stringify(meeting({})), secret = SECRET }: { id?: string; ts?: number; body?: string; secret?: string }) {
+ return {
+ body: JSON.parse(body),
+ rawBody: body,
+ headers: { 'Webhook-Id': id, 'Webhook-Timestamp': String(ts), 'Webhook-Signature': `v0,abc ${fathomWebhook.sign({ secret, webhookId: id, timestamp: ts, body })}` },
+ };
+}
+
+describe('newRecording props', () => {
+ it('defaults Include Summary to true on new steps so Fathom accepts the webhook', () => {
+ expect(newRecording.props.include_summary.defaultValue).toBe(true);
+ });
+});
+
+describe('onEnable / onDisable', () => {
+ it('creates the webhook with the default settings and stores id and secret', async () => {
+ const { store, data } = memoryStore();
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 201, body: { id: 'wh_1', secret: SECRET, url: 'x' } }));
+ await call({ fn: newRecording.onEnable, ctx: context({ store }) });
+ const req = requestOf({ fetchMock, call: 0 });
+ expect(req.method).toBe('POST');
+ expect(req.url).toBe('https://api.fathom.ai/external/v1/webhooks');
+ expect(JSON.parse(String(req.body))).toEqual({
+ destination_url: 'https://cloud.example.com/v1/webhooks/flow1',
+ triggered_for: ['my_recordings'],
+ include_transcript: false,
+ include_summary: true,
+ include_action_items: false,
+ include_crm_matches: false,
+ });
+ expect(JSON.parse(data.get('_new_recording_webhook') ?? '{}')).toEqual({ webhookId: 'wh_1', secret: SECRET });
+ });
+
+ it('refuses all-false include flags before calling Fathom', async () => {
+ const { store } = memoryStore();
+ await expect(call({ fn: newRecording.onEnable, ctx: context({ store, propsValue: { ...DEFAULT_PROPS, include_summary: false } }) })).rejects.toThrow('at least one');
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it('throws when Fathom rejects the create instead of looking enabled', async () => {
+ const { store, data } = memoryStore();
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 400, body: { error: 'At least one include flag must be true' } }));
+ await expect(call({ fn: newRecording.onEnable, ctx: context({ store }) })).rejects.toThrow('(400)');
+ expect(data.size).toBe(0);
+ });
+
+ it('deletes the created webhook when storing it fails', async () => {
+ const { store } = memoryStore();
+ const failing = { ...store, put: async () => Promise.reject(new Error('store down')) };
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 201, body: { id: 'wh_9', secret: SECRET } })).mockResolvedValueOnce(new Response(null, { status: 204 }));
+ await expect(call({ fn: newRecording.onEnable, ctx: context({ store: failing }) })).rejects.toThrow('store down');
+ const del = requestOf({ fetchMock, call: 1 });
+ expect(del).toMatchObject({ method: 'DELETE', url: 'https://api.fathom.ai/external/v1/webhooks/wh_9' });
+ });
+
+ it('onDisable forgets the webhook on 204 and 404 but keeps it on other errors', async () => {
+ const { store, data } = memoryStore();
+ await store.put('_new_recording_webhook', { webhookId: 'wh_1', secret: SECRET });
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 500, body: { error: 'boom' } }));
+ await expect(call({ fn: newRecording.onDisable, ctx: context({ store }) })).rejects.toThrow('500');
+ expect(data.has('_new_recording_webhook')).toBe(true);
+ fetchMock.mockResolvedValueOnce(jsonResponse({ status: 404, body: {} }));
+ await call({ fn: newRecording.onDisable, ctx: context({ store }) });
+ expect(data.has('_new_recording_webhook')).toBe(false);
+ });
+});
+
+describe('run: signature and dedupe', () => {
+ beforeEach(() => {
+ vi.useFakeTimers({ toFake: ['setTimeout'] });
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
+ async function enabledStore() {
+ const holder = memoryStore();
+ await holder.store.put('_new_recording_webhook', { webhookId: 'wh_1', secret: SECRET });
+ return holder;
+ }
+
+ async function run({ store, payload }: { store: ReturnType<typeof memoryStore>['store']; payload: unknown }): Promise<unknown[]> {
+ const pending = call({ fn: newRecording.run, ctx: context({ store, payload }) });
+ pending.catch(() => undefined);
+ await vi.advanceTimersByTimeAsync(1000);
+ return pending;
+ }
+
+ it('accepts a valid signature and returns the raw snake_case body', async () => {
+ const { store } = await enabledStore();
+ expect(await run({ store, payload: signedPayload({}) })).toEqual([meeting({})]);
+ });
+
+ it('drops a forged signature', async () => {
+ const { store } = await enabledStore();
+ const payload = signedPayload({ secret: `whsec_${Buffer.from('another-secret').toString('base64')}` });
+ expect(await run({ store, payload })).toEqual([]);
+ });
+
+ it('drops a tampered body', async () => {
+ const { store } = await enabledStore();
+ const payload = { ...signedPayload({}), rawBody: JSON.stringify(meeting({ title: 'Injected' })) };
+ expect(await run({ store, payload })).toEqual([]);
+ });
+
+ it('accepts a delivery 14 minutes old but drops one older than 15 minutes', async () => {
+ const { store } = await enabledStore();
+ const now = Math.floor(Date.now() / 1000);
+ expect(await run({ store, payload: signedPayload({ id: 'msg_a', ts: now - 840 }) })).toHaveLength(1);
+ expect(await run({ store, payload: signedPayload({ id: 'msg_b', ts: now - 901 }) })).toEqual([]);
+ });
+
+ it('drops a retried delivery with the same webhook-id', async () => {
+ const { store } = await enabledStore();
+ expect(await run({ store, payload: signedPayload({ id: 'msg_dup' }) })).toHaveLength(1);
+ expect(await run({ store, payload: signedPayload({ id: 'msg_dup' }) })).toEqual([]);
+ });
+
+ it('emits once when two copies of the same delivery run at the same time', async () => {
+ const { store } = await enabledStore();
+ const payload = signedPayload({ id: 'msg_race' });
+ const first = call({ fn: newRecording.run, ctx: context({ store, payload }) });
+ const second = call({ fn: newRecording.run, ctx: context({ store, payload }) });
+ await vi.advanceTimersByTimeAsync(1000);
+ const results = await Promise.all([first, second]);
+ expect(results.map((items) => items.length).sort()).toEqual([0, 1]);
+ });
+
+ it('keeps both recordings in the seen list when two different deliveries run at the same time', async () => {
+ const { store, data } = await enabledStore();
+ const first = call({ fn: newRecording.run, ctx: context({ store, payload: signedPayload({ id: 'msg_one' }) }) });
+ const second = call({ fn: newRecording.run, ctx: context({ store, payload: signedPayload({ id: 'msg_two' }) }) });
+ await vi.advanceTimersByTimeAsync(1000);
+ expect((await Promise.all([first, second])).map((items) => items.length)).toEqual([1, 1]);
+ const ids = fathomWebhook.seenDeliveryKeys({ seen: JSON.parse(data.get('_fathom_seen_ids') ?? '[]') });
+ expect(ids.sort()).toEqual([fathomWebhook.deliveryKeyOf({ webhookId: 'msg_one' }), fathomWebhook.deliveryKeyOf({ webhookId: 'msg_two' })].sort());
+ });
+
+ it('re-adds its entry when another run overwrites the seen list right after its write', async () => {
+ const holder = await enabledStore();
+ let overwrites = 0;
+ const racing = {
+ ...holder.store,
+ put: async <T>(key: string, value: T) => {
+ await holder.store.put(key, value);
+ if (key === '_fathom_seen_ids' && overwrites === 0) {
+ overwrites++;
+ await holder.store.put(key, [{ id: 'other', ts: Math.floor(Date.now() / 1000) }]);
+ }
+ return value;
+ },
+ };
+ expect(await run({ store: racing, payload: signedPayload({ id: 'msg_mine' }) })).toHaveLength(1);
+ const ids = fathomWebhook.seenDeliveryKeys({ seen: JSON.parse(holder.data.get('_fathom_seen_ids') ?? '[]') });
+ expect(ids).toEqual(['other', fathomWebhook.deliveryKeyOf({ webhookId: 'msg_mine' })]);
+ });
+
+ it('drops a retry whose claim exists even if the seen list lost it to a concurrent write', async () => {
+ const { store } = await enabledStore();
+ expect(await run({ store, payload: signedPayload({ id: 'msg_lost' }) })).toHaveLength(1);
+ await store.put('_fathom_seen_ids', []);
+ expect(await run({ store, payload: signedPayload({ id: 'msg_lost' }) })).toEqual([]);
+ });
+
+ it('still drops a retry of the first event after 150 other events inside the window', async () => {
+ const { store } = await enabledStore();
+ const now = Math.floor(Date.now() / 1000);
+ expect(await run({ store, payload: signedPayload({ id: 'msg_first', ts: now - 60 }) })).toHaveLength(1);
+ for (let i = 0; i < 150; i++) {
+ expect(await run({ store, payload: signedPayload({ id: `msg_${i}` }) })).toHaveLength(1);
+ }
+ expect(await run({ store, payload: signedPayload({ id: 'msg_first', ts: now - 60 }) })).toEqual([]);
+ });
+
+ it('throws a re-enable message for state saved by 0.2.x without a signing secret', async () => {
+ const { store } = memoryStore();
+ await store.put('_new_recording_webhook', { webhookId: 'wh_legacy' });
+ await expect(run({ store, payload: signedPayload({}) })).rejects.toThrow('Turn the flow off and on again');
+ });
+
+ it('fails closed when the trigger is not enabled or headers are missing', async () => {
+ const { store } = memoryStore();
+ expect(await run({ store, payload: signedPayload({}) })).toEqual([]);
+ const enabled = await enabledStore();
+ expect(await run({ store: enabled.store, payload: { body: {}, rawBody: '{}', headers: {} } })).toEqual([]);
+ });
+
+ it('refuses rather than forgets when the window holds the maximum number of deliveries', async () => {
+ const { store } = await enabledStore();
+ const now = Math.floor(Date.now() / 1000);
+ const full = Array.from({ length: fathomWebhook.MAX_SEEN_IDS }, (_, i) => ({ id: `k${i}`, ts: now }));
+ await store.put('_fathom_seen_ids', full);
+ await expect(run({ store, payload: signedPayload({ id: 'msg_over' }) })).rejects.toThrow('not processed');
+ });
+
+ it('refuses and releases its claim when the list fills up during the claim wait', async () => {
+ const holder = await enabledStore();
+ const now = Math.floor(Date.now() / 1000);
+ const full = Array.from({ length: fathomWebhook.MAX_SEEN_IDS }, (_, i) => ({ id: `k${i}`, ts: now }));
+ const filling = {
+ ...holder.store,
+ put: async <T>(key: string, value: T) => {
+ await holder.store.put(key, value);
+ if (key.startsWith('_fathom_delivery_')) {
+ await holder.store.put('_fathom_seen_ids', full);
+ }
+ return value;
+ },
+ };
+ await expect(run({ store: filling, payload: signedPayload({ id: 'msg_late' }) })).rejects.toThrow('not processed');
+ expect(holder.data.has(`_fathom_delivery_${fathomWebhook.deliveryKeyOf({ webhookId: 'msg_late' })}`)).toBe(false);
+ expect(JSON.parse(holder.data.get('_fathom_seen_ids') ?? '[]')).toHaveLength(fathomWebhook.MAX_SEEN_IDS);
+ });
+
+ it('deletes expired claims and onDisable deletes the rest', async () => {
+ const { store, data } = await enabledStore();
+ const now = Math.floor(Date.now() / 1000);
+ await store.put('_fathom_seen_ids', [{ id: 'old', ts: now - 1000 }]);
+ await store.put('_fathom_delivery_old', { token: 't', ts: now - 1000 });
+ expect(await run({ store, payload: signedPayload({ id: 'msg_new' }) })).toHaveLength(1);
+ expect(data.has('_fathom_delivery_old')).toBe(false);
+ const newKey = `_fathom_delivery_${fathomWebhook.deliveryKeyOf({ webhookId: 'msg_new' })}`;
+ expect(data.has(newKey)).toBe(true);
+ fetchMock.mockResolvedValueOnce(new Response(null, { status: 204 }));
+ await call({ fn: newRecording.onDisable, ctx: context({ store }) });
+ expect(data.size).toBe(0);
+ });
+});
+
+describe('rememberDelivery', () => {
+ const now = 1_800_000_000;
+
+ it('keeps every ID inside the window past 100 events and flags a replay of the first', () => {
+ let seen: unknown = [];
+ for (let i = 0; i < 150; i++) {
+ const next = fathomWebhook.rememberDelivery({ seen, deliveryKey: `k${i}`, timestamp: now - 600 + i, nowSeconds: now });
+ expect(next.status).toBe('new');
+ seen = next.seen;
+ }
+ expect(fathomWebhook.rememberDelivery({ seen, deliveryKey: 'k0', timestamp: now - 600, nowSeconds: now }).status).toBe('duplicate');
+ });
+
+ it('prunes by age, not by count', () => {
+ const seen = [
+ { id: 'stale', ts: now - fathomWebhook.TOLERANCE_SECONDS - 1 },
+ { id: 'edge', ts: now - fathomWebhook.TOLERANCE_SECONDS },
+ ];
+ const next = fathomWebhook.rememberDelivery({ seen, deliveryKey: 'fresh', timestamp: now, nowSeconds: now });
+ expect(next.status).toBe('new');
+ expect(next.expired).toEqual(['stale']);
+ expect(next.seen.map((entry) => entry.id)).toEqual(['edge', 'fresh']);
+ });
+
+ it('reports full instead of dropping a live ID at the cap', () => {
+ const seen = Array.from({ length: fathomWebhook.MAX_SEEN_IDS }, (_, i) => ({ id: `k${i}`, ts: now }));
+ const next = fathomWebhook.rememberDelivery({ seen, deliveryKey: 'extra', timestamp: now, nowSeconds: now });
+ expect(next.status).toBe('full');
+ expect(next.seen).toHaveLength(fathomWebhook.MAX_SEEN_IDS);
+ expect(next.seen[0].id).toBe('k0');
+ });
+
+ it('ignores malformed stored entries', () => {
+ const next = fathomWebhook.rememberDelivery({ seen: ['legacy', { id: 1 }, null], deliveryKey: 'a', timestamp: now, nowSeconds: now });
+ expect(next.seen).toEqual([{ id: 'a', ts: now }]);
+ });
+});
+
+describe('test()', () => {
+ it('returns raw snake_case meetings and fetches the summary from /recordings under OAuth', async () => {
+ const { store } = memoryStore();
+ fetchMock
+ .mockResolvedValueOnce(jsonResponse({ body: { items: [meeting({ recording_id: 42 })], next_cursor: null } }))
+ .mockResolvedValueOnce(jsonResponse({ body: { summary: { template_name: 'general', markdown_formatted: '## S' } } }));
+ const result = await call({ fn: newRecording.test, ctx: context({ store }) });
+ expect(requestOf({ fetchMock, call: 0 }).url).toBe('https://api.fathom.ai/external/v1/meetings');
+ expect(requestOf({ fetchMock, call: 1 }).url).toBe('https://api.fathom.ai/external/v1/recordings/42/summary');
+ expect(result).toEqual([{ ...meeting({ recording_id: 42 }), default_summary: { template_name: 'general', markdown_formatted: '## S' } }]);
+ });
+});
diff --git a/packages/pieces/community/fathom/vitest.config.ts b/packages/pieces/community/fathom/vitest.config.ts
new file mode 100644
index 00000000000..79c97261904
--- /dev/null
+++ b/packages/pieces/community/fathom/vitest.config.ts
@@ -0,0 +1,19 @@
+import path from 'path'
+import { defineConfig } from 'vitest/config'
+
+const repoRoot = path.resolve(__dirname, '../../../..')
+
+export default defineConfig({
+ root: __dirname,
+ test: {
+ globals: true,
+ environment: 'node',
+ include: ['test/**/*.test.ts'],
+ },
+ resolve: {
+ alias: {
+ '@activepieces/pieces-framework': path.resolve(repoRoot, 'packages/pieces/framework/src/index.ts'),
+ '@activepieces/pieces-common': path.resolve(repoRoot, 'packages/pieces/common/src/index.ts'),
+ },
+ },
+})