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(workflows): offer broadcasts in onboarding and guide the first broadcast (#114331)

Meikel Ratz3f8b528af58b
diff --git a/products/workflows/frontend/Broadcasts/BroadcastsEmptyState.tsx b/products/workflows/frontend/Broadcasts/BroadcastsEmptyState.tsx
new file mode 100644
index 000000000000..652ed48023fc
--- /dev/null
+++ b/products/workflows/frontend/Broadcasts/BroadcastsEmptyState.tsx
@@ -0,0 +1,75 @@
+import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
+
+import { IconMegaphone } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
+
+import { AccessControlLevel, AccessControlResourceType } from '~/types'
+
+import { onboardingWizardUrl } from '../setupGuide/wizard/onboardingWizardSteps'
+import { newBroadcastAgentLogic } from './newBroadcastAgentLogic'
+
+/** The Broadcasts tab before the first broadcast: set up a verified sender first, then write one. */
+export function BroadcastsEmptyState(): JSX.Element {
+ const { integrations } = useValues(integrationsLogic)
+ const { startNewBroadcast } = useActions(newBroadcastAgentLogic)
+ const editorDisabledReason = getAccessControlDisabledReason(
+ AccessControlResourceType.Workflow,
+ AccessControlLevel.Editor
+ )
+ // Until the integrations load, nothing says the sender is missing, so the setup prompt waits.
+ const senderReady =
+ integrations === null ||
+ integrations.some((integration) => integration.kind === 'email' && integration.config?.verified === true)
+
+ // pinned: analytics event name - renaming breaks dashboards
+ const capture = (action: 'set-up-email' | 'new-broadcast'): void => {
+ posthog.capture('workflows broadcasts empty state clicked', { action })
+ }
+
+ return (
+ <div
+ className="flex flex-col items-center gap-3 rounded-lg border border-dashed border-border py-12 text-center"
+ data-attr="broadcasts-empty-state"
+ >
+ <div className="flex items-center justify-center size-12 rounded-full bg-surface-secondary">
+ <IconMegaphone className="size-6" />
+ </div>
+ <div className="flex flex-col gap-1">
+ <h3 className="mb-0 text-base font-semibold">Send your first broadcast</h3>
+ <p className="mb-0 max-w-md text-secondary">
+ {senderReady
+ ? 'Send a one-time or scheduled email to a group of people.'
+ : 'Broadcasts send from your own domain. Set up your email sender first, then write the broadcast.'}
+ </p>
+ </div>
+ <div className="flex flex-wrap justify-center gap-2">
+ {!senderReady && (
+ <LemonButton
+ type="primary"
+ to={onboardingWizardUrl('broadcast')}
+ disabledReason={editorDisabledReason}
+ onClick={() => capture('set-up-email')}
+ data-attr="broadcasts-empty-state-set-up-email"
+ >
+ Set up email
+ </LemonButton>
+ )}
+ <LemonButton
+ type={senderReady ? 'primary' : 'secondary'}
+ disabledReason={editorDisabledReason}
+ onClick={() => {
+ capture('new-broadcast')
+ startNewBroadcast()
+ }}
+ data-attr="broadcasts-empty-new"
+ >
+ New broadcast
+ </LemonButton>
+ </div>
+ </div>
+ )
+}
diff --git a/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx b/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx
index f230211bc1ff..f127145fc4a4 100644
--- a/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx
+++ b/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx
@@ -14,6 +14,7 @@ import { urls } from 'scenes/urls'
import type { HogFlowMinimalApi } from 'products/workflows/frontend/generated/api.schemas'
import { archiveDisabledReason, manageDisabledReason } from './broadcastLifecycle'
+import { BroadcastsEmptyState } from './BroadcastsEmptyState'
import {
BROADCASTS_PAGE_SIZE,
BroadcastsStatusFilter,
@@ -22,7 +23,6 @@ import {
isEligibleWorkflow,
} from './broadcastsLogic'
import { BroadcastStatusTag } from './BroadcastStatusTag'
-import { newBroadcastAgentLogic } from './newBroadcastAgentLogic'
const METRIC_COLUMNS: { title: string; metricName: string }[] = [
{ title: 'Sent', metricName: 'email_sent' },
@@ -38,7 +38,6 @@ export function BroadcastsTable(): JSX.Element {
// Rows from other filters stay behind the loading state, and are dropped once the load for these fails.
const hideRows = loadFailed && filtersPending
const { setFilters, archiveBroadcast, restoreBroadcast, deleteBroadcast } = useActions(broadcastsLogic)
- const { startNewBroadcast } = useActions(newBroadcastAgentLogic)
const { page } = filters
const isFiltered = !!filters.search || filters.status !== 'all' || !!filters.createdBy
@@ -155,18 +154,7 @@ export function BroadcastsTable(): JSX.Element {
broadcasts.count === 0
if (isEmpty) {
- return (
- <div
- className="flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border py-12"
- data-attr="broadcasts-empty-state"
- >
- <h3 className="m-0 text-lg font-semibold">No broadcasts yet</h3>
- <p className="m-0 text-secondary">Send a one-time or scheduled email to an audience of your users.</p>
- <LemonButton type="primary" onClick={startNewBroadcast} data-attr="broadcasts-empty-new">
- New broadcast
- </LemonButton>
- </div>
- )
+ return <BroadcastsEmptyState />
}
return (
diff --git a/products/workflows/frontend/WorkflowsScene.tsx b/products/workflows/frontend/WorkflowsScene.tsx
index 9ef277e53d7e..5b5b0c1ddac2 100644
--- a/products/workflows/frontend/WorkflowsScene.tsx
+++ b/products/workflows/frontend/WorkflowsScene.tsx
@@ -178,12 +178,9 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {
const { featureFlags } = useValues(featureFlagLogic)
const newNavigationEnabled = !!featureFlags[FEATURE_FLAGS.WORKFLOWS_NEW_NAVIGATION]
const guidedOnboardingEnabled = !!featureFlags[FEATURE_FLAGS.WORKFLOWS_GUIDED_ONBOARDING]
- const onboardingWizardEnabled = !!featureFlags[FEATURE_FLAGS.WORKFLOWS_ONBOARDING_WIZARD]
- // The workflow templates page and the onboarding wizard exist only behind their flags.
- const currentTab: WorkflowsSceneTab =
- (!newNavigationEnabled && routeTab === 'templates') || (!onboardingWizardEnabled && routeTab === 'onboarding')
- ? 'workflows'
- : routeTab
+ // The workflow templates page exists only behind its flag. The onboarding wizard is always reachable,
+ // because the broadcast setup links to it without a flag.
+ const currentTab: WorkflowsSceneTab = !newNavigationEnabled && routeTab === 'templates' ? 'workflows' : routeTab
const { startNewWorkflow } = useActions(newWorkflowLogic)
const { setTypeFilter } = useActions(workflowTemplatesLogic)
const { filters } = useValues(workflowsLogic)
diff --git a/products/workflows/frontend/emptyState/workflowsEmptyState.tsx b/products/workflows/frontend/emptyState/workflowsEmptyState.tsx
index 83d26360fa6d..1725b5a05b65 100644
--- a/products/workflows/frontend/emptyState/workflowsEmptyState.tsx
+++ b/products/workflows/frontend/emptyState/workflowsEmptyState.tsx
@@ -47,7 +47,7 @@ export const workflowsEmptyState: SceneProductEmptyState = {
text: {
'needs-setup': {
headline: 'What do you want to build first?',
- lead: 'Message your users with email, SMS and push, or automate work with Slack alerts, webhooks and AI tasks. You can do both later. This choice only picks where we start.',
+ lead: 'Message your users with email, SMS and push, send a one-off broadcast, or automate work with Slack alerts, webhooks and AI tasks. You can do all of them later. This choice only picks where we start.',
},
},
PrimaryAction: WorkflowsPathChoice,
diff --git a/products/workflows/frontend/setupGuide/WorkflowsPathChoice.tsx b/products/workflows/frontend/setupGuide/WorkflowsPathChoice.tsx
index 3838d93b4b87..dcb5ab02b1b1 100644
--- a/products/workflows/frontend/setupGuide/WorkflowsPathChoice.tsx
+++ b/products/workflows/frontend/setupGuide/WorkflowsPathChoice.tsx
@@ -20,6 +20,9 @@ export function WorkflowsPathChoice(): JSX.Element {
>
Automate a process
</LemonButton>
+ <LemonButton type="secondary" onClick={() => choosePath('broadcast')} data-attr="workflows-path-broadcast">
+ Send a broadcast
+ </LemonButton>
</div>
)
}
diff --git a/products/workflows/frontend/setupGuide/wizard/WizardBroadcastStep.tsx b/products/workflows/frontend/setupGuide/wizard/WizardBroadcastStep.tsx
new file mode 100644
index 000000000000..1082bfd11a5d
--- /dev/null
+++ b/products/workflows/frontend/setupGuide/wizard/WizardBroadcastStep.tsx
@@ -0,0 +1,29 @@
+import { IconCalendar, IconLetter, IconPeople } from '@posthog/icons'
+
+const NEXT_STEPS = [
+ { icon: <IconPeople />, title: 'Recipients', description: 'Pick a cohort, or filter people by their properties.' },
+ { icon: <IconLetter />, title: 'Email', description: 'Choose the sender, write the subject and design the email.' },
+ {
+ icon: <IconCalendar />,
+ title: 'Send',
+ description: 'Send it now or schedule it. You review it before it goes out.',
+ },
+]
+
+export function WizardBroadcastStep(): JSX.Element {
+ return (
+ <ol className="m-0 flex list-none flex-col gap-4 p-0">
+ {NEXT_STEPS.map((step) => (
+ <li key={step.title} className="flex items-start gap-3">
+ <span className="flex size-8 shrink-0 items-center justify-center rounded bg-surface-secondary text-lg">
+ {step.icon}
+ </span>
+ <div className="flex flex-col">
+ <span className="font-semibold">{step.title}</span>
+ <span className="text-sm text-secondary">{step.description}</span>
+ </div>
+ </li>
+ ))}
+ </ol>
+ )
+}
diff --git a/products/workflows/frontend/setupGuide/wizard/WorkflowsOnboardingWizard.tsx b/products/workflows/frontend/setupGuide/wizard/WorkflowsOnboardingWizard.tsx
index 32329c5e8f6f..db71e53cbdee 100644
--- a/products/workflows/frontend/setupGuide/wizard/WorkflowsOnboardingWizard.tsx
+++ b/products/workflows/frontend/setupGuide/wizard/WorkflowsOnboardingWizard.tsx
@@ -6,8 +6,10 @@ import { LemonCard } from 'lib/lemon-ui/LemonCard'
import { CustomerIOImportModal } from '../../OptOuts/CustomerIOImportModal'
import { OptOutCategories } from '../../OptOuts/OptOutCategories'
+import type { WorkflowsOnboardingPath } from '../workflowsSetupGuideLogic'
import { OnboardingWizardStepper } from './OnboardingWizardStepper'
import { WIZARD_STEP_COPY } from './onboardingWizardSteps'
+import { WizardBroadcastStep } from './WizardBroadcastStep'
import { WizardChannelStep } from './WizardChannelStep'
import { WizardConnectStep } from './WizardConnectStep'
import { WizardCreateStep } from './WizardCreateStep'
@@ -16,7 +18,13 @@ import { WizardPushStep } from './WizardPushStep'
import { WizardTemplateStep } from './WizardTemplateStep'
import { workflowsOnboardingWizardLogic } from './workflowsOnboardingWizardLogic'
-/** The first-run setup for one path, one step at a time, ending in the workflow editor. */
+const PATH_LABELS: Record<WorkflowsOnboardingPath, string> = {
+ messaging: 'Message your users',
+ automation: 'Automate a process',
+ broadcast: 'Send a broadcast',
+}
+
+/** The first-run setup for one path, one step at a time, ending in the workflow or broadcast editor. */
export function WorkflowsOnboardingWizard(): JSX.Element {
const {
wizardPath,
@@ -32,14 +40,20 @@ export function WorkflowsOnboardingWizard(): JSX.Element {
const copy = WIZARD_STEP_COPY[currentStep]
const isSkip = copy.optional && !stepDone?.[currentStep]
- const continueLabel = isLastStep ? 'Open in editor' : isSkip ? 'Skip for now' : 'Continue'
+ const continueLabel = isLastStep
+ ? wizardPath === 'broadcast'
+ ? 'Write broadcast'
+ : 'Open in editor'
+ : isSkip
+ ? 'Skip for now'
+ : 'Continue'
return (
<div className="mx-auto w-full max-w-4xl flex flex-col gap-6 py-4" data-attr="workflows-onboarding-wizard">
<div className="flex flex-wrap items-center justify-between gap-2">
<div className="flex items-center gap-2">
- <LemonTag type={wizardPath === 'messaging' ? 'completion' : 'default'}>
- {wizardPath === 'messaging' ? 'Message your users' : 'Automate a process'}
+ <LemonTag type={wizardPath === 'automation' ? 'default' : 'completion'}>
+ {PATH_LABELS[wizardPath]}
</LemonTag>
<span className="text-secondary text-sm">{`Step ${stepIndex + 1} of ${stepKeys.length}`}</span>
</div>
@@ -47,7 +61,7 @@ export function WorkflowsOnboardingWizard(): JSX.Element {
Exit setup
</LemonButton>
</div>
- {setupCheckFailed && wizardPath === 'messaging' && (
+ {setupCheckFailed && wizardPath !== 'automation' && (
<LemonBanner
type="error"
action={{
@@ -82,6 +96,7 @@ export function WorkflowsOnboardingWizard(): JSX.Element {
{(currentStep === 'journey' || currentStep === 'template') && <WizardTemplateStep />}
{currentStep === 'connect' && <WizardConnectStep />}
{currentStep === 'create' && <WizardCreateStep />}
+ {currentStep === 'broadcast' && <WizardBroadcastStep />}
</LemonCard>
<div className="flex flex-wrap items-center justify-between gap-2 border-t pt-4">
<div>
diff --git a/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.test.ts b/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.test.ts
index 8b60cc050942..0d6107a56594 100644
--- a/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.test.ts
+++ b/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.test.ts
@@ -20,7 +20,7 @@ describe('onboardingWizardSteps', () => {
expect(firstOpenStepIndex(MESSAGING_WIZARD_STEPS, done)).toBe(expected)
})
- test.each<[string, 'messaging' | 'automation', boolean, string[]]>([
+ test.each<[string, 'messaging' | 'automation' | 'broadcast', boolean, string[]]>([
[
'messaging asks about push before the journey',
'messaging',
@@ -34,6 +34,12 @@ describe('onboardingWizardSteps', () => {
['channel', 'domain', 'opt-outs', 'journey'],
],
['automation never asks about push', 'automation', true, ['template', 'connect', 'create']],
+ [
+ 'broadcasts send email only, so they never ask about push',
+ 'broadcast',
+ true,
+ ['channel', 'domain', 'opt-outs', 'broadcast'],
+ ],
])('%s', (_, path, pushEnabled, expected) => {
expect(wizardSteps(path, pushEnabled)).toEqual(expected)
})
diff --git a/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.ts b/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.ts
index 8e5ed04bc19b..d35f18b10b09 100644
--- a/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.ts
+++ b/products/workflows/frontend/setupGuide/wizard/onboardingWizardSteps.ts
@@ -8,10 +8,12 @@ import type { WorkflowsOnboardingPath } from '../workflowsSetupGuideLogic'
// pinned: URL values and analytics property values for the wizard events - renaming breaks links and dashboards
export const MESSAGING_WIZARD_STEPS = ['channel', 'domain', 'opt-outs', 'journey'] as const
export const AUTOMATION_WIZARD_STEPS = ['template', 'connect', 'create'] as const
+export const BROADCAST_WIZARD_STEPS = ['channel', 'domain', 'opt-outs', 'broadcast'] as const
export const PUSH_WIZARD_STEP = 'push' as const
export type WizardStepKey =
| (typeof MESSAGING_WIZARD_STEPS)[number]
| (typeof AUTOMATION_WIZARD_STEPS)[number]
+ | (typeof BROADCAST_WIZARD_STEPS)[number]
| typeof PUSH_WIZARD_STEP
// pinned: URL path and search params of the wizard - renaming breaks the Slack sign-in return link
@@ -29,9 +31,11 @@ export function onboardingWizardUrl(
export const WIZARD_STEPS: Record<WorkflowsOnboardingPath, readonly WizardStepKey[]> = {
messaging: MESSAGING_WIZARD_STEPS,
automation: AUTOMATION_WIZARD_STEPS,
+ broadcast: BROADCAST_WIZARD_STEPS,
}
-/** The steps of one path. Messaging asks about push before the first journey when the project can send push. */
+/** The steps of one path. Messaging asks about push before the first journey when the project can send push.
+ * Broadcasts only send email, so that path never asks. */
export function wizardSteps(path: WorkflowsOnboardingPath, pushEnabled: boolean): readonly WizardStepKey[] {
const steps = WIZARD_STEPS[path]
if (path !== 'messaging' || !pushEnabled) {
@@ -53,7 +57,7 @@ export const WIZARD_STEP_COPY: Record<WizardStepKey, WizardStepCopy> = {
channel: {
label: 'Email channel',
title: 'Connect the email address you send from',
- description: 'Workflows send email from your own domain. Add the address that people see in their inbox.',
+ description: 'Email goes out from your own domain. Add the address that people see in their inbox.',
optional: false,
},
domain: {
@@ -84,6 +88,13 @@ export const WIZARD_STEP_COPY: Record<WizardStepKey, WizardStepCopy> = {
'Start from a template or from scratch. It opens in the editor, where you change the trigger and the emails and save it as a draft. Nothing sends until you launch it.',
optional: false,
},
+ broadcast: {
+ label: 'First broadcast',
+ title: 'Write your first broadcast',
+ description:
+ 'It opens the broadcast editor. You pick a sender and who gets it, write the email, and send it now or schedule it. Nothing sends until you confirm.',
+ optional: false,
+ },
template: {
label: 'Template',
title: 'What do you want to automate?',
diff --git a/products/workflows/frontend/setupGuide/wizard/workflowsOnboardingWizardLogic.ts b/products/workflows/frontend/setupGuide/wizard/workflowsOnboardingWizardLogic.ts
index 8a748801515e..8a73c8e20bb1 100644
--- a/products/workflows/frontend/setupGuide/wizard/workflowsOnboardingWizardLogic.ts
+++ b/products/workflows/frontend/setupGuide/wizard/workflowsOnboardingWizardLogic.ts
@@ -10,6 +10,7 @@ import { urls } from 'scenes/urls'
import type { IntegrationType } from '~/types'
+import { newBroadcastAgentLogic } from '../../Broadcasts/newBroadcastAgentLogic'
import type { HogFlowTemplate } from '../../Workflows/hogflows/types'
import { newWorkflowLogic } from '../../Workflows/newWorkflowLogic'
import { workflowTemplatesLogic } from '../../Workflows/templates/workflowTemplatesLogic'
@@ -28,7 +29,7 @@ import {
} from './onboardingWizardSteps'
function isOnboardingPath(value: unknown): value is WorkflowsOnboardingPath {
- return value === 'messaging' || value === 'automation'
+ return value === 'messaging' || value === 'automation' || value === 'broadcast'
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -60,6 +61,9 @@ export interface workflowsOnboardingWizardLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface workflowsOnboardingWizardLogicActions {
+ startNewBroadcast: () => {
+ value: true
+ } // newBroadcastAgentLogic
createEmptyWorkflow: () => {
value: true
} // newWorkflowLogic
@@ -177,6 +181,8 @@ export const workflowsOnboardingWizardLogic = kea<workflowsOnboardingWizardLogic
actions: [
newWorkflowLogic,
['createWorkflowFromTemplate', 'createEmptyWorkflow'],
+ newBroadcastAgentLogic,
+ ['startNewBroadcast'],
workflowsSetupGuideLogic,
['loadHasMessagingWorkflow', 'loadHasMessagingWorkflowFailure', 'loadHasMessagingWorkflowSuccess'],
],
@@ -280,7 +286,9 @@ export const workflowsOnboardingWizardLogic = kea<workflowsOnboardingWizardLogic
templates: [
(s) => [s.workflowTemplates, s.wizardPath],
(workflowTemplates: HogFlowTemplate[], wizardPath: WorkflowsOnboardingPath): HogFlowTemplate[] =>
- workflowTemplates.filter((template) => matchesTemplateType(template.actions, wizardPath)),
+ workflowTemplates.filter((template) =>
+ matchesTemplateType(template.actions, wizardPath === 'automation' ? 'automation' : 'messaging')
+ ),
],
selectedTemplate: [
(s) => [s.workflowTemplates, s.selectedTemplateId],
@@ -341,6 +349,7 @@ export const workflowsOnboardingWizardLogic = kea<workflowsOnboardingWizardLogic
(integration) => integration.kind === 'firebase' || integration.kind === 'apns'
),
journey: picked,
+ broadcast: false,
}
},
],
@@ -353,6 +362,9 @@ export const workflowsOnboardingWizardLogic = kea<workflowsOnboardingWizardLogic
selectedTemplate: HogFlowTemplate | null,
startsBlank: boolean
): string | null => {
+ if (currentStep === 'broadcast') {
+ return null
+ }
if (currentStep === 'journey' || currentStep === 'template' || currentStep === 'create') {
return selectedTemplate || startsBlank ? null : 'Pick a template or start from scratch'
}
@@ -389,11 +401,17 @@ export const workflowsOnboardingWizardLogic = kea<workflowsOnboardingWizardLogic
},
positionIfReady: () => {
const { stepDone, initialized, hasPositioned, wizardPath, stepKeys } = values
- if (stepDone && initialized && !hasPositioned && wizardPath === 'messaging') {
+ if (stepDone && initialized && !hasPositioned && wizardPath !== 'automation') {
actions.positionAtFirstOpenStep(firstOpenStepIndex(stepKeys, stepDone))
}
},
finish: () => {
+ if (values.wizardPath === 'broadcast') {
+ // pinned: analytics event name - renaming breaks dashboards
+ posthog.capture('workflows onboarding wizard finished', { path: values.wizardPath })
+ actions.startNewBroadcast()
+ return
+ }
if (values.startsBlank) {
// pinned: analytics event name - renaming breaks dashboards
posthog.capture('workflows onboarding wizard finished', {
@@ -421,7 +439,13 @@ export const workflowsOnboardingWizardLogic = kea<workflowsOnboardingWizardLogic
path: values.wizardPath,
step: values.currentStep,
})
- router.actions.push(values.wizardPath === 'messaging' ? urls.workflows('channels') : urls.workflows())
+ router.actions.push(
+ values.wizardPath === 'messaging'
+ ? urls.workflows('channels')
+ : values.wizardPath === 'broadcast'
+ ? urls.broadcasts()
+ : urls.workflows()
+ )
},
})),
subscriptions(({ actions }) => ({
diff --git a/products/workflows/frontend/setupGuide/workflowsSetupGuideLogic.ts b/products/workflows/frontend/setupGuide/workflowsSetupGuideLogic.ts
index 7ce8cae4a17b..8056d54f4ea2 100644
--- a/products/workflows/frontend/setupGuide/workflowsSetupGuideLogic.ts
+++ b/products/workflows/frontend/setupGuide/workflowsSetupGuideLogic.ts
@@ -13,6 +13,7 @@ import { urls } from 'scenes/urls'
import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureFlagLogic'
import type { IntegrationType } from '../../../../frontend/src/types'
+import { newBroadcastAgentLogic } from '../Broadcasts/newBroadcastAgentLogic'
import { hogFlowsList } from '../generated/api'
import { optOutCategoriesLogic } from '../OptOuts/optOutCategoriesLogic'
import type { MessageCategory } from '../OptOuts/optOutCategoriesLogic'
@@ -25,7 +26,7 @@ import { SetupGuideStep, SetupGuideStepKey, deriveSetupGuideSteps } from './setu
import { onboardingWizardUrl } from './wizard/onboardingWizardSteps'
// pinned: analytics property values for `workflows onboarding path selected` - renaming breaks dashboards
-export type WorkflowsOnboardingPath = 'messaging' | 'automation'
+export type WorkflowsOnboardingPath = 'messaging' | 'automation' | 'broadcast'
export interface TeamSetupGuideState {
path: WorkflowsOnboardingPath | null
@@ -61,6 +62,9 @@ export interface workflowsSetupGuideLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface workflowsSetupGuideLogicActions {
+ startNewBroadcast: () => {
+ value: true
+ } // newBroadcastAgentLogic
setTypeFilter: (typeFilter: WorkflowTemplateTypeFilter) => {
typeFilter: WorkflowTemplateTypeFilter
} // workflowTemplatesLogic
@@ -152,7 +156,7 @@ export const workflowsSetupGuideLogic = kea<workflowsSetupGuideLogicType>([
messageTemplatesLogic,
['templates', 'templatesLoading'],
],
- actions: [workflowTemplatesLogic, ['setTypeFilter']],
+ actions: [workflowTemplatesLogic, ['setTypeFilter'], newBroadcastAgentLogic, ['startNewBroadcast']],
})),
actions({
choosePath: (path: WorkflowsOnboardingPath) => ({ path }),
@@ -264,7 +268,15 @@ export const workflowsSetupGuideLogic = kea<workflowsSetupGuideLogicType>([
}
// pinned: analytics event name - renaming breaks dashboards
posthog.capture('workflows onboarding path selected', { path })
- if (values.featureFlags[FEATURE_FLAGS.WORKFLOWS_ONBOARDING_WIZARD]) {
+ // A broadcast only needs a verified sender, not the rest of the messaging setup.
+ const canSendBroadcast = !!values.steps?.some((step) => step.key === 'domain' && step.done)
+ if (path === 'broadcast') {
+ if (canSendBroadcast) {
+ actions.startNewBroadcast()
+ } else {
+ router.actions.push(onboardingWizardUrl(path))
+ }
+ } else if (values.featureFlags[FEATURE_FLAGS.WORKFLOWS_ONBOARDING_WIZARD]) {
// A finished messaging setup has nothing left to guide, so it goes straight to the journeys.
if (path === 'messaging' && values.isComplete) {
actions.browseTemplates('messaging')