: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(featurebase): sync the support conversations, tickets and lookup tables (#107403)
Tom Owersc54dafffcdee
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.mdindex 900f78046488..53b978b28dce 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@@ -3033,14 +3033,15 @@ Note: Coverage is service configuration objects plus the account/billing family;## Featurebase — **thin**-Today (10): `admins`, `boards`, `changelogs`, `comments`, `companies`, `contacts`, `custom_fields`, `post_statuses`, `post_voters`, `posts`+Today (14): `admins`, `boards`, `changelogs`, `comments`, `companies`, `contacts`, `conversation_tags`, `conversations`, `custom_fields`, `post_statuses`, `post_voters`, `posts`, `ticket_statuses`, `tickets`Diffed against: <https://developers.featurebase.app/llms.txt>-- [ ] `support/conversations (list, search)` — the entire support inbox - conversation volume, first response and resolution analysis (high)-- [ ] `support/tickets (list)` — ticket workload and lifecycle, the other half of the support product (high)-- [ ] `support/tickets/statuses` — lookup table resolving the status id on every ticket (high)-- [ ] `support/conversation_tags (list)` — lookup table for tags applied to conversations - the main support breakdown dimension (high)+- [x] `support/conversations (list)` — the entire support inbox - conversation volume, first response and resolution analysis (high)+- [ ] `support/conversations (search)` — a POST query endpoint over the collection `conversations` already syncs, returning a slimmer inbox row; declined as a separate table (high)+- [x] `support/tickets (list)` — ticket workload and lifecycle, the other half of the support product (high)+- [x] `support/tickets/statuses` — lookup table resolving the status id on every ticket (high)+- [x] `support/conversation_tags (list)` — lookup table for tags applied to conversations - the main support breakdown dimension (high)- [ ] `surveys and surveys/list_responses` — survey responses are raw analytical rows (NPS/CSAT style) with no equivalent in the synced tables (high)- [ ] `support/tickets/categories` — lookup resolving ticket category ids (medium)- [ ] `help_center/articles (list)` — article inventory for content and deflection analysis (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.pyindex 0b21f14900ae..5498895e37b4 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py@@ -165,6 +165,83 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"locale": "Contact locale.",},},+ "conversations": {+ "description": "Support inbox conversations, one row per conversation thread, with state, assignment, tags, participants and activity timestamps.",+ "docs_url": "https://developers.featurebase.app/api/resources/support/subresources/conversations/methods/list/",+ "columns": {+ "id": "Unique conversation identifier.",+ "title": "Conversation title.",+ "state": "Current state of the conversation: open, closed, or snoozed.",+ "priority": "Whether the conversation is marked as priority.",+ "prioritySetAt": "ISO 8601 timestamp when priority was set.",+ "adminAssigneeId": "ID of the assigned admin, null if unassigned.",+ "teamAssigneeId": "ID of the assigned team, null if unassigned.",+ "brandId": "ID of the brand this conversation belongs to.",+ "tags": "Tags currently applied anywhere in the conversation.",+ "participants": "Participants in the conversation.",+ "source": "Information about the first message in the conversation.",+ "awaitingCustomerReply": "Whether the conversation is waiting on a customer reply.",+ "waitingSince": "ISO 8601 timestamp when the conversation started waiting.",+ "lastActivityAt": "ISO 8601 timestamp of the last activity.",+ "snoozedUntil": "ISO 8601 timestamp until which the conversation is snoozed.",+ "botConversationState": "State of AI agent handling: active, handed_off_to_human, or resolved.",+ "botConversationStateLastUpdatedAt": "ISO 8601 timestamp when the bot state last changed.",+ "csatSummary": "Derived CSAT summary when a rating request or rating exists.",+ "csatHistory": "Historical CSAT requests for this conversation, newest first.",+ "isBlocked": "Whether the user is blocked.",+ "customAttributes": "Custom conversation attribute values keyed by attribute ID.",+ "userPreferredLanguage": "The user's preferred language.",+ "hasAdminOverriddenLanguage": "Whether an admin manually overrode the detected language.",+ "readReceipts": "How far each participant has read in the conversation.",+ "createdAt": "ISO 8601 timestamp when the conversation was created.",+ "updatedAt": "ISO 8601 timestamp when the conversation was last updated.",+ },+ },+ "tickets": {+ "description": "Support tickets, one row per ticket, with status, category, assignment and links to the conversations they came from.",+ "docs_url": "https://developers.featurebase.app/api/resources/support/subresources/tickets/methods/list/",+ "columns": {+ "id": "Unique identifier of the ticket.",+ "ticketNumber": "Sequential display number of the ticket (e.g. 42 for TK-42).",+ "title": "Ticket title.",+ "content": "Ticket description in HTML format.",+ "open": "Whether the ticket is open.",+ "status": "Current ticket status (id, name, color, type).",+ "ticketCategoryId": "ID of the ticket category.",+ "categoryType": "Category type of the ticket: customer, tracker, or back-office.",+ "assigneeId": "ID of the admin assigned to the ticket.",+ "teamAssigneeId": "ID of the team assigned to the ticket, taken from the linked conversation.",+ "author": "The contact who created the ticket (id, name, email, type).",+ "companyId": "ID of the company associated with the ticket.",+ "linkedConversations": "Conversations linked to this ticket, with the role of each link.",+ "customFields": "Custom field values keyed by field ID.",+ "integrations": "Third-party issue links (GitHub, Jira, Linear, ClickUp, HubSpot, Azure DevOps).",+ "snoozedUntil": "ISO 8601 timestamp until which the ticket is snoozed, taken from the linked conversation.",+ "ticketUrl": "Full URL to view the ticket.",+ "createdAt": "ISO 8601 timestamp when the ticket was created.",+ "updatedAt": "ISO 8601 timestamp when the ticket was last updated.",+ },+ },+ "ticket_statuses": {+ "description": "Workflow statuses tickets move through, resolving the status ID carried on every ticket.",+ "docs_url": "https://developers.featurebase.app/api/resources/support/subresources/tickets/subresources/statuses/methods/list/",+ "columns": {+ "id": "Unique identifier of the status.",+ "name": "Display name of the status.",+ "color": "Color used for UI display.",+ "type": "Workflow stage this status represents: reviewing, unstarted, active, completed, or canceled.",+ "isDefault": "Whether this is the default status for new tickets.",+ },+ },+ "conversation_tags": {+ "description": "The workspace tag catalog, resolving the tag IDs applied to conversations.",+ "docs_url": "https://developers.featurebase.app/api/resources/support/subresources/conversation_tags/methods/list/",+ "columns": {+ "id": "Unique identifier of the tag.",+ "name": "Current tag name.",+ "type": "Object type identifier for a tag.",+ },+ },"post_voters": {"description": "One row per (post, voter): the users who upvoted each post, in the standard contact format.","docs_url": "https://developers.featurebase.app/api/resources/feedback/subresources/posts/subresources/voters/methods/list/",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.pyindex 93b7ee2f5ccc..96eea08fef5c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py@@ -26,7 +26,7 @@ FEATUREBASE_OBJECT_TYPE_TO_TOPICS: dict[str, tuple[str, ...]] = {}-@dataclass+@dataclass(frozen=True)class FeaturebaseEndpointConfig:name: strpath: str # Relative to FEATUREBASE_BASE_URL; may carry a {post_id} placeholder for fan-out@@ -48,8 +48,8 @@ class FeaturebaseEndpointConfig:full_refresh_params: dict[str, str] = field(default_factory=dict)# Extra query params merged into every request (e.g. privacy=all).extra_params: dict[str, str] = field(default_factory=dict)- # Whether the endpoint paginates with limit/cursor. Boards and post statuses return- # everything in one response (boards as a bare JSON array, no `data` envelope).+ # Whether the endpoint paginates with limit/cursor. Boards, post statuses and ticket+ # statuses return everything in one response (a bare JSON array, no `data` envelope).paginated: bool = Truepartition_key: Optional[str] = None # Stable creation-time field, never updatedAtprimary_keys: list[str] = field(default_factory=lambda: ["id"])@@ -151,6 +151,38 @@ FEATUREBASE_ENDPOINTS: dict[str, FeaturebaseEndpointConfig] = {# that can author posts and comments.extra_params={"contactType": "all"},),+ "conversations": FeaturebaseEndpointConfig(+ name="conversations",+ path="/conversations",+ partition_key="createdAt",+ # The list endpoint takes only limit/cursor/tagIds — no sort and no timestamp filter —+ # so neither incremental mode applies. The search endpoint can filter on createdAt but+ # returns a slimmer row, which would make the table's columns depend on the sync mode.+ ),+ "tickets": FeaturebaseEndpointConfig(+ name="tickets",+ path="/tickets",+ partition_key="createdAt",+ incremental_mode="desc_cutoff",+ # Only `recent` is documented against a timestamp we sync ("most recently updated",+ # same meaning as on posts). The `date` sort exists too, but which column it orders by+ # is undocumented, and a cutoff sweep on the wrong column silently skips rows.+ incremental_params_for_field={"updatedAt": {"sortBy": "recent", "sortOrder": "desc"}},+ # ticketNumber is the sequential display id, so ascending on it is a stable full-refresh+ # walk regardless of how rows are edited during the sync.+ full_refresh_params={"sortBy": "ticketNumber", "sortOrder": "asc"},+ incremental_fields=[_UPDATED_AT_FIELD],+ ),+ "ticket_statuses": FeaturebaseEndpointConfig(+ name="ticket_statuses",+ path="/tickets/statuses",+ # Documented as returning every status at once, as a bare JSON array like boards.+ paginated=False,+ ),+ "conversation_tags": FeaturebaseEndpointConfig(+ name="conversation_tags",+ path="/tags",+ ),# One request per post: materializes the post<->upvoter many-to-many as# {postId, ...contact} rows. Opt-in (off by default) because it costs one paginated# request chain per post. Voter ids are contact ids (unique per org, not per post),diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.pyindex f47d2c1547c0..c4ec2bc57f8b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py@@ -124,6 +124,34 @@ class TestBuildInitialParams:None,{},),+ (+ "tickets_incremental_updated_sweeps_recent_desc",+ "tickets",+ True,+ "updatedAt",+ {"limit": 100, "sortBy": "recent", "sortOrder": "desc"},+ ),+ (+ "tickets_full_refresh_walks_ticket_number_ascending",+ "tickets",+ False,+ None,+ {"limit": 100, "sortBy": "ticketNumber", "sortOrder": "asc"},+ ),+ (+ "conversations_have_no_sort_or_filter_param",+ "conversations",+ False,+ None,+ {"limit": 100},+ ),+ (+ "ticket_statuses_have_no_pagination_params",+ "ticket_statuses",+ False,+ None,+ {},+ ),])def test_build_initial_params(@@ -148,6 +176,14 @@ class TestBuildInitialParams:assert params["sortBy"] == "date"assert params["sortOrder"] == "asc"+ def test_every_advertised_incremental_field_has_sort_params(self) -> None:+ # A "desc_cutoff" sweep stops once a whole page predates the watermark, which is only+ # sound while the request sorts descending on that same field. An advertised field with+ # no entry here would be swept unsorted and silently drop rows.+ for name, config in FEATUREBASE_ENDPOINTS.items():+ for incremental_field in config.incremental_fields:+ assert incremental_field["field"] in config.incremental_params_for_field, name+def test_changelogs_first_incremental_sync_has_no_start_date(self) -> None:params = _build_initial_params(FEATUREBASE_ENDPOINTS["changelogs"],@@ -383,6 +419,8 @@ class TestSourceResponse:("posts_full_refresh", "posts", False, "asc"),("changelogs_incremental_stays_asc", "changelogs", True, "asc"),("boards_full_refresh", "boards", False, "asc"),+ ("tickets_incremental", "tickets", True, "desc"),+ ("tickets_full_refresh", "tickets", False, "asc"),])def test_sort_mode_matches_emit_order(self, _name: str, endpoint: str, incremental: bool, expected: str) -> None:@@ -393,6 +431,9 @@ class TestSourceResponse:("posts", ["id"], ["createdAt"]),("post_voters", ["postId", "id"], None),("contacts", ["id"], None),+ ("tickets", ["id"], ["createdAt"]),+ ("conversations", ["id"], ["createdAt"]),+ ("conversation_tags", ["id"], None),])def test_primary_and_partition_keys(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.pyindex c202ebc93ce5..b12fb13c7b1f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py@@ -75,6 +75,12 @@ class TestFeaturebaseSource:("admins", False, False),("companies", False, False),("contacts", False, False),+ # Conversations list takes no sort or timestamp param, so it is full refresh only;+ # tickets sweep newest-first on updatedAt.+ ("conversations", False, False),+ ("tickets", True, False),+ ("ticket_statuses", False, False),+ ("conversation_tags", False, False),("post_voters", False, False),])