Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): add gong activity, library, flows, and call outcome tables (#110735)

Tom Owers07941c938d7d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
index 68514917b2eb..3c4fb5585a8f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
@@ -3726,7 +3726,7 @@ Note: The swagger-ui URL recorded in the source (https://customapi.goldcast.io/s
## Gong — gaps
-Today (10): `answered_scorecards`, `calls`, `calls_content`, `calls_extensive`, `interaction_stats`, `scorecards`, `trackers`, `transcripts`, `users`, `workspaces`
+Today (15): `answered_scorecards`, `call_outcomes`, `calls`, `calls_content`, `calls_extensive`, `daily_activity`, `flows`, `interaction_stats`, `library_folder_calls`, `library_folders`, `scorecards`, `trackers`, `transcripts`, `users`, `workspaces`
Diffed against: <https://help.gong.io/llms.txt>
@@ -3734,13 +3734,13 @@ Diffed against: <https://help.gong.io/llms.txt>
- [x] `stats/activity/scorecards` — answered scorecard responses; we currently only sync scorecard definitions, not the reviews (high)
- [x] `settings/trackers` — lookup resolving the tracker IDs that appear on calls_extensive (high)
- [x] `stats/interaction` — talk ratio, patience, longest monologue - Gong's signature conversation metrics per user (high)
-- [ ] `stats/activity/day-by-day` — daily per-rep activity fact table for coaching and adoption reporting (high)
-- [ ] `call-outcomes` — lookup resolving call outcome values used to segment calls (medium)
+- [x] `stats/activity/day-by-day` — daily per-rep activity fact table for coaching and adoption reporting (high)
+- [x] `call-outcomes` — lookup resolving call outcome values used to segment calls (medium)
- [ ] `stats/activity/aggregate-by-period` — pre-aggregated activity by period, cheaper than deriving from raw calls (medium)
- [ ] `coaching` — coaching metrics per manager/rep (medium)
- [ ] `logs` — audit log of access and data events, used for security and usage reporting (medium)
-- [ ] `library/folders + library/folder-content` — curated call collections and their membership (medium)
-- [ ] `flows + flows/prospects` — Gong Engage sequences and prospect assignments for outbound analysis (medium)
+- [x] `library/folders + library/folder-content` — curated call collections and their membership (medium)
+- [x] `flows + flows/prospects` — Gong Engage sequences and prospect assignments for outbound analysis (medium). `flows` only: `POST /v2/flows/prospects` looks up the flows of CRM prospect ids the caller already has, with no way to list them
- [ ] `users/{id}/settings-history` — state-transition history of user recording settings, explains gaps in call coverage (low)
Note: Gong's OpenAPI at https://api.gong.io/v2/api-docs is auth-gated (401), and the settings/api/documentation UI requires login. The resource list above was read from Gong's own docs index at help.gong.io/llms.txt, which enumerates every API-reference page with its /v2 path.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py
index 5d5eb4e6f370..ee09e91eaebb 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py
@@ -153,6 +153,76 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"personInteractionStats": "The stats for that day, each with a `name` and a numeric `value`.",
},
},
+ "daily_activity": {
+ "description": "Activity of one Gong user over one day, as lists of the ids of the calls the user acted on. Only users with activity in the synced range appear.",
+ "docs_url": "https://help.gong.io/apidocs/retrieve-daily-activity-for-applicable-users-for-a-date-range-v2statsactivityday-by-day",
+ "columns": {
+ "userId": "Identifier of the user. Joins to `users.id`.",
+ "userEmailAddress": "Email address of the user.",
+ "fromDate": "Start of the day the activity covers, in the company's time zone in Gong.",
+ "toDate": "End of the day the activity covers, in the company's time zone in Gong.",
+ "callsAsHost": "Ids of the calls the user hosted.",
+ "callsAttended": "Ids of the calls the user attended as a participant, not as the host.",
+ "callsGaveFeedback": "Ids of the calls the user gave feedback on.",
+ "callsRequestedFeedback": "Ids of the calls the user requested feedback on.",
+ "callsReceivedFeedback": "Ids of the calls the user received feedback on.",
+ "callsMarkedAsFeedbackGiven": "Ids of the calls the user marked as reviewed.",
+ "callsMarkedAsFeedbackReceived": "Ids of the user's calls that someone else marked as reviewed.",
+ "ownCallsListenedTo": "Ids of the user's own calls that the user listened to.",
+ "othersCallsListenedTo": "Ids of other users' calls that the user listened to.",
+ "callsSharedInternally": "Ids of the calls the user shared with people inside the company.",
+ "callsSharedExternally": "Ids of the calls the user shared with people outside the company.",
+ "callsCommentsGiven": "Ids of the calls on which the user gave at least one comment.",
+ "callsCommentsReceived": "Ids of the user's calls on which the user received at least one comment.",
+ "callsScorecardsFilled": "Ids of the calls for which the user filled in a scorecard.",
+ "callsScorecardsReceived": "Ids of the user's calls for which someone else filled in a scorecard.",
+ },
+ },
+ "call_outcomes": {
+ "description": "A call outcome value defined for the company in Gong, used to categorize the result of a call.",
+ "docs_url": "https://help.gong.io/apidocs/list-call-outcomes-v2call-outcomes-1",
+ "columns": {
+ "callOutcome": "The call outcome, for example Connected or No Answer.",
+ },
+ },
+ "library_folders": {
+ "description": "A public folder in the Gong call library. Private and archived folders are not included.",
+ "docs_url": "https://help.gong.io/apidocs/retrieve-library-folders-v2libraryfolders",
+ "columns": {
+ "id": "Unique identifier for the folder.",
+ "name": "Display name of the folder.",
+ "parentFolderId": "Identifier of the parent folder. Null for a root folder.",
+ "createdBy": "Identifier of the user who added the folder. Joins to `users.id`.",
+ "updated": "Time the folder was last updated.",
+ },
+ },
+ "library_folder_calls": {
+ "description": "A call, or a snippet of a call, in a public Gong call library folder.",
+ "docs_url": "https://help.gong.io/apidocs/list-of-calls-in-a-specific-folder-v2libraryfolder-content-2",
+ "columns": {
+ "folderId": "Identifier of the folder. Joins to `library_folders.id`.",
+ "id": "Identifier of the call. Joins to `calls.id`.",
+ "title": "Title of the call.",
+ "note": "Optional note attached to the call in the folder.",
+ "addedBy": "Identifier of the user who added the call to the folder. Joins to `users.id`.",
+ "created": "Time the call was added to the folder.",
+ "url": "URL of the call in Gong.",
+ "snippet": "For a snippet, its start (`fromSec`) and end (`toSec`) in seconds from the start of the call.",
+ },
+ },
+ "flows": {
+ "description": "A Gong Engage flow, a sequence of outreach steps that prospects are assigned to.",
+ "docs_url": "https://help.gong.io/apidocs/list-gong-engage-flows-v2flows-1",
+ "columns": {
+ "id": "Unique identifier for the flow.",
+ "name": "Name of the flow.",
+ "folderId": "Identifier of the folder the flow is in.",
+ "folderName": "Name of the folder the flow is in.",
+ "visibility": "Who can see the flow: Company, Personal, or Shared.",
+ "creationDate": "Time the flow was created.",
+ "exclusive": "When true, a prospect in this flow cannot be added to other flows.",
+ },
+ },
"workspaces": {
"description": "A Gong workspace grouping users, calls, and settings.",
"docs_url": "https://gong.app.gong.io/settings/api/documentation#get-/v2/workspaces",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py
index 246882035ea7..7cff9455a222 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py
@@ -182,8 +182,13 @@ def get_rows(
if response.status_code == 429 or response.status_code >= 500:
raise GongRetryableError(f"Gong API error (retryable): status={response.status_code}, url={url}")
- # Treat an empty date window as an empty page so the sync skips it instead of failing.
- if config.uses_date_window and response.status_code == 404 and _EMPTY_WINDOW_404.search(response.text.lower()):
+ # Treat an empty date window, or a parent with nothing in it, as an empty page so the sync
+ # skips it instead of failing.
+ if (
+ (config.uses_date_window or config.not_found_is_empty)
+ and response.status_code == 404
+ and _EMPTY_WINDOW_404.search(response.text.lower())
+ ):
return {}
if not response.ok:
@@ -201,11 +206,15 @@ def get_rows(
should_use_incremental_field,
db_incremental_field_last_value,
)
+ elif config.fan_out_parent and config.fan_out_param:
+ yield from _iter_fan_out_rows(config, config.fan_out_parent, config.fan_out_param, fetch_page)
else:
yield from _iter_cursor_rows(config, fetch_page)
-def _iter_cursor_rows(config: GongEndpointConfig, fetch_page) -> Iterator[Any]:
+def _iter_cursor_rows(
+ config: GongEndpointConfig, fetch_page, base_params: Optional[dict[str, Any]] = None
+) -> Iterator[Any]:
"""Cursor-paginate a list endpoint until ``records.cursor`` is absent.
Endpoints with no pagination (e.g. workspaces) return no cursor, so the loop exits after
@@ -213,7 +222,9 @@ def _iter_cursor_rows(config: GongEndpointConfig, fetch_page) -> Iterator[Any]:
"""
cursor: str | None = None
while True:
- params: dict[str, Any] = {"cursor": cursor} if cursor else {}
+ params: dict[str, Any] = dict(base_params or {})
+ if cursor:
+ params["cursor"] = cursor
data = fetch_page(_build_url(config.path, params))
rows = data.get(config.response_key, [])
@@ -225,6 +236,49 @@ def _iter_cursor_rows(config: GongEndpointConfig, fetch_page) -> Iterator[Any]:
break
+def _iter_fan_out_rows(config: GongEndpointConfig, parent_name: str, param: str, fetch_page) -> Iterator[Any]:
+ """Request the endpoint once per row of its parent endpoint.
+
+ Rows that repeat across parents, such as the company flows Gong returns for every owner, are
+ kept once by primary key. The set holds one key per distinct row, so it stays small.
+ """
+ parent_config = GONG_ENDPOINTS[parent_name]
+ primary_key = config.primary_key if isinstance(config.primary_key, tuple) else (config.primary_key,)
+ seen: set[tuple[Any, ...]] = set()
+
+ for parents in _iter_cursor_rows(parent_config, fetch_page):
+ for parent in parents:
+ if config.fan_out_parent_filter and not parent.get(config.fan_out_parent_filter):
+ continue
+ parent_value = parent.get(config.fan_out_parent_field)
+ if not parent_value:
+ continue
+
+ for rows in _iter_cursor_rows(config, fetch_page, {param: parent_value}):
+ if config.fan_out_column:
+ rows = [{**row, config.fan_out_column: parent_value} for row in rows]
+ if config.dedupe_fan_out_rows:
+ unseen = []
+ for row in rows:
+ key = tuple(row.get(column) for column in primary_key)
+ if key not in seen:
+ seen.add(key)
+ unseen.append(row)
+ rows = unseen
+ if rows:
+ yield rows
+
+
+def _flatten_nested_rows(records: list[dict[str, Any]], nested_rows_key: str) -> list[dict[str, Any]]:
+ """Turn each item of every record's nested list into a row carrying the record's other fields."""
+ rows: list[dict[str, Any]] = []
+ for record in records:
+ parent_fields = {key: value for key, value in record.items() if key != nested_rows_key}
+ for item in record.get(nested_rows_key) or []:
+ rows.append({**parent_fields, **item})
+ return rows
+
+
def _iter_windowed_rows(
config: GongEndpointConfig,
fetch_page,
@@ -331,6 +385,8 @@ def _iter_date_filtered_rows(
data = fetch_page(_build_url(config.path, {}), json_body=body)
rows = data.get(config.response_key, [])
+ if config.nested_rows_key:
+ rows = _flatten_nested_rows(rows, config.nested_rows_key)
if config.window_date_column:
rows = [{**row, config.window_date_column: from_date} for row in rows]
if rows:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py
index 4adb93c3753e..349f32a3699d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py
@@ -49,6 +49,23 @@ class GongEndpointConfig:
window_days: Optional[int] = None
# Column that receives the window's start date, for endpoints whose rows carry no date of their own.
window_date_column: Optional[str] = None
+ # Key of the list nested in each record that holds the actual rows, for endpoints that return one
+ # record per user with that user's days inside it. Each nested item becomes a row that also carries
+ # the record's other fields.
+ nested_rows_key: Optional[str] = None
+ # Endpoint whose rows drive one request each, for endpoints that list what belongs to one parent.
+ fan_out_parent: Optional[str] = None
+ # Field of each parent row that is sent as the `fan_out_param` query parameter.
+ fan_out_parent_field: str = "id"
+ fan_out_param: Optional[str] = None
+ # Parent field that must be truthy for the parent to drive a request, e.g. `active` on users.
+ fan_out_parent_filter: Optional[str] = None
+ # Column that receives the parent field on each row, for rows that do not name their parent.
+ fan_out_column: Optional[str] = None
+ # Whether the same row comes back for many parents and is kept only once per sync.
+ dedupe_fan_out_rows: bool = False
+ # Whether a 404 such as "No folders found" means there is nothing to sync rather than an error.
+ not_found_is_empty: bool = False
# Whether responses from this endpoint may be sampled into HTTP troubleshooting storage.
# Disabled for endpoints whose bodies carry participant names, free-form CRM field values, or
# verbatim conversation text that the name-based scrubbers can't recognise; requests stay
@@ -257,6 +274,78 @@ GONG_ENDPOINTS: dict[str, GongEndpointConfig] = {
},
],
),
+ # Per-user activity for each day: the ids of the calls the user hosted, attended, listened to,
+ # shared, commented on, gave feedback on, and scored. Gong returns one record per user with the
+ # days nested inside, and only for users with activity in the range.
+ # Requires the `api:stats:user-actions:detailed` scope.
+ "daily_activity": GongEndpointConfig(
+ name="daily_activity",
+ path="/v2/stats/activity/day-by-day",
+ response_key="usersDetailedActivities",
+ nested_rows_key="userDailyActivityStats",
+ primary_key=("userId", "fromDate"),
+ partition_key="fromDate",
+ supports_incremental=True,
+ uses_date_window=True,
+ date_filter_keys=("fromDate", "toDate"),
+ # A day's activity can still change after the day ends, as Gong finishes processing its calls.
+ default_incremental_lookback_seconds=7 * 24 * 60 * 60,
+ incremental_fields=[
+ {
+ "label": "fromDate",
+ "type": IncrementalFieldType.DateTime,
+ "field": "fromDate",
+ "field_type": IncrementalFieldType.DateTime,
+ },
+ ],
+ ),
+ # The call outcome values (e.g. "Connected", "No Answer") defined for the company.
+ # Requires the `api:call-outcomes:read` scope.
+ "call_outcomes": GongEndpointConfig(
+ name="call_outcomes",
+ path="/v2/call-outcomes",
+ response_key="outcomes",
+ primary_key="callOutcome",
+ ),
+ # Public call library folders. Gong does not return private or archived folders.
+ # Requires the `api:library:read` scope.
+ "library_folders": GongEndpointConfig(
+ name="library_folders",
+ path="/v2/library/folders",
+ response_key="folders",
+ primary_key="id",
+ not_found_is_empty=True,
+ ),
+ # The calls and call snippets in each public library folder, requested one folder at a time.
+ # The same call can sit in a folder more than once as different snippets, so the time it was
+ # added is part of the key. Notes are free text that the sample scrubbers can't recognise.
+ # Requires the `api:library:read` scope.
+ "library_folder_calls": GongEndpointConfig(
+ name="library_folder_calls",
+ path="/v2/library/folder-content",
+ response_key="calls",
+ primary_key=("folderId", "id", "created"),
+ partition_key="created",
+ fan_out_parent="library_folders",
+ fan_out_param="folderId",
+ fan_out_column="folderId",
+ not_found_is_empty=True,
+ capture_http_samples=False,
+ ),
+ # Gong Engage flows. Gong lists company flows plus the personal and shared flows of one owner per
+ # request, so every active user is asked for in turn and each flow is kept once.
+ # Requires the `api:flows:read` scope.
+ "flows": GongEndpointConfig(
+ name="flows",
+ path="/v2/flows",
+ response_key="flows",
+ primary_key="id",
+ fan_out_parent="users",
+ fan_out_parent_field="emailAddress",
+ fan_out_param="flowOwnerEmail",
+ fan_out_parent_filter="active",
+ dedupe_fan_out_rows=True,
+ ),
"workspaces": GongEndpointConfig(
name="workspaces",
path="/v2/workspaces",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py
index 14f6ef2ad0ee..7ba24b79c04e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py
@@ -64,6 +64,10 @@ To also sync these tables, additionally grant the scope listed next to each:
- `trackers` (keyword tracker definitions): `api:settings:trackers:read`
- `answered_scorecards` (scorecard reviews of calls): `api:stats:scorecards`
- `interaction_stats` (daily talk ratio, patience, and other conversation metrics per user): `api:stats:interaction`
+- `daily_activity` (calls each user hosted, attended, listened to, shared, and gave feedback on, per day): `api:stats:user-actions:detailed`
+- `call_outcomes` (the call outcome values defined for your company): `api:call-outcomes:read`
+- `library_folders` and `library_folder_calls` (public call library folders and the calls in them): `api:library:read`
+- `flows` (Gong Engage flows): `api:flows:read`
""",
iconPath="/static/services/gong.png",
docsUrl="https://posthog.com/docs/cdp/sources/gong",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py
index 5e5e8ebdd760..09a327db6686 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py
@@ -336,6 +336,10 @@ class TestGongSource:
("answered_scorecards", ["answeredScorecardId"], "callStartTime", "asc"),
# A user's stats are one row per day, so the user id alone would merge every day into one.
("interaction_stats", ["userId", "day"], "day", "asc"),
+ ("daily_activity", ["userId", "fromDate"], "fromDate", "asc"),
+ # A folder can hold the same call more than once, as different snippets.
+ ("library_folder_calls", ["folderId", "id", "created"], "created", "asc"),
+ ("flows", ["id"], None, "asc"),
("workspaces", ["id"], None, "asc"),
]
)
@@ -365,6 +369,11 @@ class TestGongSource:
"trackers",
"answered_scorecards",
"interaction_stats",
+ "daily_activity",
+ "call_outcomes",
+ "library_folders",
+ "library_folder_calls",
+ "flows",
"workspaces",
}
@@ -731,3 +740,118 @@ class TestDateFilteredStats:
list(rows)
assert len(session.requested_urls) == 2
+
+ @time_machine.travel("2026-03-10T15:00:00Z", tick=False)
+ def test_daily_activity_turns_each_users_days_into_rows(self) -> None:
+ session = _FakeSession(
+ [
+ _FakeResponse(
+ json_data={
+ "usersDetailedActivities": [
+ {
+ "userId": "u1",
+ "userEmailAddress": "[email protected]",
+ "userDailyActivityStats": [
+ {"fromDate": "2026-03-07T00:00:00-08:00", "callsAsHost": ["c1"]},
+ {"fromDate": "2026-03-08T00:00:00-08:00", "callsAsHost": []},
+ ],
+ },
+ {"userId": "u2", "userEmailAddress": "[email protected]", "userDailyActivityStats": None},
+ ]
+ }
+ ),
+ ]
+ )
+
+ with mock.patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.gong.gong.make_tracked_session",
+ return_value=session,
+ ):
+ batches = list(
+ get_rows(
+ "key",
+ "secret",
+ "daily_activity",
+ mock.MagicMock(),
+ _FakeResumableManager(),
+ should_use_incremental_field=True,
+ db_incremental_field_last_value="2026-03-07T08:00:00Z",
+ )
+ )
+
+ assert session.posted_bodies == [{"filter": {"fromDate": "2026-03-06", "toDate": "2026-03-09"}}]
+ assert batches == [
+ [
+ {
+ "userId": "u1",
+ "userEmailAddress": "[email protected]",
+ "fromDate": "2026-03-07T00:00:00-08:00",
+ "callsAsHost": ["c1"],
+ },
+ {
+ "userId": "u1",
+ "userEmailAddress": "[email protected]",
+ "fromDate": "2026-03-08T00:00:00-08:00",
+ "callsAsHost": [],
+ },
+ ]
+ ]
+
+
+class TestFanOut:
+ def test_library_folder_calls_are_stamped_with_their_folder_and_an_emptied_folder_is_skipped(self) -> None:
+ session = _FakeSession(
+ [
+ _FakeResponse(json_data={"folders": [{"id": "f1"}, {"id": "f2"}]}),
+ _FakeResponse(status_code=404, text='{"errors":["No folders found for the specified period"]}'),
+ _FakeResponse(json_data={"id": "f2", "calls": [{"id": "c1", "created": "2026-01-01T00:00:00Z"}]}),
+ ]
+ )
+
+ with mock.patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.gong.gong.make_tracked_session",
+ return_value=session,
+ ):
+ batches = list(get_rows("key", "secret", "library_folder_calls", mock.MagicMock(), _FakeResumableManager()))
+
+ assert session.requested_urls == [
+ f"{GONG_BASE_URL}/v2/library/folders",
+ f"{GONG_BASE_URL}/v2/library/folder-content?folderId=f1",
+ f"{GONG_BASE_URL}/v2/library/folder-content?folderId=f2",
+ ]
+ assert batches == [[{"id": "c1", "created": "2026-01-01T00:00:00Z", "folderId": "f2"}]]
+
+ def test_flows_are_listed_per_active_user_and_kept_once(self) -> None:
+ company_flow = {"id": "company", "visibility": "Company"}
+ session = _FakeSession(
+ [
+ _FakeResponse(
+ json_data={
+ "users": [
+ {"id": "u1", "emailAddress": "[email protected]", "active": True},
+ {"id": "u2", "emailAddress": "[email protected]", "active": False},
+ ],
+ "records": {"cursor": "users2"},
+ }
+ ),
+ _FakeResponse(json_data={"flows": [company_flow, {"id": "mine", "visibility": "Personal"}]}),
+ _FakeResponse(json_data={"users": [{"id": "u3", "emailAddress": "[email protected]", "active": True}]}),
+ _FakeResponse(json_data={"flows": [company_flow], "records": {"cursor": "flows2"}}),
+ _FakeResponse(json_data={"flows": [{"id": "shared", "visibility": "Shared"}]}),
+ ]
+ )
+
+ with mock.patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.gong.gong.make_tracked_session",
+ return_value=session,
+ ):
+ batches = list(get_rows("key", "secret", "flows", mock.MagicMock(), _FakeResumableManager()))
+
+ assert [unquote(url) for url in session.requested_urls] == [
+ f"{GONG_BASE_URL}/v2/users",
+ f"{GONG_BASE_URL}/v2/[email protected]",
+ f"{GONG_BASE_URL}/v2/users?cursor=users2",
+ f"{GONG_BASE_URL}/v2/[email protected]",
+ f"{GONG_BASE_URL}/v2/[email protected]&cursor=flows2",
+ ]
+ assert [row["id"] for batch in batches for row in batch] == ["company", "mine", "shared"]
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py
index a79d76277a65..0a4d4ec1f7b3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py
@@ -27,6 +27,7 @@ class TestGongSource:
("transcripts", "started"),
("answered_scorecards", "reviewTime"),
("interaction_stats", "day"),
+ ("daily_activity", "fromDate"),
):
assert schemas[name].supports_incremental is True
assert schemas[name].supports_append is True
@@ -36,7 +37,16 @@ class TestGongSource:
# rather than leaving a call that had no transcript yet stranded below the watermark.
assert schemas["transcripts"].default_incremental_lookback_seconds == 7 * 24 * 60 * 60
- for name in ("users", "scorecards", "trackers", "workspaces"):
+ for name in (
+ "users",
+ "scorecards",
+ "trackers",
+ "call_outcomes",
+ "library_folders",
+ "library_folder_calls",
+ "flows",
+ "workspaces",
+ ):
assert schemas[name].supports_incremental is False
assert schemas[name].supports_append is False