: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(conversations): channel-aware reply placeholder and send logo (#71364)
Xanderd16551db9b6b
diff --git a/products/conversations/frontend/components/Channels/ChannelsTag.tsx b/products/conversations/frontend/components/Channels/ChannelsTag.tsxindex 07f4ba569c8d..345ba5aab76a 100644--- a/products/conversations/frontend/components/Channels/ChannelsTag.tsx+++ b/products/conversations/frontend/components/Channels/ChannelsTag.tsx@@ -13,7 +13,7 @@ export function getChannelThreadUrl(ticket: Ticket | null): string | undefined {return undefined}-const channelIcon: Record<TicketChannel, JSX.Element> = {+export const channelIcon: Record<TicketChannel, JSX.Element> = {widget: <IconComment />,slack: <IconSlack />,teams: <IconMicrosoftTeams />,@@ -21,6 +21,23 @@ const channelIcon: Record<TicketChannel, JSX.Element> = {github: <IconGithub />,}+// Channels a team member replies back into externally, branded on the composer+// (placeholder text + send-button logo). Others fall back to the generic composer.+const replyChannelLabel: Partial<Record<TicketChannel, string>> = {+ slack: 'Slack',+ teams: 'Microsoft Teams',+ github: 'GitHub',+}++export function getReplyPlaceholder(channel?: TicketChannel): string {+ const label = channel ? replyChannelLabel[channel] : undefined+ return label ? `Reply in ${label}...` : 'Type your message...'+}++export function hasReplyChannelBranding(channel?: TicketChannel): channel is TicketChannel {+ return !!channel && channel in replyChannelLabel+}+const channelDetailLabel: Record<TicketChannelDetail, string> = {slack_channel_message: 'Channel message',slack_bot_mention: 'Bot mention',diff --git a/products/conversations/frontend/components/Chat/ChatView.tsx b/products/conversations/frontend/components/Chat/ChatView.tsxindex 6d89783769ea..ceea2ff1a553 100644--- a/products/conversations/frontend/components/Chat/ChatView.tsx+++ b/products/conversations/frontend/components/Chat/ChatView.tsx@@ -2,7 +2,7 @@ import { JSONContent } from '@tiptap/core'import { LemonCard } from '@posthog/lemon-ui'-import type { AiReplyFeedbackRating, ChatMessage, Ticket, TicketStatus } from '../../types'+import type { AiReplyFeedbackRating, ChatMessage, Ticket, TicketChannel, TicketStatus } from '../../types'import { MessageInput } from './MessageInput'import { MessageList } from './MessageList'@@ -24,6 +24,8 @@ export interface ChatViewProps {header?: React.ReactNodeminHeight?: stringmaxHeight?: string+ /** Channel the ticket came from; drives the reply placeholder and send-button logo */+ channel?: TicketChannel/** Whether to show the "Send as private" option in the message input */showPrivateOption?: boolean/** Number of team messages that haven't been read by the customer */@@ -69,6 +71,7 @@ export function ChatView({header,minHeight,maxHeight,+ channel,showPrivateOption = false,unreadCustomerCount,showDeliveryStatus = false,@@ -114,6 +117,7 @@ export function ChatView({<MessageInputonSendMessage={onSendMessage}messageSending={messageSending}+ channel={channel}showPrivateOption={showPrivateOption}draftContent={draftContent}onDraftChange={onDraftChange}diff --git a/products/conversations/frontend/components/Chat/MessageInput.tsx b/products/conversations/frontend/components/Chat/MessageInput.tsxindex d80b3784f8da..82f97df1e5c3 100644--- a/products/conversations/frontend/components/Chat/MessageInput.tsx+++ b/products/conversations/frontend/components/Chat/MessageInput.tsx@@ -7,7 +7,8 @@ import { LemonButton, LemonCheckbox, LemonSwitch, Tooltip } from '@posthog/lemonimport { RichContentEditorType } from 'lib/components/RichContentEditor/types'import { LemonDialog } from 'lib/lemon-ui/LemonDialog'-import type { TicketStatus } from '../../types'+import type { TicketChannel, TicketStatus } from '../../types'+import { channelIcon, getReplyPlaceholder, hasReplyChannelBranding } from '../Channels/ChannelsTag'import { SupportEditor, serializeToMarkdown } from '../Editor'export interface MessageInputProps {@@ -20,6 +21,8 @@ export interface MessageInputProps {) => voidmessageSending: booleanplaceholder?: string+ /** Channel the ticket came from; drives the default placeholder and the send-button logo */+ channel?: TicketChannelbuttonText?: stringminRows?: number/** Whether to show the "Send as private" checkbox */@@ -51,7 +54,8 @@ export interface MessageInputProps {export function MessageInput({onSendMessage,messageSending,- placeholder = 'Type your message...',+ placeholder,+ channel,buttonText = 'Send',minRows = 3,showPrivateOption = false,@@ -80,6 +84,8 @@ export function MessageInput({const isPrivate = controlledIsPrivate ?? localIsPrivateconst setIsPrivate = onPrivateChange ?? setLocalIsPrivate+ const resolvedPlaceholder = placeholder ?? (isPrivate ? 'Type your private note...' : getReplyPlaceholder(channel))+ const showChannelLogo = !isPrivate && hasReplyChannelBranding(channel)const sendVerb = isPrivate ? 'Attach' : 'Send'const handleSubmit = (statusAfterSend?: TicketStatus): void => {@@ -167,7 +173,7 @@ export function MessageInput({<div><SupportEditorinitialContent={draftContent}- placeholder={placeholder}+ placeholder={resolvedPlaceholder}onCreate={(editor) => {editorRef.current = editorif (draftContent) {@@ -250,7 +256,16 @@ export function MessageInput({: undefined}>- {isPrivate ? 'Attach' : buttonText}+ {isPrivate ? (+ 'Attach'+ ) : showChannelLogo ? (+ <span className="inline-flex items-center gap-1.5">+ {buttonText}+ <span className="text-sm dark:grayscale">{channelIcon[channel]}</span>+ </span>+ ) : (+ buttonText+ )}</LemonButton></div></div>diff --git a/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx b/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsxindex 6c2e3aff8164..5c991f8d28fa 100644--- a/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx+++ b/products/conversations/frontend/scenes/ticket/SupportTicketScene.tsx@@ -200,6 +200,7 @@ export function SupportTicketScene({ ticketId }: { ticketId: string }): JSX.ElemolderMessagesLoading={olderMessagesLoading}onSendMessage={sendMessage}onLoadOlderMessages={loadOlderMessages}+ channel={ticket?.channel_source}showPrivateOptionunreadCustomerCount={ticket?.unread_customer_count}showDeliveryStatus={ticket?.channel_source === 'widget'}