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(conversations): link tickets table channel tag to slack thread (#72225)

Luke Beltone4e82ffd09b1
diff --git a/products/conversations/frontend/components/Channels/ChannelsTag.tsx b/products/conversations/frontend/components/Channels/ChannelsTag.tsx
index e3e0b0a6d69e..07f4ba569c8d 100644
--- a/products/conversations/frontend/components/Channels/ChannelsTag.tsx
+++ b/products/conversations/frontend/components/Channels/ChannelsTag.tsx
@@ -3,7 +3,15 @@ import { LemonTag, Link, Tooltip } from '@posthog/lemon-ui'
import { IconMicrosoftTeams, IconSlack } from 'lib/lemon-ui/icons'
-import type { TicketChannel, TicketChannelDetail } from '../../types'
+import type { Ticket, TicketChannel, TicketChannelDetail } from '../../types'
+
+// Builds a deep link to the originating Slack thread so the Channel tag can be clickable.
+export function getChannelThreadUrl(ticket: Ticket | null): string | undefined {
+ if (ticket?.channel_source === 'slack' && ticket.slack_channel_id && ticket.slack_thread_ts) {
+ return `https://app.slack.com/archives/${ticket.slack_channel_id}/p${ticket.slack_thread_ts.replace('.', '')}`
+ }
+ return undefined
+}
const channelIcon: Record<TicketChannel, JSX.Element> = {
widget: <IconComment />,
@@ -52,7 +60,8 @@ export function ChannelsTag({ channel, detail, to }: ChannelsTagProps): JSX.Elem
const tooltip = channelOpenLabel[channel] ?? `${channel}${detailText ? ` · ${detailText}` : ''}`
return (
<Tooltip title={tooltip}>
- <Link to={to} target="_blank">
+ {/* Stop propagation so clicking the tag opens Slack without triggering a row/parent click. */}
+ <Link to={to} target="_blank" onClick={(e) => e.stopPropagation()}>
{tag}
</Link>
</Tooltip>
diff --git a/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx b/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx
index 7e93b6832380..ed4be686803f 100644
--- a/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx
+++ b/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx
@@ -21,18 +21,12 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ProductKey } from '~/queries/schema/schema-general'
import { AssigneeIconDisplay, AssigneeLabelDisplay, AssigneeSelect } from '../../components/Assignee'
-import { ChannelsTag } from '../../components/Channels/ChannelsTag'
+import { ChannelsTag, getChannelThreadUrl } from '../../components/Channels/ChannelsTag'
import { ChatView } from '../../components/Chat/ChatView'
import { IdentityBadge } from '../../components/IdentityBadge/IdentityBadge'
import { SlaDisplay } from '../../components/SlaDisplay'
import { TicketTags } from '../../components/TicketTags'
-import {
- type Ticket,
- type TicketPriority,
- type TicketStatus,
- priorityOptions,
- statusOptionsWithoutAll,
-} from '../../types'
+import { type TicketPriority, type TicketStatus, priorityOptions, statusOptionsWithoutAll } from '../../types'
import { AIPanel } from './AIPanel'
import { ExceptionsPanel } from './ExceptionsPanel'
import { PreviousTicketsPanel } from './PreviousTicketsPanel'
@@ -50,14 +44,6 @@ export const scene: SceneExport<{ ticketId: string; id: string }> = {
paramsToProps: ({ params: { ticketId } }) => ({ ticketId, id: ticketId || 'new' }),
}
-// Builds a deep link to the originating Slack thread so the Channel tag can be clickable.
-function getChannelThreadUrl(ticket: Ticket | null): string | undefined {
- if (ticket?.channel_source === 'slack' && ticket.slack_channel_id && ticket.slack_thread_ts) {
- return `https://app.slack.com/archives/${ticket.slack_channel_id}/p${ticket.slack_thread_ts.replace('.', '')}`
- }
- return undefined
-}
-
// The rendered label is "<Send|Attach> and set <statusLabel>", depending on the private note checkbox
const SEND_AND_SET_STATUS_OPTIONS: { value: TicketStatus; statusLabel: string }[] = [
{ value: 'pending', statusLabel: 'pending' },
diff --git a/products/conversations/frontend/scenes/tickets/ticketColumns.tsx b/products/conversations/frontend/scenes/tickets/ticketColumns.tsx
index 796b8e7fc4fc..e6478795cec1 100644
--- a/products/conversations/frontend/scenes/tickets/ticketColumns.tsx
+++ b/products/conversations/frontend/scenes/tickets/ticketColumns.tsx
@@ -9,7 +9,7 @@ import { stripMarkdown } from 'lib/utils/markdown'
import { PersonDisplay } from 'scenes/persons/PersonDisplay'
import { AssigneeDisplay, AssigneeResolver } from '../../components/Assignee'
-import { ChannelsTag } from '../../components/Channels/ChannelsTag'
+import { ChannelsTag, getChannelThreadUrl } from '../../components/Channels/ChannelsTag'
import { IdentityBadge } from '../../components/IdentityBadge/IdentityBadge'
import { SlaDisplay } from '../../components/SlaDisplay'
import { TicketPreviewPopover } from '../../components/TicketPreview/TicketPreviewPopover'
@@ -238,7 +238,13 @@ const TICKET_COLUMNS: Record<TicketColumnKey, TicketColumnDefinition> = {
column: {
title: 'Channel',
key: 'channel',
- render: (_, ticket) => <ChannelsTag channel={ticket.channel_source} detail={ticket.channel_detail} />,
+ render: (_, ticket) => (
+ <ChannelsTag
+ channel={ticket.channel_source}
+ detail={ticket.channel_detail}
+ to={getChannelThreadUrl(ticket)}
+ />
+ ),
},
},
tags: {