Skip to content

Sync Fathom recordings from webhooks - #25208

Open
ehconitin wants to merge 4 commits into
mainfrom
ehco/fathom-3-live-sync
Open

Sync Fathom recordings from webhooks#25208
ehconitin wants to merge 4 commits into
mainfrom
ehco/fathom-3-live-sync

Conversation

@ehconitin

@ehconitin ehconitin commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • register signed Fathom webhooks per connected account
  • route deliveries through TWENTY_FUNCTIONS_URL, including self-hosted /s paths
  • verify deliveries and idempotently upsert Call Recordings
  • match calendar events by meeting URL and scheduled time, only when unambiguous
  • delete every registered Fathom webhook when the app is uninstalled

Validation

  • 21 unit tests across 8 behavior-focused files
  • yarn typecheck, yarn twenty dev:typecheck, yarn twenty dev:build
  • yarn lint, oxfmt --check src/

Stack

3 of 4, now based on main since the OAuth PR merged in #25197. Replaces #24902, which could not be reopened after its base branch was deleted. Review findings from that PR are resolved here: paginated calendar matching, compensating delete for the webhook registration write, uninstall hook, string literals over enum-like constant objects, and the as casts removed.

Discovery and backfill are deferred to the next PR.

Review in cubic

@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Sep 2, 2026

Copy link
Copy Markdown

🚀 Preview Environment Ready!

Your preview environment is available at: https://gate-subcommittee-step-parents.trycloudflare.com

This environment will automatically shut down after 5 hours.

@socket-security

socket-security Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​fathom-typescript@​0.0.438610010094100

View full report

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds signed, account-scoped Fathom webhook registration and ingestion, synchronizes delivered recordings into Call Recordings, and adds disconnect and uninstall lifecycle handling.

  • Registers signed Fathom webhooks for connected accounts.
  • Verifies deliveries and idempotently upserts recording data.
  • Matches calendar events by normalized meeting URL and scheduled time.
  • Adds connection teardown and application uninstall cleanup.

Confidence Score: 4/5

The PR is not yet safe to merge because uninstall still loses the cleanup identifier when Fathom transiently rejects webhook deletion.

A non-404 Fathom deletion failure is caught, but the corresponding registration is then deleted unconditionally, leaving an active remote webhook without recoverable cleanup state.

Files Needing Attention: packages/twenty-apps/public/fathom/src/logic-functions/fathom-uninstall.ts

Important Files Changed

Filename Overview
packages/twenty-apps/public/fathom/src/logic-functions/fathom-webhook.ts Adds signature verification, inactive-registration handling, payload parsing, and Call Recording synchronization for incoming Fathom deliveries.
packages/twenty-apps/public/fathom/src/logic-functions/fathom-register-connection.ts Registers account-scoped Fathom webhooks and stores their identifiers and signing secrets with compensating cleanup around storage failures.
packages/twenty-apps/public/fathom/src/logic-functions/fathom-uninstall.ts Iterates through connected Fathom accounts and performs best-effort remote webhook cleanup during application uninstall.
packages/twenty-apps/public/fathom/src/logic-functions/utils/sync-fathom-meeting-to-call-recording.util.ts Maps Fathom meeting content into deterministic, idempotently synchronized Call Recording records.
packages/twenty-apps/public/fathom/src/logic-functions/utils/find-matching-calendar-event.util.ts Searches paginated calendar events and links only a unique nearest match with the normalized meeting URL.

Sequence Diagram

sequenceDiagram
  participant User
  participant Twenty
  participant KV
  participant Fathom
  participant CRM
  User->>Twenty: Connect Fathom account
  Twenty->>Fathom: Register signed webhook
  Fathom-->>Twenty: Webhook ID and signing secret
  Twenty->>KV: Store account-scoped registration
  Fathom->>Twenty: Deliver recording webhook
  Twenty->>KV: Load registration secret
  Twenty->>Twenty: Verify signature and parse meeting
  Twenty->>CRM: Match calendar event and upsert Call Recording
  User->>Twenty: Uninstall application
  Twenty->>Fathom: Delete each registered webhook
  Twenty->>KV: Delete registration state
Loading

Reviews (2): Last reviewed commit: "Use isDefined for the call recording exi..." | Re-trigger Greptile

Comment thread packages/twenty-apps/public/fathom/src/logic-functions/fathom-uninstall.ts Outdated
@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Sep 2, 2026

Copy link
Copy Markdown

🤖 PR Review

Check Result
🔍 Build safety ⏭️ skipped — external-only
🛡️ Security ✅ passed
🧭 Triage ⏭️ skipped — external-only
📐 Quality ✅ passed
🚦 Auto-approve 👀 needs review — Complexity is medium

🛡️ Security Review

No high-severity vulnerabilities detected.


🚦 Auto-approve

🙋 Manual review recommended for the following reason(s):

  • Complexity is medium

  • 🧠 Complexity: medium

  • 📏 Size: +1659 / -8 lines across 43 file(s)


View details

Automated pre-review — human approval still required.

@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Sep 2, 2026

Copy link
Copy Markdown

✅ Quality review · no findings

Safe to merge — no findings; all prior review findings are fixed and every human/bot comment is answered

High-level — Clean additive single-directory Fathom app — product context documented, no migration/flag/public surface, disconnect-deletion deferral tracked behind #25215.
Low-level — Guards use isDefined/isNonEmptyString, object params are Pick-narrowed with no casts, comments are legitimate external-constraint WHY notes, and prior typing nits are all resolved.


Reviewed against the pr-review standard — high-level then low-level. Advisory; human review still required. Run details.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 37 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/twenty-apps/public/fathom/src/logic-functions/utils/upsert-call-recording.util.ts">

<violation number="1" location="packages/twenty-apps/public/fathom/src/logic-functions/utils/upsert-call-recording.util.ts:34">
P2: When `createCallRecording` resolves without a returned record, this function reports `created: true` and the webhook succeeds even though creation was not confirmed. Validate `createResult.createCallRecording?.id` before returning so the delivery is retried or the failure is surfaced.</violation>
</file>

<file name="packages/twenty-apps/public/fathom/src/logic-functions/fathom-uninstall.ts">

<violation number="1" location="packages/twenty-apps/public/fathom/src/logic-functions/fathom-uninstall.ts:13">
P1: When a Fathom account was disconnected before app uninstall, this loop cannot delete its webhook. `fathomDisconnectHandler` retains the registration, but `listConnections` only returns remaining connected accounts, so the retained Fathom subscription is orphaned. Persist registrations in a durable uninstall-visible registry or delete them during disconnect with a valid credential.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/twenty-apps/public/fathom/src/logic-functions/fathom-uninstall.ts Outdated
@ehconitin
ehconitin force-pushed the ehco/fathom-3-live-sync branch from 031499b to c165ade Compare September 2, 2026 11:28

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 40 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 4 unresolved issues already reported by Cubic.

Re-trigger cubic

@ehconitin
ehconitin force-pushed the ehco/fathom-3-live-sync branch from c165ade to d36fcfb Compare September 2, 2026 15:10

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 40 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 7 unresolved issues already reported by Cubic.
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

- filter isCanceled out of the calendar matching window and strip a leading www. when comparing meeting URLs
- extract the stale-webhook delete and the store-or-rollback step out of the register hook so it reads top to bottom
- use isDefined and isNonEmptyString guards instead of truthiness checks
- lock the calendar page cap in the existing matcher test
@ehconitin

Copy link
Copy Markdown
Member Author

@greptileai

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant