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(customer-analytics): add support tickets tab to accounts (#74028)

Arthur Moreira de Deus7c4151edf11b
diff --git a/products/conversations/backend/facade/api.py b/products/conversations/backend/facade/api.py
index a1be2c0795db..f049848d30d6 100644
--- a/products/conversations/backend/facade/api.py
+++ b/products/conversations/backend/facade/api.py
@@ -8,12 +8,18 @@ team's Slack credentials directly.
from typing import Any
-from pydantic.dataclasses import dataclass
+from django.conf import settings
+from django.db.models import F
+
from slack_sdk.errors import SlackApiError
from posthog.models.comment import Comment
from posthog.models.team import Team
+from products.conversations.backend.facade.types import (
+ SupportChannel as SupportChannel,
+ TicketSummary as TicketSummary,
+)
from products.conversations.backend.models import Ticket
from products.conversations.backend.slack import get_slack_client
from products.conversations.backend.support_slack_channels import (
@@ -36,15 +42,6 @@ class SupportMessageSendError(Exception):
self.retry_after = retry_after
-@dataclass(frozen=True)
-class SupportChannel:
- """A Slack channel visible to the SupportHog bot."""
-
- id: str
- name: str
- is_member: bool
-
-
def list_support_bot_channels(team_id: int, *, members_only: bool = False) -> list[SupportChannel]:
"""Slack channels the SupportHog bot can see for this team, sorted by name.
@@ -138,3 +135,27 @@ def post_ticket_internal_note(team_id: int, ticket_id: str, content: str, *, ded
item_context={"author_type": "AI", "is_private": True, "internal_note_key": dedupe_key},
)
return str(comment.id)
+
+
+def list_account_tickets(team_id: int, organization_id: str, *, limit: int = 50) -> list[TicketSummary]:
+ """Support tickets whose resolved customer org matches ``organization_id``, newest activity first.
+
+ ``organization_id`` is the customer's group key (a customer-analytics account's
+ ``external_id``). An empty key matches nothing — never every ticket for the team.
+ """
+ if not organization_id:
+ return []
+ tickets = Ticket.objects.filter(team_id=team_id, organization_id=organization_id).order_by(
+ F("last_message_at").desc(nulls_last=True)
+ )[:limit]
+ return [
+ TicketSummary(
+ id=str(ticket.id),
+ ticket_number=ticket.ticket_number,
+ status=ticket.status,
+ last_message_at=ticket.last_message_at,
+ last_message_text=ticket.last_message_text,
+ deep_link=f"{settings.SITE_URL}/project/{team_id}/support/tickets/{ticket.ticket_number}",
+ )
+ for ticket in tickets
+ ]
diff --git a/products/conversations/backend/facade/types.py b/products/conversations/backend/facade/types.py
new file mode 100644
index 000000000000..387c9091dbe4
--- /dev/null
+++ b/products/conversations/backend/facade/types.py
@@ -0,0 +1,33 @@
+"""Contract types other products receive from the conversations facade.
+
+Frozen dataclasses only — no ORM objects or slack_sdk types cross the boundary.
+
+Named types.py, not the conventional contracts.py, because that filename is what
+`hogli product:lint` reads as "this product is isolated" and conversations isn't
+yet. Rename it once the product meets the strict structure rules.
+"""
+
+from datetime import datetime
+
+from pydantic.dataclasses import dataclass
+
+
+@dataclass(frozen=True)
+class SupportChannel:
+ """A Slack channel visible to the SupportHog bot."""
+
+ id: str
+ name: str
+ is_member: bool
+
+
+@dataclass(frozen=True)
+class TicketSummary:
+ """A support ticket, reduced to what an account's tickets list renders."""
+
+ id: str
+ ticket_number: int
+ status: str
+ last_message_at: datetime | None
+ last_message_text: str | None
+ deep_link: str
diff --git a/products/conversations/backend/tests/test_facade.py b/products/conversations/backend/tests/test_facade.py
index 274b06ab138b..9c8b896be8eb 100644
--- a/products/conversations/backend/tests/test_facade.py
+++ b/products/conversations/backend/tests/test_facade.py
@@ -1,10 +1,21 @@
+from datetime import timedelta
+
from posthog.test.base import BaseTest
from unittest.mock import MagicMock, patch
+from django.utils import timezone
+
from parameterized import parameterized
from slack_sdk.errors import SlackApiError
-from products.conversations.backend.facade.api import SupportMessageSendError, post_support_message
+from posthog.models import Team
+
+from products.conversations.backend.facade.api import (
+ SupportMessageSendError,
+ list_account_tickets,
+ post_support_message,
+)
+from products.conversations.backend.models.ticket import Ticket
CLIENT = "products.conversations.backend.facade.api.get_slack_client"
@@ -74,3 +85,42 @@ class TestPostSupportMessage(BaseTest):
post_support_message(self.team.pk, "C1", "hi")
assert ctx.exception.code == expected_code
assert ctx.exception.retry_after == expected_retry_after
+
+
+class TestListAccountTickets(BaseTest):
+ def _create_ticket(self, *, team: Team, organization_id: str | None, number: int, last_message_at=None) -> Ticket:
+ return Ticket.objects.create(
+ team=team,
+ ticket_number=number,
+ widget_session_id=f"s{number}",
+ distinct_id=f"d{number}",
+ organization_id=organization_id,
+ last_message_at=last_message_at,
+ )
+
+ def test_returns_only_tickets_for_this_team_and_org(self):
+ other_team = Team.objects.create(organization=self.organization)
+ mine = self._create_ticket(team=self.team, organization_id="acct-1", number=1)
+ self._create_ticket(team=self.team, organization_id="acct-2", number=2)
+ self._create_ticket(team=other_team, organization_id="acct-1", number=1)
+
+ result = list_account_tickets(self.team.pk, "acct-1")
+
+ assert [t.id for t in result] == [str(mine.id)]
+ assert result[0].deep_link.endswith(f"/project/{self.team.pk}/support/tickets/1")
+
+ def test_orders_by_last_message_activity_with_nulls_last(self):
+ older = timezone.now() - timedelta(hours=1)
+ newer = timezone.now()
+ self._create_ticket(team=self.team, organization_id="acct-1", number=1, last_message_at=older)
+ self._create_ticket(team=self.team, organization_id="acct-1", number=2, last_message_at=newer)
+ self._create_ticket(team=self.team, organization_id="acct-1", number=3, last_message_at=None)
+
+ result = list_account_tickets(self.team.pk, "acct-1")
+
+ assert [t.ticket_number for t in result] == [2, 1, 3]
+
+ def test_empty_organization_id_matches_nothing(self):
+ self._create_ticket(team=self.team, organization_id="acct-1", number=1)
+
+ assert list_account_tickets(self.team.pk, "") == []
diff --git a/products/customer_analytics/backend/COMPROMISES.md b/products/customer_analytics/backend/COMPROMISES.md
index 5267db81c9e6..ecdd3305c355 100644
--- a/products/customer_analytics/backend/COMPROMISES.md
+++ b/products/customer_analytics/backend/COMPROMISES.md
@@ -117,6 +117,16 @@ Cutover checklist — when done, the sync and this section are deleted:
- **No unset/delete emission.** No value-delete path exists; if one is added, its author decides
whether removal counts as a change.
+## Slack workspace URL is hardcoded
+
+- **`SLACK_ARCHIVES_ORIGIN` hardcodes PostHog's own workspace** — in `backend/constants.py` and
+ mirrored in `frontend/components/Accounts/accountLinksLogic.ts`. Every Slack link built from it
+ (Useful links sidebar, Slack summary message permalinks) is wrong for any team other than us.
+ Fine while the product is PostHog-internal; **must be fixed before GA**. The correct value is
+ per-team and owned by conversations: the bot's `auth.test` response carries the workspace `url`
+ (same call `get_bot_user_id_cached` already caches a field from), so the fix is a cached lookup
+ in conversations exposed through its facade, consumed here and by the frontend.
+
## Tech debt
- **Account property writes have no single choke point.** `Account._properties` is mutated from four
diff --git a/products/customer_analytics/backend/constants.py b/products/customer_analytics/backend/constants.py
index 0643f420c32a..3c40e326206c 100644
--- a/products/customer_analytics/backend/constants.py
+++ b/products/customer_analytics/backend/constants.py
@@ -1,5 +1,10 @@
DEFAULT_ACTIVITY_EVENT = {"kind": "EventsNode", "event": "$pageview", "name": "$pageview"}
+# Mirrors frontend `SLACK_ARCHIVES_ORIGIN` in accountLinksLogic.ts. PostHog-internal: hardcodes our
+# own workspace, so Slack links are wrong for any other team. Replace with the per-team workspace
+# URL (from the conversations bot's auth.test) before GA — see COMPROMISES.md.
+SLACK_ARCHIVES_ORIGIN = "https://posthog.slack.com/archives"
+
# Mirrors frontend `FEATURE_FLAGS.CUSTOMER_ANALYTICS_CSP`.
CUSTOMER_ANALYTICS_CSP_FLAG = "customer-analytics-csp"
diff --git a/products/customer_analytics/backend/facade/api.py b/products/customer_analytics/backend/facade/api.py
index 323bfd9b9785..60960c37653b 100644
--- a/products/customer_analytics/backend/facade/api.py
+++ b/products/customer_analytics/backend/facade/api.py
@@ -38,7 +38,12 @@ from posthog.models.tag import tagify
from posthog.models.tagged_item import TaggedItem
from posthog.models.team import Team
-from products.conversations.backend.facade.api import SupportSlackChannelsUnavailable, SupportSlackNotConfigured
+from products.conversations.backend.facade.api import (
+ SupportSlackChannelsUnavailable,
+ SupportSlackNotConfigured,
+ TicketSummary as TicketSummary,
+ list_account_tickets,
+)
from products.customer_analytics.backend.account_urls import build_account_deeplink as build_account_deeplink
from products.customer_analytics.backend.constants import ACCOUNT_ASSIGNMENT_ROLE_FIELDS
from products.customer_analytics.backend.events import emit_account_tags_added
@@ -2252,6 +2257,30 @@ def get_accessible_account_id(team_id: int, account_id: str, user_access_control
return str(account.id) if account is not None else None
+def get_account_support_tickets(
+ team_id: int,
+ account_id: str,
+ user_access_control: "UserAccessControl",
+ *,
+ limit: int = 50,
+) -> list[TicketSummary] | None:
+ """Support tickets (from the conversations product) for an accessible account, newest activity
+ first. None when the parent account isn't accessible (→ 404); an empty list when the account
+ has no linked customer org key, or has one but no matching tickets.
+
+ Raises :class:`ResourceForbiddenError` (→ 403) when the caller can read the account but not
+ tickets — this endpoint is authorized as ``account`` while the payload is ticket content, so
+ the ``ticket`` resource has to be gated separately or this path bypasses its RBAC."""
+ if get_accessible_account_id(team_id, account_id, user_access_control) is None:
+ return None
+ if not user_access_control.check_access_level_for_resource("ticket", "viewer"):
+ raise ResourceForbiddenError()
+ account = _resolve_account(team_id, account_id=account_id)
+ if account is None or not account.external_id:
+ return []
+ return list_account_tickets(team_id, account.external_id, limit=limit)
+
+
def list_account_notebooks(
team_id: int,
account_id: str,
diff --git a/products/customer_analytics/backend/presentation/views/serializers.py b/products/customer_analytics/backend/presentation/views/serializers.py
index 57a639e0b6ff..2dfbc463cdc6 100644
--- a/products/customer_analytics/backend/presentation/views/serializers.py
+++ b/products/customer_analytics/backend/presentation/views/serializers.py
@@ -27,6 +27,7 @@ from rest_framework_dataclasses.serializers import DataclassSerializer
from posthog.api.shared import UserBasicSerializer
from posthog.models import OrganizationMembership
+from products.customer_analytics.backend.facade.api import TicketSummary
from products.customer_analytics.backend.facade.constants import (
CUSTOM_PROPERTY_DISPLAY_TYPE_CHOICES,
CUSTOM_PROPERTY_OPTION_COLORS,
@@ -294,6 +295,26 @@ class AccountNoteSerializer(DataclassSerializer):
fields = ["short_id", "title", "created_at", "last_modified_at", "account_id", "account_name", "created_by"]
+class SupportTicketSerializer(DataclassSerializer):
+ """A support ticket linked to an account, sourced from the conversations product (read-only)."""
+
+ id = serializers.CharField(read_only=True, help_text="UUID of the support ticket.")
+ ticket_number = serializers.IntegerField(read_only=True, help_text="Human-readable ticket number.")
+ status = serializers.CharField(read_only=True, help_text="Current status of the ticket (e.g. 'new', 'open').")
+ last_message_at = serializers.DateTimeField(
+ read_only=True, allow_null=True, help_text="When the most recent message was sent on this ticket."
+ )
+ last_message_text = serializers.CharField(
+ read_only=True, allow_null=True, help_text="Truncated preview of the most recent message."
+ )
+ deep_link = serializers.CharField(read_only=True, help_text="Absolute URL to open this ticket in the app.")
+
+ class Meta:
+ dataclass = TicketSummary
+ ref_name = "SupportTicket"
+ fields = ["id", "ticket_number", "status", "last_message_at", "last_message_text", "deep_link"]
+
+
class CustomPropertyReferenceSerializer(DataclassSerializer):
"""A place that uses a custom property definition (read-only)."""
diff --git a/products/customer_analytics/backend/presentation/views/views.py b/products/customer_analytics/backend/presentation/views/views.py
index ab550dcc0522..317e9000db6b 100644
--- a/products/customer_analytics/backend/presentation/views/views.py
+++ b/products/customer_analytics/backend/presentation/views/views.py
@@ -13,6 +13,7 @@ pydantic-error formatting, and activity logging live behind the facade.
from __future__ import annotations
import json
+import builtins
from dataclasses import asdict
from typing import Any, cast
from uuid import UUID
@@ -58,6 +59,7 @@ from products.customer_analytics.backend.presentation.views.serializers import (
EventStreamMemberWriteSerializer,
EventStreamSerializer,
EventStreamTestMessageSerializer,
+ SupportTicketSerializer,
)
from ee.hogai.tools.create_notebook.tiptap import markdown_to_tiptap_nodes
@@ -969,6 +971,33 @@ class AccountViewSet(
raise PermissionDenied()
return Response(AccountSerializer(instance=account).data)
+ @extend_schema(parameters=[_ACCOUNT_ID_PARAM], responses={200: SupportTicketSerializer(many=True)})
+ @action(methods=["GET"], detail=True, pagination_class=None)
+ def support_tickets(self, request: Request, *args, **kwargs) -> Response:
+ try:
+ tickets = api.get_account_support_tickets(
+ self.team_id,
+ self.kwargs["pk"],
+ user_access_control=self.user_access_control,
+ )
+ except api.ResourceForbiddenError:
+ raise PermissionDenied()
+ if tickets is None:
+ return Response({"detail": "Not found."}, status=status.HTTP_404_NOT_FOUND)
+ return Response(SupportTicketSerializer(instance=tickets, many=True).data)
+
+ def dangerously_get_required_scopes(self, request: Request, view) -> builtins.list[str] | None:
+ super_method = getattr(super(), "dangerously_get_required_scopes", None)
+ if callable(super_method):
+ mixin_result = super_method(request, view)
+ if mixin_result is not None:
+ return mixin_result
+ # Ticket content behind an account-scoped viewset — a token holding only
+ # account:read must not read it.
+ if view.action == "support_tickets":
+ return ["account:read", "ticket:read"]
+ return None
+
def create(self, request: Request, *args, **kwargs) -> Response:
serializer = AccountSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
diff --git a/products/customer_analytics/backend/test/test_views.py b/products/customer_analytics/backend/test/test_views.py
index b044cb93497d..b13df7ee89b1 100644
--- a/products/customer_analytics/backend/test/test_views.py
+++ b/products/customer_analytics/backend/test/test_views.py
@@ -20,6 +20,7 @@ from posthog.models.team import Team
from posthog.models.user import User
from posthog.models.utils import generate_random_token_personal, hash_key_value
+from products.conversations.backend.models.ticket import Ticket
from products.customer_analytics.backend.logic import relationships as relationships_logic
from products.customer_analytics.backend.models import (
Account,
@@ -2646,3 +2647,72 @@ class TestAccountRelationshipViewSet(APIBaseTest):
response = self.client.post(f"{self.endpoint}{rel.id}/end/")
self.assertEqual(status.HTTP_404_NOT_FOUND, response.status_code)
+
+
+class TestAccountSupportTicketViewSet(APIBaseTest):
+ def setUp(self):
+ super().setUp()
+ self.account = Account.objects.unscoped().create(team=self.team, name="Acme Corp", external_id="acme-1")
+ self.endpoint = f"/api/environments/{self.team.id}/accounts/{self.account.id}/support_tickets/"
+
+ def test_list_returns_tickets_for_the_accounts_org(self):
+ Ticket.objects.create(
+ team=self.team,
+ ticket_number=7,
+ widget_session_id="s7",
+ distinct_id="d7",
+ organization_id="acme-1",
+ status="open",
+ )
+ Ticket.objects.create(
+ team=self.team, ticket_number=8, widget_session_id="s8", distinct_id="d8", organization_id="other-org"
+ )
+
+ response = self.client.get(self.endpoint)
+
+ self.assertEqual(status.HTTP_200_OK, response.status_code, response.json())
+ data = response.json()
+ self.assertEqual([t["ticket_number"] for t in data], [7])
+ self.assertEqual(data[0]["status"], "open")
+ self.assertTrue(data[0]["deep_link"].endswith(f"/project/{self.team.id}/support/tickets/7"))
+
+ def test_list_is_empty_when_account_has_no_external_id(self):
+ unlinked = Account.objects.unscoped().create(team=self.team, name="Unlinked", external_id=None)
+
+ response = self.client.get(f"/api/environments/{self.team.id}/accounts/{unlinked.id}/support_tickets/")
+
+ self.assertEqual(status.HTTP_200_OK, response.status_code, response.json())
+ self.assertEqual(response.json(), [])
+
+ def test_account_viewer_denied_tickets_cannot_read_them(self):
+ Ticket.objects.create(
+ team=self.team,
+ ticket_number=9,
+ widget_session_id="s9",
+ distinct_id="d9",
+ organization_id="acme-1",
+ )
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL},
+ {"key": AvailableFeature.ROLE_BASED_ACCESS, "name": AvailableFeature.ROLE_BASED_ACCESS},
+ ]
+ self.organization.save()
+ viewer = User.objects.create_and_join(self.organization, "[email protected]", "testtest")
+ membership = OrganizationMembership.objects.get(user=viewer, organization=self.organization)
+ AccessControl.objects.create(
+ team=self.team,
+ resource="customer_analytics",
+ resource_id=None,
+ access_level="viewer",
+ organization_member=membership,
+ )
+ AccessControl.objects.create(
+ team=self.team,
+ resource="ticket",
+ resource_id=None,
+ access_level="none",
+ organization_member=membership,
+ )
+ self.client.force_login(viewer)
+
+ self.assertEqual(status.HTTP_403_FORBIDDEN, self.client.get(self.endpoint).status_code)
diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.md
index e5a2fd2fb8b5..44541bcd8c4e 100644
--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md
+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md
@@ -25,13 +25,14 @@ AccountsTabContent ── binds dataNodeLogic(ACCOUNTS_HOGQL_DATA_NODE_KEY, acc
│ AccountsOverviewTilesButton + AccountsColumnConfigurator on the right
├── AccountsOverviewTiles metric tiles across the filtered set
└── AccountsHogQLTable the DataTable; per-column renderers; controlled row expansion
- └── AccountNotebooksExpansion expanded row: sidebar (Useful links + active-relationships summary) + LemonTabs(Notes/Users/Relationships/Usage/Spend/Opportunities/Event stream)
+ └── AccountNotebooksExpansion expanded row: sidebar (Useful links + active-relationships summary) + LemonTabs(Notes/Users/Relationships/Usage/Spend/Opportunities/Support tickets/Event stream)
├── (notes) paginated/searchable/sortable LemonTable + "New note" button (accountNotebooksLogic, keyed by accountId)
├── (users) AccountRelatedUsersExpansion (accountRelatedUsersLogic, keyed by externalId)
├── (relationships) AccountRelationshipsExpansion (accountRelationshipsLogic, keyed by accountId — full assignment timeline, paginated; assign/end controls + definition filter, current assignments sorted on top)
├── (usage) AccountBillingExpansion kind="usage" (accountBillingLogic — a saved billing-usage insight)
├── (spend) AccountBillingExpansion kind="spend" (accountBillingLogic — saved billing-spend insights)
└── (opportunities) AccountOpportunitiesExpansion (accountOpportunitiesLogic, keyed by accountId — DWH Salesforce opportunities)
+ └── (support_tickets) AccountSupportTicketsExpansion (accountSupportTicketsLogic, keyed by accountId — conversations support tickets, via the accounts/:id/support_tickets endpoint)
└── (event_stream) AccountEventStreamToggle (`../EventStream/`) flag-gated tab (CUSTOMER_ANALYTICS_CSP); membership toggle for the Slack event stream
```
@@ -49,6 +50,7 @@ AccountsTabContent ── binds dataNodeLogic(ACCOUNTS_HOGQL_DATA_NODE_KEY, acc
| `accountRelationshipsLogic` | Relationship assignments for one account (keyed by `accountId`): fetches the full timeline once (`include_history=true` on the nested relationships endpoint) — the `displayedRelationships` selector (current assignments first, newest first, optionally narrowed by `definitionFilter`) feeds the (paginated) history tab, the `activeRelationships` selector feeds the sidebar summary. Also owns the tab's mutations: `assignRelationship` (definition picker + `MemberSelect`, POSTs the assign endpoint) and `endRelationship` (per active row, POSTs the end endpoint) — both guarded by a shared `relationshipSaving` flag, reload the timeline, and force-refresh the list's data nodes so relationship columns stay in sync. |
| `accountBillingLogic` | Billing data behind the Usage and Spend tabs (keyed by `accountId:kind`); injects the account's org + date range into saved billing insights' SQL variables, and owns the per-view hidden-series state (`ephemeralHiddenSeriesKeysByShortId`) behind the chart chips. |
| `accountOpportunitiesLogic` | Salesforce opportunities behind the Opportunities tab (keyed by `accountId`): fetches the account's `sfdc_id`, then queries the data-warehouse `salesforce.opportunity` table via HogQL. Degrades to an empty state (not an error) when the table is absent — it's production-only. |
+| `accountSupportTicketsLogic` | Conversations support tickets behind the Support tickets tab (keyed by `accountId`): fetches the account's tickets from the generated `accountsSupportTicketsList` endpoint (backed by the customer-analytics facade → conversations facade → `Ticket`s matched on `organization_id = external_id`). Distinguishes not-loaded / loaded-empty / load-failed; captures unexpected failures. |
| `accountLinksLogic` | The "Useful links" sidebar for one account (keyed by `accountId`). |
## Data & query model
@@ -81,9 +83,9 @@ Sort safety: removing the sorted column drops the sort (`clearSortIfColumnRemove
## The expanded row
-`AccountsHogQLTable.useExpandable()` makes expansion **controlled** by `accountsExpansionLogic`: `isRowExpanded` reads `expandedAccountIds`, `onRowExpand`/`onRowCollapse` dispatch `toggleAccountExpanded`. The body is `AccountNotebooksExpansion`, a `LemonTabs` over `notes` / `users` / `relationships` / `usage` / `spend` / `opportunities` / `event_stream` (`AccountExpansionTab`; the `event_stream` tab is gated by the `CUSTOMER_ANALYTICS_CSP` flag) plus the sidebar (Useful links + an active-relationships summary, `ActiveRelationships`, hidden when nothing is assigned). Active tab comes from `activeTabFor(accountId)` (defaults to `notes`).
+`AccountsHogQLTable.useExpandable()` makes expansion **controlled** by `accountsExpansionLogic`: `isRowExpanded` reads `expandedAccountIds`, `onRowExpand`/`onRowCollapse` dispatch `toggleAccountExpanded`. The body is `AccountNotebooksExpansion`, a `LemonTabs` over `notes` / `users` / `relationships` / `usage` / `spend` / `opportunities` / `support_tickets` / `event_stream` (`AccountExpansionTab`; the `event_stream` tab is gated by the `CUSTOMER_ANALYTICS_CSP` flag) plus the sidebar (Useful links + an active-relationships summary, `ActiveRelationships`, hidden when nothing is assigned). Active tab comes from `activeTabFor(accountId)` (defaults to `notes`).
-**Tab data is cached for the row's expanded lifetime, not refetched per tab switch.** `LemonTabs` only renders the active tab's content (keyed by `activeKey`), so a tab's logic would normally unmount the moment you switch away and refetch on return. To avoid that, `AccountNotebooksExpansion` holds a mount reference to each per-tab logic via `useMountedLogic` — `accountRelatedUsersLogic({ externalId })`, `accountRelationshipsLogic({ accountId })`, `accountBillingLogic` for both `kind: 'usage'` and `kind: 'spend'`, and `accountOpportunitiesLogic({ accountId })`. Since `AccountNotebooksExpansion` stays mounted for as long as the row is expanded (it's the `expandedRowRender` body), those keyed instances survive tab switches and only tear down when the row collapses. The `useMountedLogic` props must stay identical to the `useValues` props in the tab components (`AccountRelatedUsersExpansion`, `AccountRelationshipsExpansion`, `AccountBillingExpansion`, `AccountOpportunitiesExpansion`) so both resolve to the same keyed instance. `accountNotebooksLogic` and `accountLinksLogic` already mount at this level (Notes content and the always-rendered sidebar), so they need no explicit mount reference. Data is loaded once on mount and not auto-refreshed while the row stays open — acceptable since this data needn't be live.
+**Tab data is cached for the row's expanded lifetime, not refetched per tab switch.** `LemonTabs` only renders the active tab's content (keyed by `activeKey`), so a tab's logic would normally unmount the moment you switch away and refetch on return. To avoid that, `AccountNotebooksExpansion` holds a mount reference to each per-tab logic via `useMountedLogic` — `accountRelatedUsersLogic({ externalId })`, `accountRelationshipsLogic({ accountId })`, `accountBillingLogic` for both `kind: 'usage'` and `kind: 'spend'`, `accountOpportunitiesLogic({ accountId })`, and `accountSupportTicketsLogic({ accountId })`. Since `AccountNotebooksExpansion` stays mounted for as long as the row is expanded (it's the `expandedRowRender` body), those keyed instances survive tab switches and only tear down when the row collapses. The `useMountedLogic` props must stay identical to the `useValues` props in the tab components (`AccountRelatedUsersExpansion`, `AccountRelationshipsExpansion`, `AccountBillingExpansion`, `AccountOpportunitiesExpansion`, `AccountSupportTicketsExpansion`) so both resolve to the same keyed instance. `accountNotebooksLogic` and `accountLinksLogic` already mount at this level (Notes content and the always-rendered sidebar), so they need no explicit mount reference. Data is loaded once on mount and not auto-refreshed while the row stays open — acceptable since this data needn't be live.
The Users tab reads its loaded data straight off `accountRelatedUsersLogic`, so the root mount above keeps it cached. The **Usage/Spend** tabs are different: `accountBillingLogic` only holds the saved-insight _metadata_ — the actual insight **results** live in the `dataNodeLogic`/`dataVisualizationLogic` mounted inside the tab body, which the root mount does **not** keep alive. So the tab body attaches those data logics to the (root-mounted) `accountBillingLogic` via `useAttachedLogic` — `AccountBillingChart` does this for the chart it renders, and the fallback `<Query>` path does it via `attachTo={accountBillingLogic-instance}` — so they outlive the tab body unmounting on tab switch and only detach when the row collapses. Without that attachment, usage/spend refetch on every return to the tab even with the metadata logic mounted. (The Opportunities tab loads its data in `accountOpportunitiesLogic` directly, not via an embedded query, so the root `useMountedLogic` above is enough — it needs no attachment.)
@@ -93,6 +95,13 @@ The Usage and Spend tabs render existing saved billing insights — **point user
The Opportunities tab lists the account's Salesforce opportunities from the data-warehouse `salesforce.opportunity` table (joined by the account's `sfdc_id`). The query runs in `accountOpportunitiesLogic` rather than via a bare `<Query>` so the tab owns every state: a missing `sfdc_id` shows a "not linked to Salesforce" empty state, and because `salesforce.opportunity` is **access-gated and production-only**, a failed query degrades to a pretty hog empty state instead of a red error box. The expected denied/absent-table `QueryError` (`You don't have access to table …` / `Unknown table …`) is **not** captured to PostHog — it's the normal empty state, not a bug — while genuine, unexpected query failures are still reported (`isExpectedMissingTableError` in `accountOpportunitiesLogic`). Each opportunity name links to its Salesforce record (`SALESFORCE_ORIGIN/<id>` in `constants.ts`, the same origin the Useful links sidebar uses).
+The Support tickets tab lists the account's support tickets from the conversations product.
+`accountSupportTicketsLogic` calls the generated `accountsSupportTicketsList` endpoint (customer-analytics facade `get_account_support_tickets` → conversations facade `list_account_tickets`, matching `Ticket.organization_id` against the account's `external_id`).
+It owns three states like the Opportunities tab — a skeleton while loading, a "couldn't load" empty state on unexpected failure (captured to PostHog), and a "no tickets yet" empty state for a linked account with none.
+An account with no `external_id` simply returns an empty list (the backend short-circuits), so it shows the same "no tickets" state.
+Each ticket row links to the ticket in the conversations UI via the `deep_link` the backend builds (`{SITE_URL}/project/<team>/support/tickets/<ticket_number>`), firing `SupportTicketClicked`.
+Like Opportunities, it loads directly in the logic (no embedded query), so the root `useMountedLogic` is enough — no `useAttachedLogic` needed.
+
Clicking a note in the Notes tab opens it in the global notebook **side panel** (`notebookPanelLogic.selectNotebook`), keeping the Accounts list mounted — not the full `NotebookScene`. The note `<Link>` still points at `urls.notebook(shortId)` so cmd/ctrl-click opens the full page in a new tab; a plain click `preventDefault()`s the router push and opens the panel instead.
The Notes tab is server-paginated, searchable, and sortable (all via `accountNotebooksLogic`, which sends `limit`/`offset`/`search`/`ordering` to `accountsNotebooksList`). Search is full-text over title **and** content (mirrors the main Notebooks page); the **Created by** and **Created at** columns sort server-side (whitelisted `ordering`, default `-created_at`). The **New note** button creates an internal notebook linked to the account (via `accountsNotebooksCreate`) and opens it in the side panel — it persists immediately like normal notebook creation (no empty-cleanup). The backend chain threading `search`/`order` is: `AccountNotebookViewSet.list` (whitelists `ordering`) → customer-analytics facade `api.list_account_notebooks` → notebooks facade → `notebooks/backend/logic.list_account_notebooks`.
@@ -202,10 +211,11 @@ We track user actions on the Accounts list with `posthog.capture()`. Conventions
| `customer analytics accounts note created` | `accountNotebooksLogic` `createNoteSuccess` listener | `notebook_short_id` |
| `customer analytics accounts notes searched` | `accountNotebooksLogic` `setSearchTerm` listener (post-debounce) | `has_query`, `query_length` (no raw text) |
| `customer analytics accounts notes sorted` | `accountNotebooksLogic` `setSorting` listener | `column` (`created_at` \| `created_by` \| null), `direction` (`asc` \| `desc` \| `cleared`) |
-| `customer analytics account tab viewed` | `accountsExpansionLogic` `setActiveTab` listener (genuine tab clicks only; programmatic `openAccountTab` navigation does not fire it) | `tab` (`notes` \| `users` \| `relationships` \| `usage` \| `spend` \| `opportunities` \| `event_stream`) |
+| `customer analytics account tab viewed` | `accountsExpansionLogic` `setActiveTab` listener (genuine tab clicks only; programmatic `openAccountTab` navigation does not fire it) | `tab` (`notes` \| `users` \| `relationships` \| `usage` \| `spend` \| `opportunities` \| `support_tickets` \| `event_stream`) |
| `customer analytics account usage series toggled` | `accountBillingLogic` `toggleHiddenSeriesKey` listener (dispatched by the `AccountBillingSeriesToggle` chips) | `kind` (`usage` \| `spend`), `is_hidden` (the post-click state), `series_count` (no series label / no PII) |
| `customer analytics account related user clicked` | `AccountRelatedUsersExpansion.tsx` user `<Link>` `onClick` | _(none — customer end-user PII kept out)_ |
| `customer analytics account opportunity clicked` | `AccountOpportunitiesExpansion.tsx` opportunity name `<Link>` `onClick` | _(none — CRM record id/url kept out)_ |
+| `customer analytics account support ticket clicked` | `AccountSupportTicketsExpansion.tsx` ticket `<Link>` `onClick` | _(none — ticket number/customer content kept out)_ |
| `customer analytics account event stream toggled` | `eventStreamLogic` (`../EventStream/`) `setAccountMembership` listener — the "Include in event stream" toggle in the expanded row's Event stream tab | `account_id`, `included`, `member_count` |
| `customer analytics event stream config saved` | `eventStreamLogic` `saveEventStreamSuccess` listener — the Save button in the Event stream settings section | `enabled`, `event_count`, `has_slack_channel`, `member_count` |
| `customer analytics event stream test message sent` | `eventStreamLogic` `sendTestMessageSuccess` listener — the "Send test message" button in the Event stream settings section | `event_count`, `member_count` |
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx b/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx
index 59f3c087de63..88b0bf6f908a 100644
--- a/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx
+++ b/products/customer_analytics/frontend/components/Accounts/AccountNotebooksExpansion.tsx
@@ -36,6 +36,8 @@ import { accountRelatedUsersLogic } from './accountRelatedUsersLogic'
import { AccountRelationshipsExpansion } from './AccountRelationshipsExpansion'
import { accountRelationshipsLogic } from './accountRelationshipsLogic'
import { accountsExpansionLogic } from './accountsExpansionLogic'
+import { AccountSupportTicketsExpansion } from './AccountSupportTicketsExpansion'
+import { accountSupportTicketsLogic } from './accountSupportTicketsLogic'
import { AccountsEvents } from './constants'
import { EditAccountLinksButton } from './EditAccountLinksButton'
@@ -143,6 +145,7 @@ export function AccountNotebooksExpansion({
useMountedLogic(accountBillingLogic({ accountId, externalId, kind: 'usage' }))
useMountedLogic(accountBillingLogic({ accountId, externalId, kind: 'spend' }))
useMountedLogic(accountOpportunitiesLogic({ accountId }))
+ useMountedLogic(accountSupportTicketsLogic({ accountId }))
const { setSearchTerm, setSorting, createNote } = useActions(logic)
const { featureFlags } = useValues(featureFlagLogic)
const { activeTabFor } = useValues(accountsExpansionLogic)
@@ -309,6 +312,11 @@ export function AccountNotebooksExpansion({
label: 'Opportunities',
content: <AccountOpportunitiesExpansion accountId={accountId} />,
},
+ {
+ key: 'support_tickets',
+ label: 'Support tickets',
+ content: <AccountSupportTicketsExpansion accountId={accountId} />,
+ },
// Flag-gated here (not just inside the component) so the tab label hides too.
!!featureFlags[FEATURE_FLAGS.CUSTOMER_ANALYTICS_CSP] && {
key: 'event_stream' as const,
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountSupportTicketsExpansion.tsx b/products/customer_analytics/frontend/components/Accounts/AccountSupportTicketsExpansion.tsx
new file mode 100644
index 000000000000..6bba703a03f1
--- /dev/null
+++ b/products/customer_analytics/frontend/components/Accounts/AccountSupportTicketsExpansion.tsx
@@ -0,0 +1,108 @@
+import { useValues } from 'kea'
+import posthog from 'posthog-js'
+
+import { LemonSkeleton, LemonTable, LemonTableColumns, LemonTag, Link } from '@posthog/lemon-ui'
+
+import { BigLeaguesHog } from 'lib/components/hedgehogs'
+import { TZLabel } from 'lib/components/TZLabel'
+
+import { SupportTicketApi } from 'products/customer_analytics/frontend/generated/api.schemas'
+
+import { accountSupportTicketsLogic, NOT_LOADED } from './accountSupportTicketsLogic'
+import { AccountsEvents } from './constants'
+
+// Matches the Relationships tab, the other client-side-paginated account tab.
+const PAGE_SIZE = 10
+
+function SupportTicketsEmptyState({ title, detail }: { title: string; detail: string }): JSX.Element {
+ return (
+ <div className="flex flex-col items-center justify-center gap-2 p-8 text-center">
+ <BigLeaguesHog className="w-24 h-24" />
+ <h4 className="mb-0">{title}</h4>
+ <p className="text-secondary max-w-sm mb-0">{detail}</p>
+ </div>
+ )
+}
+
+const columns: LemonTableColumns<SupportTicketApi> = [
+ {
+ title: 'Ticket',
+ key: 'ticket_number',
+ render: (_, ticket) => (
+ <Link
+ to={ticket.deep_link}
+ target="_blank"
+ onClick={() => posthog.capture(AccountsEvents.SupportTicketClicked)}
+ >
+ #{ticket.ticket_number}
+ </Link>
+ ),
+ sorter: (a, b) => a.ticket_number - b.ticket_number,
+ },
+ {
+ title: 'Last message',
+ key: 'last_message_text',
+ render: (_, ticket) =>
+ ticket.last_message_text ? (
+ <span className="line-clamp-1">{ticket.last_message_text}</span>
+ ) : (
+ <span className="text-muted">—</span>
+ ),
+ },
+ {
+ title: 'Status',
+ key: 'status',
+ render: (_, ticket) => (
+ <LemonTag type={ticket.status === 'resolved' ? 'success' : ticket.status === 'new' ? 'primary' : 'default'}>
+ {ticket.status === 'on_hold' ? 'On hold' : ticket.status}
+ </LemonTag>
+ ),
+ sorter: (a, b) => a.status.localeCompare(b.status),
+ },
+ {
+ title: 'Last activity',
+ key: 'last_message_at',
+ render: (_, ticket) =>
+ ticket.last_message_at ? <TZLabel time={ticket.last_message_at} /> : <span className="text-muted">—</span>,
+ sorter: (a, b) => (a.last_message_at ?? '').localeCompare(b.last_message_at ?? ''),
+ },
+]
+
+export function AccountSupportTicketsExpansion({ accountId }: { accountId: string }): JSX.Element {
+ const { ticketsResult, ticketsResultLoading } = useValues(accountSupportTicketsLogic({ accountId }))
+
+ if (ticketsResultLoading || ticketsResult === NOT_LOADED) {
+ return <LemonSkeleton className="h-64 w-full" />
+ }
+
+ const { tickets, loadFailed } = ticketsResult
+
+ if (loadFailed) {
+ return (
+ <SupportTicketsEmptyState
+ title="Couldn't load support tickets"
+ detail="Something went wrong loading this account's tickets. Try refreshing the page."
+ />
+ )
+ }
+
+ if (!tickets || tickets.length === 0) {
+ return (
+ <SupportTicketsEmptyState
+ title="No support tickets yet"
+ detail="Tickets from Slack, email, and the support widget for this account will show up here."
+ />
+ )
+ }
+
+ return (
+ <LemonTable<SupportTicketApi>
+ size="small"
+ embedded
+ dataSource={tickets}
+ columns={columns}
+ rowKey="id"
+ pagination={{ pageSize: PAGE_SIZE }}
+ />
+ )
+}
diff --git a/products/customer_analytics/frontend/components/Accounts/accountSupportTicketsLogic.test.ts b/products/customer_analytics/frontend/components/Accounts/accountSupportTicketsLogic.test.ts
new file mode 100644
index 000000000000..1e478d751ed7
--- /dev/null
+++ b/products/customer_analytics/frontend/components/Accounts/accountSupportTicketsLogic.test.ts
@@ -0,0 +1,56 @@
+import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
+
+import { initKeaTests } from '~/test/init'
+
+import { accountsSupportTicketsList } from 'products/customer_analytics/frontend/generated/api'
+import type { SupportTicketApi } from 'products/customer_analytics/frontend/generated/api.schemas'
+
+import { accountSupportTicketsLogic } from './accountSupportTicketsLogic'
+
+jest.mock('products/customer_analytics/frontend/generated/api', () => ({
+ // Keep the real module for everything else — connected logics call other generated
+ // functions on mount, and an absent export makes their loaders throw on every test.
+ ...jest.requireActual('products/customer_analytics/frontend/generated/api'),
+ accountsSupportTicketsList: jest.fn(),
+}))
+
+const mockList = accountsSupportTicketsList as jest.MockedFunction<typeof accountsSupportTicketsList>
+
+describe('accountSupportTicketsLogic', () => {
+ let logic: ReturnType<typeof accountSupportTicketsLogic.build>
+
+ beforeEach(() => {
+ initKeaTests()
+ jest.resetAllMocks()
+ jest.spyOn(posthog, 'captureException').mockReturnValue(undefined as any)
+ })
+
+ afterEach(() => {
+ logic?.unmount()
+ })
+
+ const mount = async (): Promise<void> => {
+ logic = accountSupportTicketsLogic({ accountId: 'acc-1' })
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ }
+
+ it('loads the account tickets', async () => {
+ const tickets = [{ id: 't-1', ticket_number: 7, status: 'open' }] as SupportTicketApi[]
+ mockList.mockResolvedValue(tickets)
+
+ await mount()
+
+ expect(logic.values.ticketsResult).toEqual({ tickets })
+ })
+
+ it('surfaces a load-failed result (not an infinite skeleton) and captures the error when the fetch throws', async () => {
+ mockList.mockRejectedValue(new Error('network'))
+
+ await mount()
+
+ expect(logic.values.ticketsResult).toEqual({ tickets: null, loadFailed: true })
+ expect(posthog.captureException).toHaveBeenCalledTimes(1)
+ })
+})
diff --git a/products/customer_analytics/frontend/components/Accounts/accountSupportTicketsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountSupportTicketsLogic.ts
new file mode 100644
index 000000000000..807218aa460b
--- /dev/null
+++ b/products/customer_analytics/frontend/components/Accounts/accountSupportTicketsLogic.ts
@@ -0,0 +1,88 @@
+import { MakeLogicType, afterMount, connect, kea, key, path, props } from 'kea'
+import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
+
+import { teamLogic } from 'scenes/teamLogic'
+
+import { accountsSupportTicketsList } from 'products/customer_analytics/frontend/generated/api'
+import { SupportTicketApi } from 'products/customer_analytics/frontend/generated/api.schemas'
+
+export interface AccountSupportTicketsLogicProps {
+ accountId: string
+}
+
+export interface AccountSupportTicketsResult {
+ tickets: SupportTicketApi[] | null
+ loadFailed?: boolean
+}
+
+// The view compares against this by reference to tell "not loaded yet" from a loaded empty result.
+export const NOT_LOADED: AccountSupportTicketsResult = { tickets: null }
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountSupportTicketsLogicValues {
+ currentTeamId: number | null // teamLogic
+ ticketsResult: AccountSupportTicketsResult
+ ticketsResultLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountSupportTicketsLogicActions {
+ loadTickets: () => any
+ loadTicketsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadTicketsSuccess: (
+ ticketsResult: AccountSupportTicketsResult,
+ payload?: any
+ ) => {
+ ticketsResult: AccountSupportTicketsResult
+ payload?: any
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface accountSupportTicketsLogicMeta {
+ key: string
+}
+
+export type accountSupportTicketsLogicType = MakeLogicType<
+ accountSupportTicketsLogicValues,
+ accountSupportTicketsLogicActions,
+ AccountSupportTicketsLogicProps,
+ accountSupportTicketsLogicMeta
+>
+
+export const accountSupportTicketsLogic = kea<accountSupportTicketsLogicType>([
+ path((key) => ['scenes', 'customerAnalytics', 'accounts', 'accountSupportTicketsLogic', key]),
+ props({} as AccountSupportTicketsLogicProps),
+ key((props) => props.accountId),
+ connect(() => ({
+ values: [teamLogic, ['currentTeamId']],
+ })),
+ loaders(({ props, values }) => ({
+ ticketsResult: [
+ NOT_LOADED,
+ {
+ loadTickets: async (): Promise<AccountSupportTicketsResult> => {
+ try {
+ const tickets = await accountsSupportTicketsList(String(values.currentTeamId), props.accountId)
+ return { tickets }
+ } catch (error) {
+ posthog.captureException(error as Error, {
+ scope: 'accountSupportTicketsLogic.loadTickets',
+ })
+ return { tickets: null, loadFailed: true }
+ }
+ },
+ },
+ ],
+ })),
+ afterMount(({ actions }) => {
+ actions.loadTickets()
+ }),
+])
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts
index 5388d687c46e..ba432da7bb83 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsExpansionLogic.ts
@@ -10,6 +10,7 @@ export type AccountExpansionTab =
| 'usage'
| 'spend'
| 'opportunities'
+ | 'support_tickets'
| 'event_stream'
export const ACCOUNT_EXPANSION_TABS: AccountExpansionTab[] = [
@@ -19,6 +20,7 @@ export const ACCOUNT_EXPANSION_TABS: AccountExpansionTab[] = [
'usage',
'spend',
'opportunities',
+ 'support_tickets',
'event_stream',
]
diff --git a/products/customer_analytics/frontend/components/Accounts/constants.ts b/products/customer_analytics/frontend/components/Accounts/constants.ts
index a65f0ad2fa68..1929e945f9a9 100644
--- a/products/customer_analytics/frontend/components/Accounts/constants.ts
+++ b/products/customer_analytics/frontend/components/Accounts/constants.ts
@@ -50,6 +50,7 @@ export const AccountsEvents = {
UsageSeriesToggled: 'customer analytics account usage series toggled',
RelatedUserClicked: 'customer analytics account related user clicked',
OpportunityClicked: 'customer analytics account opportunity clicked',
+ SupportTicketClicked: 'customer analytics account support ticket clicked',
EventStreamMembershipToggled: 'customer analytics account event stream toggled',
EventStreamConfigSaved: 'customer analytics event stream config saved',
EventStreamTestMessageSent: 'customer analytics event stream test message sent',
diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.ts
index 2e6c23c7229c..c0a95e4a5b27 100644
--- a/products/customer_analytics/frontend/generated/api.schemas.ts
+++ b/products/customer_analytics/frontend/generated/api.schemas.ts
@@ -437,6 +437,30 @@ export interface PatchedAccountApi {
readonly updated_at?: string | null
}
+/**
+ * A support ticket linked to an account, sourced from the conversations product (read-only).
+ */
+export interface SupportTicketApi {
+ /** UUID of the support ticket. */
+ readonly id: string
+ /** Human-readable ticket number. */
+ readonly ticket_number: number
+ /** Current status of the ticket (e.g. 'new', 'open'). */
+ readonly status: string
+ /**
+ * When the most recent message was sent on this ticket.
+ * @nullable
+ */
+ readonly last_message_at: string | null
+ /**
+ * Truncated preview of the most recent message.
+ * @nullable
+ */
+ readonly last_message_text: string | null
+ /** Absolute URL to open this ticket in the app. */
+ readonly deep_link: string
+}
+
/**
* * `pending` - Pending
* * `sending` - Sending
diff --git a/products/customer_analytics/frontend/generated/api.ts b/products/customer_analytics/frontend/generated/api.ts
index 1d3b6586c4a5..ea846a181a85 100644
--- a/products/customer_analytics/frontend/generated/api.ts
+++ b/products/customer_analytics/frontend/generated/api.ts
@@ -63,6 +63,7 @@ import type {
PatchedCustomerProfileConfigApi,
PatchedEventStreamApi,
PatchedGroupUsageMetricApi,
+ SupportTicketApi,
} from './api.schemas'
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
@@ -543,6 +544,21 @@ export const accountsDestroy = async (projectId: string, id: string, options?: R
})
}
+export const getAccountsSupportTicketsListUrl = (projectId: string, id: string) => {
+ return `/api/projects/${projectId}/accounts/${id}/support_tickets/`
+}
+
+export const accountsSupportTicketsList = async (
+ projectId: string,
+ id: string,
+ options?: RequestInit
+): Promise<SupportTicketApi[]> => {
+ return apiMutator<SupportTicketApi[]>(getAccountsSupportTicketsListUrl(projectId, id), {
+ ...options,
+ method: 'GET',
+ })
+}
+
export const getAnnouncementsListUrl = (projectId: string, params?: AnnouncementsListParams) => {
const normalizedParams = new URLSearchParams()
diff --git a/products/customer_analytics/mcp/tools.yaml b/products/customer_analytics/mcp/tools.yaml
index 790529ed6f03..4fb81bb5e7cb 100644
--- a/products/customer_analytics/mcp/tools.yaml
+++ b/products/customer_analytics/mcp/tools.yaml
@@ -359,6 +359,9 @@ tools:
deep-link it with the path `/customer_analytics/accounts/<id>/<tab>` (using the account `id`; tab is
optional — one of notes/users/usage/spend, e.g. `/customer_analytics/accounts/<id>/usage`).
feature_flag: customer-analytics-csp
+ accounts-support-tickets-list:
+ operation: accounts_support_tickets_list
+ enabled: false
accounts-update:
operation: accounts_update
enabled: false
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 72b692d8fe8d..8bf577663cd0 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -67281,6 +67281,30 @@ export namespace Schemas {
metadata?: unknown;
}
+ /**
+ * A support ticket linked to an account, sourced from the conversations product (read-only).
+ */
+ export interface SupportTicket {
+ /** UUID of the support ticket. */
+ readonly id: string;
+ /** Human-readable ticket number. */
+ readonly ticket_number: number;
+ /** Current status of the ticket (e.g. 'new', 'open'). */
+ readonly status: string;
+ /**
+ * When the most recent message was sent on this ticket.
+ * @nullable
+ */
+ readonly last_message_at: string | null;
+ /**
+ * Truncated preview of the most recent message.
+ * @nullable
+ */
+ readonly last_message_text: string | null;
+ /** Absolute URL to open this ticket in the app. */
+ readonly deep_link: string;
+ }
+
/**
* Event counts keyed by event name (survey shown, survey dismissed, survey sent).
*/