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(inbox): show interview invite in report decisions (#122964)

Dylan Martin82aaf3d2de9e
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 5fe8dc29c8b0..90a3873e0dfc 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -354,6 +354,7 @@ export const FEATURE_FLAGS = {
HOGQL_WAREHOUSE_ACCESS_CONTROL: 'hogql-warehouse-access-control', // owner: @a-lider #team-platform-features, gates per-object access control for warehouse tables and views
IDENTITY_MATCHING: 'identity-matching', // owner: @fercgomes #team-growth, gates new identity matching scene on marketing analytics
INBOX_GET_IT_MERGED: 'inbox-get-it-merged', // owner: #team-self-driving, gates the Get it merged action in the report Ask AI menu
+ INBOX_INTERVIEW_INVITE: 'inbox-interview-invite', // owner: #team-self-driving, gates the interview invite after report feedback
INBOX_MCP_USED: 'inbox-mcp-used', // owner: #team-self-driving, hides the MCP banner after confirmed Inbox tool use
INBOX_MODEL_SORT: 'inbox-model-sort', // owner: #team-self-driving, gates the ranking model sort options and the score tag on inbox cards
INBOX_REPORT_FEEDBACK_BANG: 'inbox-report-feedback-bang', // owner: #team-self-driving, gates the party hog that pops on a report thumbs-up in the inbox and on the Today home page
diff --git a/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.test.tsx b/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.test.tsx
index 88914e7d9bf7..8eed0b9d2bf2 100644
--- a/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.test.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.test.tsx
@@ -20,6 +20,10 @@ jest.mock('../../inboxAnalytics', () => ({
captureInboxReportFeedbackNote: jest.fn(),
}))
+jest.mock('./ReportInterviewInvite', () => ({
+ ReportInterviewInvite: () => <span>Interview invite</span>,
+}))
+
const CELEBRATION_SELECTOR = '[data-attr="inbox-report-feedback-celebration"]'
function setCelebrationFlag(enabled: boolean): void {
@@ -101,9 +105,11 @@ describe('ReportFeedbackFooter', () => {
it('asks a question matched to the rating, sends the note with Enter, and shows what went through', async () => {
setCelebrationFlag(false)
expect(screen.queryByLabelText('Add a note about this report')).not.toBeInTheDocument()
+ expect(screen.queryByText('Interview invite')).not.toBeInTheDocument()
await user.click(screen.getByLabelText('This report was useful'))
expect(await screen.findByText('What made it useful?')).toBeVisible()
+ expect(screen.queryByText('Interview invite')).not.toBeInTheDocument()
await user.click(screen.getByLabelText('This report was not useful'))
expect(await screen.findByText('What was off?')).toBeVisible()
@@ -133,6 +139,25 @@ describe('ReportFeedbackFooter', () => {
)
expect(await screen.findByText('Note added: The repro steps were wrong')).toBeVisible()
expect(screen.queryByLabelText('Add a note about this report')).not.toBeInTheDocument()
+ expect(screen.getByText('Interview invite')).toBeVisible()
+ })
+
+ it('shows the invite after a note on a previously rated report', async () => {
+ cleanup()
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/:id/feedback_state/': { sentiment: 'positive', note: '' },
+ },
+ })
+ render(<ReportFeedbackFooter report={makeReport({ id: 'report-with-saved-rating' })} />)
+
+ expect(await screen.findByText('What made it useful?')).toBeVisible()
+ expect(screen.queryByText('Interview invite')).not.toBeInTheDocument()
+
+ await user.type(screen.getByLabelText('Add a note about this report'), 'Clear steps{Enter}')
+
+ expect(await screen.findByText('Note added: Clear steps')).toBeVisible()
+ expect(screen.getByText('Interview invite')).toBeVisible()
})
it('does not pop on thumbs-down', async () => {
diff --git a/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx b/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx
index f0fa7acaeda4..2ce157206495 100644
--- a/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportFeedbackFooter.tsx
@@ -11,6 +11,7 @@ import { InboxReportFeedbackSentiment } from '../../inboxAnalytics'
import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
import { SignalReport } from '../../types'
import { useReportFeedbackCelebration } from './ReportFeedbackCelebration'
+import { ReportInterviewInvite } from './ReportInterviewInvite'
// Matches the cap on the sibling inbox dialogs (Dismiss, Refund, agent question); the note rides along as
// an analytics property, so keep it under the client's per-property limit.
@@ -46,9 +47,11 @@ export function ReportFeedbackFooter({
// tab, and `LemonTabs` remounts tab content, so an unconditional `autoFocus` would grab focus on
// every tab switch.
const [askedHere, setAskedHere] = useState(false)
+ const [noteSubmittedHere, setNoteSubmittedHere] = useState(false)
const [questionDismissed, setQuestionDismissed] = useState(false)
const sendNote = (): void => {
if (feedbackNoteDraft.trim()) {
+ setNoteSubmittedHere(true)
submitFeedbackNote(feedbackNoteDraft)
}
}
@@ -169,6 +172,7 @@ export function ReportFeedbackFooter({
Note added: {feedbackSentNote}
</p>
)}
+ {noteSubmittedHere && feedbackNoteSent && <ReportInterviewInvite />}
</div>
)
}
diff --git a/products/signals/frontend/inbox/components/detail/ReportInterviewInvite.test.tsx b/products/signals/frontend/inbox/components/detail/ReportInterviewInvite.test.tsx
new file mode 100644
index 000000000000..eb6be0866526
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ReportInterviewInvite.test.tsx
@@ -0,0 +1,194 @@
+import { MOCK_DEFAULT_USER } from 'lib/api.mock'
+
+import '@testing-library/jest-dom'
+
+import { act, cleanup, render, screen, waitFor, within } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import * as featureFlagModule from 'lib/logic/featureFlagLogic'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { userLogic } from 'scenes/userLogic'
+
+import { initKeaTests } from '~/test/init'
+
+import { captureInboxInterviewInvite } from '../../inboxAnalytics'
+import { openDismissReportDialog } from '../shell/DismissReportDialog'
+import { openResolveReportDialog } from '../shell/ResolveReportDialog'
+import { ReportInterviewInvite } from './ReportInterviewInvite'
+
+jest.mock('../../inboxAnalytics', () => ({
+ ...jest.requireActual('../../inboxAnalytics'),
+ captureInboxInterviewInvite: jest.fn(),
+}))
+
+describe('ReportInterviewInvite', () => {
+ const user = userEvent.setup()
+ const bookingText = 'Book a 30-minute chat about Inbox'
+
+ beforeEach(() => {
+ localStorage.clear()
+ initKeaTests()
+ featureFlagLogic.mount()
+ userLogic.mount()
+ userLogic.actions.loadUserSuccess(MOCK_DEFAULT_USER)
+ jest.spyOn(featureFlagModule, 'getFeatureFlagPayload').mockReturnValue({
+ booking_url: 'https://cal.com/example/interview',
+ })
+ jest.mocked(captureInboxInterviewInvite).mockClear()
+ })
+
+ afterEach(() => {
+ cleanup()
+ jest.restoreAllMocks()
+ })
+
+ it('shows a dismissible booking link only when the flag has a Cal.com URL', async () => {
+ const { rerender } = render(<ReportInterviewInvite />)
+ expect(screen.queryByText('Want some free PostHog merch?')).not.toBeInTheDocument()
+
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+ rerender(<ReportInterviewInvite />)
+
+ expect(await screen.findByText('Want some free PostHog merch?')).toBeInTheDocument()
+ const link = (await screen.findByText(bookingText)).closest('a')
+ expect(link).toHaveAttribute('href', 'https://cal.com/example/interview')
+ await waitFor(() => expect(captureInboxInterviewInvite).toHaveBeenCalledWith('shown'))
+
+ await user.click(screen.getByLabelText('Dismiss interview invite'))
+ expect(screen.queryByText(bookingText)).not.toBeInTheDocument()
+ expect(captureInboxInterviewInvite).toHaveBeenCalledWith('dismissed')
+ })
+
+ it('rejects a non-HTTPS booking URL', () => {
+ jest.mocked(featureFlagModule.getFeatureFlagPayload).mockReturnValue({ booking_url: 'javascript:alert(1)' })
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+
+ render(<ReportInterviewInvite />)
+
+ expect(screen.queryByText(bookingText)).not.toBeInTheDocument()
+ expect(captureInboxInterviewInvite).not.toHaveBeenCalled()
+ })
+
+ it('shows the invite only once when it is ignored', async () => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+
+ render(<ReportInterviewInvite />)
+ expect(await screen.findByText(bookingText)).toBeInTheDocument()
+ await waitFor(() => expect(captureInboxInterviewInvite).toHaveBeenCalledWith('shown'))
+ cleanup()
+
+ render(<ReportInterviewInvite />)
+ expect(screen.queryByText(bookingText)).not.toBeInTheDocument()
+ expect(captureInboxInterviewInvite).toHaveBeenCalledTimes(1)
+ })
+
+ it('records the booking click and hides the invite', async () => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+ render(<ReportInterviewInvite />)
+
+ await user.click(screen.getByText(bookingText))
+
+ expect(captureInboxInterviewInvite).toHaveBeenCalledWith('clicked')
+ expect(screen.queryByText(bookingText)).not.toBeInTheDocument()
+ })
+
+ it.each([
+ ['resolve', () => openResolveReportDialog({ reportTitle: 'Example report', onConfirm: jest.fn() })],
+ ['dismiss', () => openDismissReportDialog({ reportTitle: 'Example report', onConfirm: jest.fn() })],
+ ])('shows the invite in a single-report %s dialog', async (_name, openDialog) => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+
+ act(openDialog)
+
+ expect(await screen.findByText(bookingText)).toBeInTheDocument()
+ const dialog = screen.getByRole('dialog')
+ await user.click(within(dialog).getByText('Cancel'))
+ await waitFor(() => expect(dialog).not.toBeInTheDocument())
+ })
+
+ it.each([
+ {
+ name: 'resolve booking link',
+ reason: 'Implemented manually',
+ submitLabel: 'Resolve report',
+ control: 'link',
+ openDialog: (onConfirm: jest.Mock) => openResolveReportDialog({ reportTitle: 'Example report', onConfirm }),
+ },
+ {
+ name: 'resolve invite dismissal',
+ reason: 'Implemented manually',
+ submitLabel: 'Resolve report',
+ control: 'dismiss',
+ openDialog: (onConfirm: jest.Mock) => openResolveReportDialog({ reportTitle: 'Example report', onConfirm }),
+ },
+ {
+ name: 'dismiss booking link',
+ reason: 'Already fixed',
+ submitLabel: 'Dismiss & teach the agent',
+ control: 'link',
+ openDialog: (onConfirm: jest.Mock) => openDismissReportDialog({ reportTitle: 'Example report', onConfirm }),
+ },
+ {
+ name: 'dismiss invite dismissal',
+ reason: 'Already fixed',
+ submitLabel: 'Dismiss & teach the agent',
+ control: 'dismiss',
+ openDialog: (onConfirm: jest.Mock) => openDismissReportDialog({ reportTitle: 'Example report', onConfirm }),
+ },
+ ])(
+ 'does not submit the report when Enter activates the $name',
+ async ({ reason, submitLabel, control, openDialog }) => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+ const onConfirm = jest.fn()
+ act(() => openDialog(onConfirm))
+
+ const dialog = screen.getByRole('dialog')
+ await user.click(within(dialog).getByText(reason))
+ await waitFor(() => expect(within(dialog).getByText(submitLabel).closest('button')).not.toBeDisabled())
+
+ const inviteControl =
+ control === 'link'
+ ? within(dialog).getByText(bookingText).closest('a')
+ : within(dialog).getByLabelText('Dismiss interview invite')
+ inviteControl?.focus()
+ await user.keyboard('{Enter}')
+
+ expect(onConfirm).not.toHaveBeenCalled()
+ expect(dialog).toBeInTheDocument()
+ await user.click(within(dialog).getByText('Cancel'))
+ await waitFor(() => expect(dialog).not.toBeInTheDocument())
+ }
+ )
+
+ it.each([
+ ['bulk resolve', () => openResolveReportDialog({ selectedCount: 2, onConfirm: jest.fn() })],
+ [
+ 'hotkey dismiss',
+ () => openDismissReportDialog({ reportTitle: 'Example report', hotkeys: true, onConfirm: jest.fn() }),
+ ],
+ ])('keeps the invite out of %s', async (_name, openDialog) => {
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.INBOX_INTERVIEW_INVITE], {
+ [FEATURE_FLAGS.INBOX_INTERVIEW_INVITE]: true,
+ })
+
+ act(openDialog)
+
+ expect(screen.queryByText(bookingText)).not.toBeInTheDocument()
+ const dialog = screen.getByRole('dialog')
+ await user.click(within(dialog).getByText('Cancel'))
+ await waitFor(() => expect(dialog).not.toBeInTheDocument())
+ })
+})
diff --git a/products/signals/frontend/inbox/components/detail/ReportInterviewInvite.tsx b/products/signals/frontend/inbox/components/detail/ReportInterviewInvite.tsx
new file mode 100644
index 000000000000..24b585ca8448
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ReportInterviewInvite.tsx
@@ -0,0 +1,105 @@
+import { useActions, useValues } from 'kea'
+import { useEffect, useMemo } from 'react'
+
+import { IconX } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { lemonBannerLogic } from 'lib/lemon-ui/LemonBanner/lemonBannerLogic'
+import { getFeatureFlagPayload } from 'lib/logic/featureFlagLogic'
+import { userLogic } from 'scenes/userLogic'
+
+import { captureInboxInterviewInvite } from '../../inboxAnalytics'
+
+function bookingUrlFromPayload(payload: unknown): string | null {
+ if (typeof payload !== 'object' || payload === null || !('booking_url' in payload)) {
+ return null
+ }
+ const bookingUrl = payload.booking_url
+ if (typeof bookingUrl !== 'string') {
+ return null
+ }
+ try {
+ const url = new URL(bookingUrl)
+ return url.protocol === 'https:' && (url.hostname === 'cal.com' || url.hostname.endsWith('.cal.com'))
+ ? bookingUrl
+ : null
+ } catch {
+ return null
+ }
+}
+
+export function ReportInterviewInvite(): JSX.Element | null {
+ const enabled = useFeatureFlag('INBOX_INTERVIEW_INVITE')
+ const { user } = useValues(userLogic)
+ const bookingUrl = enabled
+ ? bookingUrlFromPayload(getFeatureFlagPayload(FEATURE_FLAGS.INBOX_INTERVIEW_INVITE))
+ : null
+ const dismissKey = `inbox-interview-invite-${user?.uuid ?? 'anonymous'}`
+ const seenKey = `inbox-interview-invite-seen-${user?.uuid ?? 'anonymous'}`
+ const wasShownBefore = useMemo(() => {
+ try {
+ return window.localStorage.getItem(seenKey) === '1'
+ } catch {
+ return true
+ }
+ }, [seenKey])
+ const logic = lemonBannerLogic({ dismissKey })
+ const { isDismissed } = useValues(logic)
+ const { dismiss } = useActions(logic)
+
+ useEffect(() => {
+ if (enabled && user?.uuid && bookingUrl && !isDismissed && !wasShownBefore) {
+ try {
+ if (window.localStorage.getItem(seenKey) === '1') {
+ return
+ }
+ window.localStorage.setItem(seenKey, '1')
+ } catch {
+ return
+ }
+ captureInboxInterviewInvite('shown')
+ }
+ }, [enabled, user?.uuid, bookingUrl, isDismissed, wasShownBefore, seenKey])
+
+ if (!enabled || !user?.uuid || !bookingUrl || isDismissed || wasShownBefore) {
+ return null
+ }
+
+ return (
+ <div
+ className="flex flex-wrap items-center gap-x-1 gap-y-0.5 text-xs text-tertiary"
+ onKeyDown={(event) => {
+ if (event.key === 'Enter') {
+ event.stopPropagation()
+ }
+ }}
+ >
+ <span>Want some free PostHog merch?</span>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ to={bookingUrl}
+ targetBlank
+ onClick={() => {
+ captureInboxInterviewInvite('clicked')
+ dismiss()
+ }}
+ data-attr="inbox-interview-invite-book"
+ >
+ Book a 30-minute chat about Inbox
+ </LemonButton>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ icon={<IconX />}
+ aria-label="Dismiss interview invite"
+ onClick={() => {
+ captureInboxInterviewInvite('dismissed')
+ dismiss()
+ }}
+ />
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/shell/DismissReportDialog.tsx b/products/signals/frontend/inbox/components/shell/DismissReportDialog.tsx
index 66878f652abf..20f0d5fc424e 100644
--- a/products/signals/frontend/inbox/components/shell/DismissReportDialog.tsx
+++ b/products/signals/frontend/inbox/components/shell/DismissReportDialog.tsx
@@ -4,6 +4,7 @@ import { LemonRadio, LemonRadioOption } from 'lib/lemon-ui/LemonRadio'
import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'
import { DISMISSAL_REASON_OPTIONS, DismissalFeedback, DismissalReasonValue } from '../../utils/dismissalReasons'
+import { ReportInterviewInvite } from '../detail/ReportInterviewInvite'
import { DismissCorrectedRepoField } from './DismissCorrectedRepoField'
import { HotkeyRadio } from './HotkeyRadio'
@@ -109,6 +110,7 @@ export function openDismissReportDialog({
maxRows={12}
/>
</LemonField>
+ {!isSelection && !hotkeys && !copy && <ReportInterviewInvite />}
</div>
),
errors: {
diff --git a/products/signals/frontend/inbox/components/shell/ResolveReportDialog.tsx b/products/signals/frontend/inbox/components/shell/ResolveReportDialog.tsx
index 283a181feba8..3a24f07fb60e 100644
--- a/products/signals/frontend/inbox/components/shell/ResolveReportDialog.tsx
+++ b/products/signals/frontend/inbox/components/shell/ResolveReportDialog.tsx
@@ -8,6 +8,7 @@ import {
STOP_MONITORING_REASON_OPTIONS,
ResolveReasonValue,
} from '../../utils/dismissalReasons'
+import { ReportInterviewInvite } from '../detail/ReportInterviewInvite'
import { HotkeyRadio } from './HotkeyRadio'
export interface ResolveReportDialogResult {
@@ -121,6 +122,7 @@ export function openResolveReportDialog({
maxRows={8}
/>
</LemonField>
+ {!isSelection && !hotkeys && !copy && <ReportInterviewInvite />}
</div>
),
errors: {
diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.ts
index 343340045509..38319d3adc86 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.ts
@@ -49,6 +49,9 @@ export const INBOX_EVENTS = {
REPORT_SOURCE_SUGGESTION_SHOWN: 'Inbox report source suggestion shown',
REPORT_SOURCE_SUGGESTION_CLICKED: 'Inbox report source suggestion clicked',
REPORT_FEEDBACK_NOTE: 'Inbox report feedback note',
+ INTERVIEW_INVITE_SHOWN: 'Inbox interview invite shown',
+ INTERVIEW_INVITE_CLICKED: 'Inbox interview invite clicked',
+ INTERVIEW_INVITE_DISMISSED: 'Inbox interview invite dismissed',
// Cloud-only for now: the desktop inbox has no model sorts.
RANKING_DETAILS_VIEWED: 'Inbox ranking details viewed',
SETTINGS_CHANGED: 'Inbox settings changed',
@@ -781,6 +784,15 @@ export function captureInboxReportFeedbackNote(params: {
})
}
+export function captureInboxInterviewInvite(action: 'shown' | 'clicked' | 'dismissed'): void {
+ const event = {
+ shown: INBOX_EVENTS.INTERVIEW_INVITE_SHOWN,
+ clicked: INBOX_EVENTS.INTERVIEW_INVITE_CLICKED,
+ dismissed: INBOX_EVENTS.INTERVIEW_INVITE_DISMISSED,
+ }[action]
+ captureInboxEvent(event, { surface: 'report_feedback_note' })
+}
+
export function captureSignalSourceConnected(params: {
sourceProduct: string
sourceType: string