Skip to content

feat(warehouse): sync Gong call participants and CRM associations - #71046

Merged
simfish85 merged 5 commits into
masterfrom
posthog-code/gong-calls-extensive-crm
Jul 16, 2026
Merged

feat(warehouse): sync Gong call participants and CRM associations#71046
simfish85 merged 5 commits into
masterfrom
posthog-code/gong-calls-extensive-crm

Conversation

@simfish85

Copy link
Copy Markdown
Contributor

Problem

PostHog's alpha Gong connector syncs four tables — calls, users, scorecards, workspaces — none of which carry call participants or CRM associations. That's because the calls table is fed by the basic GET /v2/calls list endpoint, which returns only flat call metadata. Gong exposes participant identities (parties) and CRM object links (context) exclusively through the separate POST /v2/calls/extensive endpoint, which the connector didn't call — so even with CRM association configured perfectly in Gong, there was no field to carry it into the warehouse.

Why: A user wanted their Gong calls joined to CRM/account data (and participant emails) inside PostHog, and found the synced calls rows had no association fields at all. This makes that data available.

Changes

  • New calls_extensive data-warehouse table backed by POST /v2/calls/extensive, returning each call's parties (participant name/email/affiliation) and CRM context (linked Salesforce/HubSpot objects and fields).
  • Reuses the existing date-windowed, cursor-paginated, incremental-on-started sync path. Added POST support to the fetcher (filter + content selector + cursor in the JSON body) and flattening of the extensive response's metaData wrapper so id/started stay top-level for merge and partitioning while parties/context become nested columns.
  • Kept as a separate table so enabling it never changes the existing calls schema.
  • Documents the additional api:calls:read:extensive scope in the connection caption, and adds canonical column descriptions for the new table.

How did you test this code?

Added unit tests in test_gong.py covering the new path: that calls_extensive issues a POST to /v2/calls/extensive with the correct contentSelector (Extended context + parties), flattens metaData up while preserving parties/context, and passes the pagination cursor in the body rather than the query string. Updated the endpoint-set assertion to include the new table.

I (the agent) was not able to run the repo's pytest suite in this environment (dev dependencies aren't installed). I verified all edited modules byte-compile and exercised the new body-building and flattening logic in a standalone harness. The tests follow the existing _FakeSession patterns in the file and should be run in CI.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored by the PostHog Slack app from a support thread. The root cause was diagnosed by inspecting the connector source (basic /v2/calls vs /v2/calls/extensive) and confirming the synced tables carry no association data. Chose to add a dedicated calls_extensive table rather than switch calls to the extensive endpoint, to avoid a breaking schema change to an existing table. No repo skills were invoked.


Created with PostHog from a Slack thread

Add a `calls_extensive` table to the Gong data-warehouse source, backed by
`POST /v2/calls/extensive`. Unlike the basic `GET /v2/calls` list that the
existing `calls` table uses, the extensive endpoint returns each call's
`parties` (participant name/email/affiliation) and CRM `context` (linked
Salesforce/HubSpot objects and their fields), so this data now lands in the
warehouse.

The new table reuses the existing date-windowed, cursor-paginated,
incremental-on-`started` machinery. The extensive endpoint is POST-based with
its filter, content selector, and pagination cursor in a JSON body, and wraps
call fields under `metaData`; those rows are flattened so `id`/`started` stay
top-level for merge and partitioning while `parties`/`context` ride along as
nested columns. Kept as a separate table so enabling it never changes the
`calls` schema. Requires the broader `api:calls:read:extensive` scope, noted in
the connection caption.

Generated-By: PostHog Code
Task-Id: 629c7cae-fbb5-4716-8f26-41ceb444e81e
@github-actions

Copy link
Copy Markdown
Contributor

Hey @simfish85! 👋

It looks like your git author email on this PR isn't your @posthog.com address (simfish85@googlemail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@simfish85
simfish85 marked this pull request as ready for review July 15, 2026 12:25
@simfish85
simfish85 requested a review from Gilbert09 July 15, 2026 12:25
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 15, 2026 12:25
Comment thread products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py Outdated
@veria-ai

veria-ai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@trunk-io

trunk-io Bot commented Jul 15, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

simfish85 and others added 4 commits July 15, 2026 13:53
Generated-By: PostHog Code
Task-Id: 629c7cae-fbb5-4716-8f26-41ceb444e81e
Generated-By: PostHog Code
Task-Id: 629c7cae-fbb5-4716-8f26-41ceb444e81e
…ture

The `/v2/calls/extensive` responses carry participant names and free-form CRM
field values that the name-based sample scrubbers can't recognise. Default
tracked-session sampling would copy those bodies into HTTP troubleshooting
storage. Add a per-endpoint `capture_http_samples` flag (default True) and set
it False for `calls_extensive`, so its requests stay metered and logged but
their bodies are excluded from sample capture. Basic list endpoints are
unaffected.

Generated-By: PostHog Code
Task-Id: 629c7cae-fbb5-4716-8f26-41ceb444e81e
@simfish85
simfish85 merged commit 3b9197e into master Jul 16, 2026
177 checks passed
@simfish85
simfish85 deleted the posthog-code/gong-calls-extensive-crm branch July 16, 2026 08:40
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-16 09:03 UTC Run
prod-us ✅ Deployed 2026-07-16 09:16 UTC Run
prod-eu ✅ Deployed 2026-07-16 09:19 UTC Run

@gvago

gvago commented Jul 16, 2026

Copy link
Copy Markdown

hey @Gilbert09,
I only came across PostHog last week and already using it (great product), and would love to contribute, but i also don't like to push myself on to the OSS.
I noticed you ran veria-ai and now some greptile... and wondered y not qodo (not the lame old FOOS, the full enterprise edition FOC)

You have a ton of PRs waiting.

writing to you here since i noticed that if you run pnpm --filter=@posthog/frontend typegen:write (or the repo’s kea-typegen command) in CI/local and observe whether it errors or writes inline type output into unexpected locations due to inlinePaths entries pointing at non-existent ./frontend/src/.kea-inline-* paths relative to rootPath.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants