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.

fix(customer-analytics): reuse account assignment filter component (#97929)

Arthur Moreira de Deus626f1c22f35f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 609bb7912ac7..90e865d0ec58 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -44,6 +44,22 @@ snapshots:
hash: v1.k794b7964.8a4b3dacfd375a6ea1a071602dad71bd0cb4eac7ec3cbfb59a7b88b24b13499c.2geC2_BbFaYt37zOgmt-U-l-7Ntnp4llgFg2lLnVNfg
charts-scatterchart--multiple-series--light:
hash: v1.k794b7964.69baa1b9dd87fe4f05bcba5ba26c44dc308710ecf6f81e6dbc5fe911ef5d1a54.ILa7Xo1RHpiz29BviHMOUkGOwepln2_GokrxhquX56U
+ components-account-assignment-filter--all-accounts--dark:
+ hash: v1.k794b7964.287fc2bde93abff46011d7238b1192a8aa941ee471a99e1b0d8ce17f39fdd448.l66lrCg8IG2_iS53q3bqcRh6OObqrzrYADwuKmLbYOI
+ components-account-assignment-filter--all-accounts--light:
+ hash: v1.k794b7964.50e68c418995796676b592867906d16a90d1d192a6bca52ebae3ae27b6f33963.lLxLFH9ZYumn1prbZymuI5yOirUQQHYaPfdiGO_QnaY
+ components-account-assignment-filter--assigned-to-anyone--dark:
+ hash: v1.k794b7964.90185836bd96c31f39db94922836c050010a8eede9c0b3c53725ee81e577f3e6.wBHAg4WpRoGhv3CVdu7x39M2So01twA4qDFF6XGuDlU
+ components-account-assignment-filter--assigned-to-anyone--light:
+ hash: v1.k794b7964.f7193617d83190a5f081e41e98b2b02f0ebe56084ed001521921f7e4c92ed3d2.AmEAOW-2bnRDKjNDY7d40zHj4zVJzHUuc35fs8-redM
+ components-account-assignment-filter--assigned-to-people--dark:
+ hash: v1.k794b7964.fce71416a5809f8d16ff1480043d5e0f49b5ba88db29dc50e999e5daebb35d25.4tIS6TMyZyMgbFRbxjUHVTFcUpOW-oc8ZMvZqf_WBWQ
+ components-account-assignment-filter--assigned-to-people--light:
+ hash: v1.k794b7964.7752e1b0b858c98571a8db9a4a0424d5649264b495d0b856cc49a8b6fe423370.mEhyG2wtsDf1ZYgqTYrxDnsbUMvlrtuJH-nO4fWbQwQ
+ components-account-assignment-filter--unassigned-only--dark:
+ hash: v1.k794b7964.c18261f8a8a79a5e0902ddce51785b490a0989efa6795851640fc3652f196e80.YIgWf5MpUsQDOzGjlEXNDlIrEyg9GEBXU5HZn8A3GNA
+ components-account-assignment-filter--unassigned-only--light:
+ hash: v1.k794b7964.4144ad0cfd0b53bd92cb7360bc27c693863338b5d393d69ddd900c542bc6f382.nk0C9Ks32zxldf1ffLBSBoB2xP_PQEKlyBbBOiiNP1c
components-account-project-switcher--no-pending-invite--dark:
hash: v1.k794b7964.ddbb5d27187cb1eb9341734e0b780c762cdfbc09aae81833c970369bd7ad4f32.3HNFMfb4Lflcg3uKD1-KNl09d3leMhmfuhR2WVLjLRE
components-account-project-switcher--no-pending-invite--light:
diff --git a/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.stories.tsx b/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.stories.tsx
new file mode 100644
index 000000000000..bbe715bd8e7a
--- /dev/null
+++ b/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.stories.tsx
@@ -0,0 +1,33 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { AccountAssignmentFilter } from './AccountAssignmentFilter'
+
+const meta = {
+ title: 'Components/Account assignment filter',
+ component: AccountAssignmentFilter,
+ args: {
+ assignedToUserIds: [],
+ onAssignedToUserIdsChange: () => {},
+ onStatusChange: () => {},
+ },
+} satisfies Meta<typeof AccountAssignmentFilter>
+
+export default meta
+
+type Story = StoryObj<typeof meta>
+
+export const AllAccounts: Story = {
+ args: { status: 'all' },
+}
+
+export const AssignedToAnyone: Story = {
+ args: { status: 'assigned' },
+}
+
+export const AssignedToPeople: Story = {
+ args: { status: 'assigned', assignedToUserIds: [1, 2] },
+}
+
+export const UnassignedOnly: Story = {
+ args: { status: 'unassigned' },
+}
diff --git a/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.test.tsx b/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.test.tsx
new file mode 100644
index 000000000000..f55c0bda5a16
--- /dev/null
+++ b/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.test.tsx
@@ -0,0 +1,70 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { Provider } from 'kea'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { AccountAssignmentFilter } from './AccountAssignmentFilter'
+import type { AssignmentStatus } from './accountAssignmentFilterTypes'
+
+describe('AccountAssignmentFilter', () => {
+ beforeEach(() => {
+ useMocks({
+ get: {
+ '/api/organizations/:organization_id/members/': () => [200, { results: [] }],
+ },
+ })
+ initKeaTests()
+ })
+
+ afterEach(cleanup)
+
+ function renderFilter({
+ status = 'all',
+ assignedToUserIds = [],
+ onStatusChange = jest.fn(),
+ }: {
+ status?: AssignmentStatus
+ assignedToUserIds?: number[]
+ onStatusChange?: jest.Mock
+ } = {}): void {
+ render(
+ <Provider>
+ <AccountAssignmentFilter
+ status={status}
+ assignedToUserIds={assignedToUserIds}
+ onStatusChange={onStatusChange}
+ onAssignedToUserIdsChange={jest.fn()}
+ />
+ </Provider>
+ )
+ }
+
+ it.each([
+ ['all', [], 'All accounts'],
+ ['assigned', [], 'Assigned to anyone'],
+ ['assigned', [1], 'Assigned to 1 person'],
+ ['assigned', [1, 2], 'Assigned to 2 people'],
+ ['unassigned', [], 'Unassigned only'],
+ ] as const)('labels %s with %s assignees', (status, assignedToUserIds, label) => {
+ renderFilter({ status, assignedToUserIds: [...assignedToUserIds] })
+
+ expect(screen.getByText(label)).toBeInTheDocument()
+ })
+
+ it('offers and selects each assignment status', () => {
+ const onStatusChange = jest.fn()
+ renderFilter({ onStatusChange })
+
+ fireEvent.click(screen.getByText('All accounts'))
+
+ for (const label of ['Unassigned only', 'Assigned to anyone', 'All assignment statuses']) {
+ expect(screen.getByText(label)).toBeInTheDocument()
+ }
+
+ fireEvent.click(screen.getByText('Assigned to anyone'))
+ expect(onStatusChange).toHaveBeenCalledWith('assigned')
+ })
+})
diff --git a/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.tsx b/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.tsx
new file mode 100644
index 000000000000..20d70f4545e5
--- /dev/null
+++ b/frontend/src/lib/components/AccountAssignmentFilter/AccountAssignmentFilter.tsx
@@ -0,0 +1,78 @@
+import { IconChevronDown } from '@posthog/icons'
+import { LemonButton, LemonCheckbox, LemonDivider, LemonDropdown } from '@posthog/lemon-ui'
+
+import { MemberSelectMultiple } from 'lib/components/MemberSelectMultiple'
+
+import type { AssignmentStatus } from './accountAssignmentFilterTypes'
+
+export interface AccountAssignmentFilterDataAttrs {
+ trigger?: string
+ unassigned?: string
+ assigned?: string
+ all?: string
+}
+
+export interface AccountAssignmentFilterProps {
+ assignedToUserIds: number[]
+ status: AssignmentStatus
+ onAssignedToUserIdsChange: (userIds: number[]) => void
+ onStatusChange: (status: AssignmentStatus) => void
+ dataAttrs?: AccountAssignmentFilterDataAttrs
+}
+
+export function AccountAssignmentFilter({
+ assignedToUserIds,
+ status,
+ onAssignedToUserIdsChange,
+ onStatusChange,
+ dataAttrs,
+}: AccountAssignmentFilterProps): JSX.Element {
+ const buttonLabel =
+ status === 'unassigned'
+ ? 'Unassigned only'
+ : status === 'all'
+ ? 'All accounts'
+ : assignedToUserIds.length === 0
+ ? 'Assigned to anyone'
+ : assignedToUserIds.length === 1
+ ? 'Assigned to 1 person'
+ : `Assigned to ${assignedToUserIds.length} people`
+
+ return (
+ <LemonDropdown
+ closeOnClickInside={false}
+ overlay={
+ <div className="p-2 min-w-64 flex flex-col gap-2">
+ <LemonCheckbox
+ checked={status === 'unassigned'}
+ onChange={(checked) => checked && onStatusChange('unassigned')}
+ label="Unassigned only"
+ data-attr={dataAttrs?.unassigned}
+ />
+ <LemonCheckbox
+ checked={status === 'assigned'}
+ onChange={(checked) => checked && onStatusChange('assigned')}
+ label="Assigned to anyone"
+ data-attr={dataAttrs?.assigned}
+ />
+ <LemonCheckbox
+ checked={status === 'all'}
+ onChange={(checked) => checked && onStatusChange('all')}
+ label="All assignment statuses"
+ data-attr={dataAttrs?.all}
+ />
+ <LemonDivider className="my-0" />
+ <MemberSelectMultiple
+ idKey="id"
+ value={assignedToUserIds}
+ onChange={(users) => onAssignedToUserIdsChange(users.map((user) => user.id))}
+ />
+ </div>
+ }
+ >
+ <LemonButton type="secondary" size="small" sideIcon={<IconChevronDown />} data-attr={dataAttrs?.trigger}>
+ {buttonLabel}
+ </LemonButton>
+ </LemonDropdown>
+ )
+}
diff --git a/frontend/src/lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes.ts b/frontend/src/lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes.ts
new file mode 100644
index 000000000000..d4b70a1bf7d2
--- /dev/null
+++ b/frontend/src/lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes.ts
@@ -0,0 +1,5 @@
+export type AssignmentStatus = 'all' | 'assigned' | 'unassigned'
+
+export function isAssignmentStatus(value: unknown): value is AssignmentStatus {
+ return value === 'all' || value === 'assigned' || value === 'unassigned'
+}
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 2920bf36b800..d3bb7faa37d5 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -76,6 +76,10 @@
"description": "Match accounts with no active relationship of any definition.",
"type": "boolean"
},
+ "assignedOnly": {
+ "description": "Match accounts with at least one active relationship of any definition.",
+ "type": "boolean"
+ },
"assignedToUserIds": {
"description": "Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the \"My accounts\" shortcut (the current user's id) and the shareable \"Assigned to\" filter — the ids are explicit so a shared URL resolves identically for every viewer.",
"items": {
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index df5d3218219c..38d10d852d34 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -2919,6 +2919,8 @@ export interface AccountsQuery extends DataNode<AccountsQueryResponse> {
assignedToUserIds?: integer[]
/** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean
+ /** Match accounts with at least one active relationship of any definition. */
+ assignedOnly?: boolean
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
filterExpression?: HogQLExpression
/** Include ignored accounts. Ignored accounts are hidden by default. */
diff --git a/nodejs/src/cdp/cdp-api.serial.test.ts b/nodejs/src/cdp/cdp-api.serial.test.ts
index 1980e8d94599..867a39006a05 100644
--- a/nodejs/src/cdp/cdp-api.serial.test.ts
+++ b/nodejs/src/cdp/cdp-api.serial.test.ts
@@ -1336,18 +1336,67 @@ describe('CDP API', () => {
.post(
`/api/projects/${batchHogFlow.team_id}/hog_flows/${batchHogFlow.id}/batch_invocations/job-791`
)
- .send({ filters: { properties: snapshotProperties } })
+ .send({ filters: { properties: snapshotProperties, assignment_status: 'assigned' } })
expect(res.status).toEqual(200)
const arg = createJobMock.mock.calls[0][0]
const state = parseJSON((arg.state as Buffer).toString('utf-8')) as Record<string, any>
expect(state.filters.properties).toEqual(snapshotProperties)
+ expect(state.filters.assignment_status).toEqual('assigned')
+ expect(state.filters.all_roles_unassigned).toBeUndefined()
expect(state.filters.properties).not.toEqual((batchHogFlow as any).trigger.filters.properties)
} finally {
api['batchResolverProducer'] = null
}
})
+ it('takes the whole assignment filter from the snapshot instead of one key at a time', async () => {
+ // A snapshot saved before assignment statuses existed carries assignee ids and no status.
+ // If the status came off the live trigger instead, Django would reject 'unassigned'
+ // paired with those ids and the run would fail.
+ const statusFlow = await insertHogFlow({
+ id: new UUIDT().toString(),
+ name: 'test batch hog flow with an assignment status',
+ status: 'active',
+ version: 1,
+ exit_condition: 'exit_on_conversion',
+ edges: [],
+ actions: [],
+ trigger: {
+ type: 'batch',
+ filters: {
+ audience_type: 'accounts',
+ properties: [],
+ assignment_status: 'unassigned',
+ assigned_to_user_ids: [],
+ },
+ },
+ })
+
+ const createJobMock = jest.fn().mockResolvedValue('resolver-job-id')
+ api['batchResolverProducer'] = {
+ createJob: createJobMock,
+ countInFlightJobs: jest.fn().mockResolvedValue({ count: 0, byAction: {}, positionUnknown: 0 }),
+ rescheduleParkedJobs: jest.fn(),
+ cancelJobs: jest.fn(),
+ disconnect: jest.fn().mockResolvedValue(undefined),
+ }
+
+ try {
+ const res = await supertest(app)
+ .post(`/api/projects/${statusFlow.team_id}/hog_flows/${statusFlow.id}/batch_invocations/job-792`)
+ .send({ filters: { audience_type: 'accounts', properties: [], assigned_to_user_ids: [7] } })
+
+ expect(res.status).toEqual(200)
+ const arg = createJobMock.mock.calls[0][0]
+ const state = parseJSON((arg.state as Buffer).toString('utf-8')) as Record<string, any>
+ expect(state.filters.assigned_to_user_ids).toEqual([7])
+ expect(state.filters.assignment_status).toBeUndefined()
+ } finally {
+ api['batchResolverProducer'] = null
+ }
+ })
+
it('sets email dedupe on the resolver state when the flow sends email to the default {{person.properties.email}}', async () => {
const emailHogFlow = await insertHogFlow({
id: new UUIDT().toString(),
diff --git a/nodejs/src/cdp/cdp-api.ts b/nodejs/src/cdp/cdp-api.ts
index 6ed2f7cc69eb..ddfcaa70559b 100644
--- a/nodejs/src/cdp/cdp-api.ts
+++ b/nodejs/src/cdp/cdp-api.ts
@@ -106,6 +106,9 @@ function sanitizeContentType(contentType: string | undefined, fallback: string):
// actual send target — see `canDedupeByEmail`.
const DEFAULT_EMAIL_TO_TEMPLATE_RE = /^\s*\{\{\s*person\.properties\.email\s*\}\}\s*$/
+// One account assignment filter is spread over these three keys.
+const ASSIGNMENT_FILTER_KEYS = ['assignment_status', 'assigned_to_user_ids', 'all_roles_unassigned'] as const
+
function canDedupeByEmail(hogFlow: { actions?: unknown }): boolean {
if (!Array.isArray(hogFlow.actions)) {
return false
@@ -1324,7 +1327,17 @@ export class CdpApi {
throw new Error('Batch resolver producer is not configured (missing CYCLOTRON_NODE_DATABASE_URL)')
}
- const audienceType = req.body.filters?.audience_type ?? hogFlow.trigger.filters.audience_type
+ const snapshotFilters: BatchResolverState['filters'] | undefined = req.body.filters
+ const audienceType = snapshotFilters?.audience_type ?? hogFlow.trigger.filters.audience_type
+ // A snapshot saved before assignment statuses existed carries assignee ids or the legacy
+ // flag, but no status. Resolved key by key, it inherits the live trigger's status, and
+ // Django rejects a status paired with assignee ids, so the run fails instead of sending
+ // the audience the confirm check validated. One source answers for all three keys.
+ const assignmentFilters =
+ snapshotFilters && ASSIGNMENT_FILTER_KEYS.some((key) => snapshotFilters[key] !== undefined)
+ ? snapshotFilters
+ : hogFlow.trigger.filters
+ const assignmentStatus = assignmentFilters.assignment_status
const initialState: BatchResolverState = {
batchJobId: parent_run_id,
teamId: team.id,
@@ -1334,15 +1347,14 @@ export class CdpApi {
// trigger here would let an edit landing after the confirm check widen the send.
// Fallback covers callers that predate the snapshot.
audience_type: audienceType,
- properties: req.body.filters?.properties ?? (hogFlow.trigger.filters.properties || []),
+ properties: snapshotFilters?.properties ?? (hogFlow.trigger.filters.properties || []),
filter_test_accounts:
- req.body.filters?.filter_test_accounts ??
+ snapshotFilters?.filter_test_accounts ??
(hogFlow.trigger.filters.filter_test_accounts || false),
- tag_names: req.body.filters?.tag_names ?? hogFlow.trigger.filters.tag_names,
- assigned_to_user_ids:
- req.body.filters?.assigned_to_user_ids ?? hogFlow.trigger.filters.assigned_to_user_ids,
- all_roles_unassigned:
- req.body.filters?.all_roles_unassigned ?? hogFlow.trigger.filters.all_roles_unassigned,
+ tag_names: snapshotFilters?.tag_names ?? hogFlow.trigger.filters.tag_names,
+ assignment_status: assignmentStatus,
+ assigned_to_user_ids: assignmentFilters.assigned_to_user_ids,
+ all_roles_unassigned: assignmentStatus ? undefined : assignmentFilters.all_roles_unassigned,
},
variables: req.body.variables ?? {},
groupTypeIndex: typeof req.body.group_type_index === 'number' ? req.body.group_type_index : undefined,
diff --git a/nodejs/src/cdp/schema/hogflow.test.ts b/nodejs/src/cdp/schema/hogflow.test.ts
index 9b3a252971ed..374bafb93488 100644
--- a/nodejs/src/cdp/schema/hogflow.test.ts
+++ b/nodejs/src/cdp/schema/hogflow.test.ts
@@ -10,6 +10,21 @@ describe('hogflow schema', () => {
filters: {},
}
+ describe('batch account filters', () => {
+ it('preserves assignment status', () => {
+ const parsed = HogFlowActionSchema.parse({
+ ...commonActionFields,
+ type: 'trigger',
+ config: {
+ type: 'batch',
+ filters: { audience_type: 'accounts', properties: [], assignment_status: 'assigned' },
+ },
+ })
+
+ expect((parsed.config as any).filters.assignment_status).toBe('assigned')
+ })
+ })
+
describe('wait_until_condition events', () => {
const baseConfig = {
condition: { filters: {} },
diff --git a/nodejs/src/cdp/schema/hogflow.ts b/nodejs/src/cdp/schema/hogflow.ts
index 2cf3cca84975..433dab540ecc 100644
--- a/nodejs/src/cdp/schema/hogflow.ts
+++ b/nodejs/src/cdp/schema/hogflow.ts
@@ -77,6 +77,7 @@ const HogFlowTriggerSchema = z.discriminatedUnion('type', [
properties: z.array(z.any()),
filter_test_accounts: z.boolean().optional(),
tag_names: z.array(z.string()).optional(),
+ assignment_status: z.enum(['all', 'assigned', 'unassigned']).optional(),
assigned_to_user_ids: z.array(z.number()).optional(),
all_roles_unassigned: z.boolean().optional(),
}),
diff --git a/nodejs/src/cdp/services/hogflows/batch-resolver.types.test.ts b/nodejs/src/cdp/services/hogflows/batch-resolver.types.test.ts
index 05d61e3a16c9..e9fa0c29dc9a 100644
--- a/nodejs/src/cdp/services/hogflows/batch-resolver.types.test.ts
+++ b/nodejs/src/cdp/services/hogflows/batch-resolver.types.test.ts
@@ -10,8 +10,9 @@ describe('BatchResolverState serialization', () => {
audience_type: 'accounts' as const,
properties: [{ key: 'defn-id', type: 'account_custom_property', operator: 'exact', value: ['x'] }],
tag_names: ['vip'],
+ assignment_status: 'assigned' as const,
assigned_to_user_ids: [7],
- all_roles_unassigned: true,
+ all_roles_unassigned: false,
},
variables: {},
maxAudienceSize: 100,
diff --git a/nodejs/src/cdp/services/hogflows/batch-resolver.types.ts b/nodejs/src/cdp/services/hogflows/batch-resolver.types.ts
index 6e145eba880e..f40b014a7484 100644
--- a/nodejs/src/cdp/services/hogflows/batch-resolver.types.ts
+++ b/nodejs/src/cdp/services/hogflows/batch-resolver.types.ts
@@ -28,6 +28,7 @@ export const BatchResolverStateSchema = z.object({
properties: z.array(z.record(z.string(), z.any())).optional(),
filter_test_accounts: z.boolean().optional(),
tag_names: z.array(z.string()).optional(),
+ assignment_status: z.enum(['all', 'assigned', 'unassigned']).optional(),
assigned_to_user_ids: z.array(z.number()).optional(),
all_roles_unassigned: z.boolean().optional(),
}),
diff --git a/posthog/schema.py b/posthog/schema.py
index 2a4b14b878b8..01cac3cc0499 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -24894,6 +24894,10 @@ class AccountsQuery(BaseModel):
default=None,
description="Match accounts with no active relationship of any definition.",
)
+ assignedOnly: bool | None = Field(
+ default=None,
+ description=("Match accounts with at least one active relationship of any definition."),
+ )
assignedToUserIds: list[int] | None = Field(
default=None,
description=(
diff --git a/products/customer_analytics/backend/hogql_queries/account_audience.py b/products/customer_analytics/backend/hogql_queries/account_audience.py
index 85d3e38b9da1..ad6ddd6ff5dc 100644
--- a/products/customer_analytics/backend/hogql_queries/account_audience.py
+++ b/products/customer_analytics/backend/hogql_queries/account_audience.py
@@ -92,6 +92,17 @@ def count_accounts_for_audience(team: Team, filters: AccountAudienceFilters) ->
return int(response.results[0][0]) if response.results else 0
+def _active_relationship_account_ids(user_ids: tuple[int, ...] | None = None) -> ast.SelectQuery | ast.SelectSetQuery:
+ if user_ids is not None:
+ return parse_select(
+ "SELECT account_id FROM system.account_relationships WHERE isNull(ended_at) AND user_id IN {user_ids}",
+ {"user_ids": ast.Constant(value=list(user_ids))},
+ )
+ return parse_select(
+ "SELECT account_id FROM system.account_relationships WHERE isNull(ended_at) AND isNotNull(user_id)"
+ )
+
+
def _where_exprs(team: Team, filters: AccountAudienceFilters) -> list[ast.Expr]:
where: list[ast.Expr] = [
parse_expr("isNotNull(accounts.external_id) AND accounts.external_id != ''"),
@@ -110,28 +121,23 @@ def _where_exprs(team: Team, filters: AccountAudienceFilters) -> list[ast.Expr]:
)
where.append(parse_expr("accounts.id IN {subquery}", {"subquery": subquery}))
- if filters.all_roles_unassigned:
+ if filters.assignment_status == "unassigned" or (
+ filters.assignment_status is None and filters.all_roles_unassigned
+ ):
where.append(
parse_expr(
"accounts.id NOT IN {subquery}",
- {
- "subquery": parse_select(
- "SELECT account_id FROM system.account_relationships"
- " WHERE isNull(ended_at) AND isNotNull(user_id)"
- )
- },
+ {"subquery": _active_relationship_account_ids()},
)
)
- if filters.assigned_to_user_ids:
+ if filters.assignment_status == "assigned" or (filters.assignment_status is None and filters.assigned_to_user_ids):
where.append(
parse_expr(
"accounts.id IN {subquery}",
{
- "subquery": parse_select(
- "SELECT account_id FROM system.account_relationships"
- " WHERE isNull(ended_at) AND user_id IN {user_ids}",
- {"user_ids": ast.Constant(value=list(filters.assigned_to_user_ids))},
+ "subquery": _active_relationship_account_ids(
+ filters.assigned_to_user_ids if filters.assigned_to_user_ids else None
)
},
)
diff --git a/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py b/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py
index 1addf874eff1..14c78e90ddc2 100644
--- a/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py
+++ b/products/customer_analytics/backend/hogql_queries/accounts_query_runner.py
@@ -149,6 +149,9 @@ class AccountsQueryRunner(AnalyticsQueryRunner[AccountsQueryResponse]):
parse_expr("id NOT IN {subquery}", {"subquery": self._active_relationship_account_ids()})
)
+ if self.query.assignedOnly:
+ where_exprs.append(parse_expr("id IN {subquery}", {"subquery": self._active_relationship_account_ids()}))
+
if self.query.assignedToUserIds:
where_exprs.append(
parse_expr(
diff --git a/products/customer_analytics/backend/hogql_queries/test/test_account_audience.py b/products/customer_analytics/backend/hogql_queries/test/test_account_audience.py
index 309eb191e6c8..5f8bfcc88016 100644
--- a/products/customer_analytics/backend/hogql_queries/test/test_account_audience.py
+++ b/products/customer_analytics/backend/hogql_queries/test/test_account_audience.py
@@ -84,6 +84,12 @@ class TestAccountAudience(ClickhouseTestMixin, NonAtomicBaseTest):
team_id=self.team.id, account=assigned, definition=definition, user=holder, created_by=holder
)
+ assert self._list(AccountAudienceFilters(assignment_status="all")) == ["assigned", "unassigned"]
+ assert self._list(AccountAudienceFilters(assignment_status="assigned")) == ["assigned"]
+ assert self._list(AccountAudienceFilters(assignment_status="unassigned")) == ["unassigned"]
+ assert self._list(AccountAudienceFilters(assignment_status="assigned", assigned_to_user_ids=(holder.id,))) == [
+ "assigned"
+ ]
assert self._list(AccountAudienceFilters(assigned_to_user_ids=(holder.id,))) == ["assigned"]
assert self._list(AccountAudienceFilters(all_roles_unassigned=True)) == ["unassigned"]
diff --git a/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py b/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py
index 19d70dbbc5f0..c5960ab952e3 100644
--- a/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py
+++ b/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py
@@ -171,6 +171,14 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):
self.assertEqual(set(self._ids(allRolesUnassigned=True)), {str(previously_assigned.id), str(never_assigned.id)})
+ def test_assigned_only(self):
+ holder = self._create_user("[email protected]")
+ assigned = create_account(team_id=self.team.id, name="Assigned")
+ self._assign(assigned, holder)
+ create_account(team_id=self.team.id, name="Unassigned")
+
+ self.assertEqual(self._ids(assignedOnly=True), [str(assigned.id)])
+
def test_combined_assigned_to_and_tags(self):
enterprise_tag = Tag.objects.create(name="enterprise", team=self.team)
startup_tag = Tag.objects.create(name="startup", team=self.team)
diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.md
index 539b9f6d663d..27f2cb6ee0ec 100644
--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md
+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md
@@ -76,8 +76,8 @@ The list query, account search endpoint, and agent entity search share both path
Ignored accounts (`ignored_at IS NOT NULL`) are excluded from list rows and overview metrics by default. A direct account route sets `includeIgnored` as well as `includeChurned`, so an ignored account still opens by id. `ignored_at` is a selectable account field, but the Accounts UI does not write it.
**Assignment filter (`assignmentStatus`).**
-A single canonical state on `accountsLogic` — `AssignmentStatus = 'all' | 'assigned' | 'unassigned'`, default `all` — drives the assigned/unassigned choice, so the status and the assigned-to user list can never describe contradictory sets.
-The "assigned to" dropdown shows three mutually exclusive checkboxes at the top, in order: **Unassigned only** (`unassigned`), **Assigned to anyone** (`assigned`), **All assignment statuses** (`all`, the default), plus the member picker below.
+A single canonical state on `accountsLogic` drives the assigned/unassigned choice. `AssignmentStatus = 'all' | 'assigned' | 'unassigned'`, with `all` as the default, so the status and user list cannot contradict each other.
+The shared `AccountAssignmentFilter` in `frontend/src/lib/components/` renders three mutually exclusive choices: **Unassigned only** (`unassigned`), **Assigned to anyone** (`assigned`), and **All assignment statuses** (`all`). It also renders the member picker.
`accountsTableQuery.ts` maps each status to a query filter: `all` omits the assignment filter entirely (both assigned and unassigned show), `assigned` emits `{ kind: 'assigned' }`, and `unassigned` emits `{ kind: 'unassigned' }`.
Selecting users or checking "My accounts" narrows the assigned status to those user ids (`{ kind: 'assigned_to' }`) — both force the status to `assigned`; leaving the assigned status clears the user list.
Legacy compatibility: a saved view or shared link created before this field defaulted to assigned-only, so any persisted filters object with no `assignmentStatus` resolves to `assigned` (an old `unassigned: true` resolves to `unassigned`) — they never silently broaden to `all`.
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx
index cf65c7f272c1..a4a5b07f7505 100644
--- a/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx
+++ b/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.test.tsx
@@ -131,45 +131,12 @@ describe('AccountsTabFilters', () => {
expect(screen.getByText('All accounts')).toBeInTheDocument()
})
- it('the assignment dropdown offers the three mutually exclusive statuses', () => {
+ it('updates the Accounts assignment status from the shared picker', () => {
renderFilters()
fireEvent.click(screen.getByText('All accounts'))
+ fireEvent.click(screen.getByText('Assigned to anyone'))
- const labels = ['Unassigned only', 'Assigned to anyone', 'All assignment statuses']
- for (const label of labels) {
- expect(screen.getByText(label)).toBeInTheDocument()
- }
- })
-
- it.each([
- ['Unassigned only', 'unassigned'],
- ['Assigned to anyone', 'assigned'],
- ])('selecting "%s" sets the canonical assignment status', (label, status) => {
- renderFilters()
-
- fireEvent.click(screen.getByText('All accounts'))
- fireEvent.click(screen.getByText(label))
-
- expect(logic.values.assignmentStatus).toBe(status)
- })
-
- // Regression: the picker must summarize a URL-restored filter from the id count
- // alone, without waiting on the lazily-loaded org members list — otherwise the
- // control looks empty (the default label) until the dropdown is opened.
- it('reflects a restored assigned-to filter as a count', () => {
- logic.actions.setAssignedToFilter([1, 2])
- renderFilters()
-
- expect(screen.getByText('Assigned to 2 people')).toBeInTheDocument()
- expect(screen.queryByText('All accounts')).not.toBeInTheDocument()
- })
-
- it('labels the assigned-to picker "Unassigned only" when that status is active', () => {
- logic.actions.setAssignmentStatus('unassigned')
- renderFilters()
-
- expect(screen.getByText('Unassigned only')).toBeInTheDocument()
- expect(screen.queryByText('All accounts')).not.toBeInTheDocument()
+ expect(logic.values.assignmentStatus).toBe('assigned')
})
})
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.tsx
index 80c2a4fd4ebf..8c4a3796ea73 100644
--- a/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.tsx
+++ b/products/customer_analytics/frontend/components/Accounts/AccountsTabFilters.tsx
@@ -1,16 +1,9 @@
import { useActions, useValues } from 'kea'
import { IconChevronDown, IconRefresh, IconX } from '@posthog/icons'
-import {
- LemonButton,
- LemonCheckbox,
- LemonDivider,
- LemonDropdown,
- LemonInput,
- LemonInputSelect,
-} from '@posthog/lemon-ui'
+import { LemonButton, LemonCheckbox, LemonDropdown, LemonInput, LemonInputSelect } from '@posthog/lemon-ui'
-import { MemberSelectMultiple } from 'lib/components/MemberSelectMultiple'
+import { AccountAssignmentFilter } from 'lib/components/AccountAssignmentFilter/AccountAssignmentFilter'
import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
@@ -21,7 +14,7 @@ import type { AnyPropertyFilter } from '~/types'
import { AccountRelationshipOperatorValueSelect } from './AccountRelationshipOperatorValueSelect'
import { accountsColumnConfigLogic } from './accountsColumnConfigLogic'
import { AccountsColumnConfigurator } from './AccountsColumnConfigurator'
-import { accountsLogic, AssignmentStatus, RoleFilterValue } from './accountsLogic'
+import { accountsLogic } from './accountsLogic'
import { AccountsOverviewTilesButton } from './AccountsOverviewTilesButton'
import {
ACCOUNT_FIELD_TAXONOMIC_OPTIONS,
@@ -117,18 +110,37 @@ export function AccountsTabFilters(): JSX.Element {
/>
)}
- <AssignedToPicker
- value={assignedToFilter}
- onChange={(value) => {
- setAssignedToFilter(value)
- reportFilterChange('assigned_to')
- }}
- status={assignmentStatus}
- onStatusChange={(status) => {
- setAssignmentStatus(status)
- reportFilterChange('assignment_status')
- }}
- />
+ <div className="flex gap-1 items-center" data-attr="accounts-assigned-to-filter">
+ <AccountAssignmentFilter
+ assignedToUserIds={assignedToFilter}
+ onAssignedToUserIdsChange={(userIds) => {
+ setAssignedToFilter(userIds)
+ reportFilterChange('assigned_to')
+ }}
+ status={assignmentStatus}
+ onStatusChange={(status) => {
+ setAssignmentStatus(status)
+ reportFilterChange('assignment_status')
+ }}
+ dataAttrs={{
+ unassigned: 'accounts-unassigned-filter',
+ assigned: 'accounts-assigned-filter',
+ all: 'accounts-all-assignment-filter',
+ }}
+ />
+ {assignmentStatus !== 'all' && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconX />}
+ onClick={() => {
+ setAssignmentStatus('all')
+ reportFilterChange('assignment_status')
+ }}
+ tooltip="Clear assignment filter"
+ />
+ )}
+ </div>
<LemonCheckbox
checked={assignedToCurrentUser}
@@ -175,76 +187,3 @@ export function AccountsTabFilters(): JSX.Element {
</div>
)
}
-
-function AssignedToPicker({
- value,
- onChange,
- status,
- onStatusChange,
-}: {
- value: RoleFilterValue
- onChange: (value: RoleFilterValue) => void
- status: AssignmentStatus
- onStatusChange: (status: AssignmentStatus) => void
-}): JSX.Element {
- const buttonLabel =
- status === 'unassigned'
- ? 'Unassigned only'
- : status === 'all'
- ? 'All accounts'
- : value.length === 0
- ? 'Assigned to anyone'
- : value.length === 1
- ? 'Assigned to 1 person'
- : `Assigned to ${value.length} people`
- // `all` is the default, so anything else is an active choice worth a clear button.
- const hasFilter = status !== 'all'
- return (
- <div className="flex gap-1 items-center" data-attr="accounts-assigned-to-filter">
- <LemonDropdown
- closeOnClickInside={false}
- overlay={
- <div className="p-2 min-w-64 flex flex-col gap-2">
- <LemonCheckbox
- checked={status === 'unassigned'}
- onChange={(checked) => checked && onStatusChange('unassigned')}
- label="Unassigned only"
- data-attr="accounts-unassigned-filter"
- />
- <LemonCheckbox
- checked={status === 'assigned'}
- onChange={(checked) => checked && onStatusChange('assigned')}
- label="Assigned to anyone"
- data-attr="accounts-assigned-filter"
- />
- <LemonCheckbox
- checked={status === 'all'}
- onChange={(checked) => checked && onStatusChange('all')}
- label="All assignment statuses"
- data-attr="accounts-all-assignment-filter"
- />
- <LemonDivider className="my-0" />
- <MemberSelectMultiple
- idKey="id"
- value={value}
- onChange={(users) => onChange(users.map((user) => user.id))}
- />
- </div>
- }
- >
- <LemonButton type="secondary" size="small" sideIcon={<IconChevronDown />}>
- {buttonLabel}
- </LemonButton>
- </LemonDropdown>
- {hasFilter && (
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconX />}
- onClick={() => onStatusChange('all')}
- tooltip="Clear assignment filter"
- />
- )}
- </div>
- )
-}
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts
index a140a3c1f39c..afd11ea263e2 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsLogic.ts
@@ -2,6 +2,10 @@ import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, redu
import { actionToUrl, router, urlToAction } from 'kea-router'
import posthog from 'posthog-js'
+import {
+ type AssignmentStatus,
+ isAssignmentStatus,
+} from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { isUUIDLike } from 'lib/utils/guards'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
@@ -63,7 +67,7 @@ import {
isAccountsTableRow,
supportedAccountFilters,
} from './accountsTableQuery'
-import { type AssignmentStatus, isAssignmentStatus, normalizeRoleFilter } from './accountsViewState'
+import { normalizeRoleFilter } from './accountsViewState'
import { AccountsEvents } from './constants'
export const SEARCH_DEBOUNCE_MS = 300
@@ -101,8 +105,6 @@ function clearSortIfColumnRemoved(values: SortLikeValues, actions: SortLikeActio
export type RoleFilterValue = number[]
-export type { AssignmentStatus }
-
export type AccountFilterType = 'tag' | 'assignment_status' | 'my_accounts' | 'assigned_to'
// `column` matches the visible column name (alias-stripped) so any selected
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsTableQuery.ts b/products/customer_analytics/frontend/components/Accounts/accountsTableQuery.ts
index 7fdd9c5410c1..62419908aae5 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsTableQuery.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsTableQuery.ts
@@ -1,3 +1,4 @@
+import type { AssignmentStatus } from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
import { isUUIDLike } from 'lib/utils/guards'
import {
@@ -40,7 +41,6 @@ import {
isAccountPropertyFilter,
isAccountRelationshipFilter,
} from './accountsPropertyFilters'
-import type { AssignmentStatus } from './accountsViewState'
const RELATIONSHIP_COLUMN_REGEX = /^accounts\.relationships\.values\.`([0-9a-fA-F-]+)` AS [A-Za-z_][\w]*$/
const CUSTOM_PROPERTY_COLUMN_REGEX = /^accounts\.custom_properties\.values\.`([0-9a-fA-F-]+)` AS [A-Za-z_][\w]*$/
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsViewState.ts b/products/customer_analytics/frontend/components/Accounts/accountsViewState.ts
index 8f20148a4f8e..fe1183a5a973 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsViewState.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsViewState.ts
@@ -1,3 +1,8 @@
+import {
+ type AssignmentStatus,
+ isAssignmentStatus,
+} from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
+
import { ColumnConfigurationApi } from 'products/product_analytics/frontend/generated/api.schemas'
import { ACCOUNTS_DEFAULT_COLUMNS, AccountColumnDisplayState } from './accountsColumnConfigLogic'
@@ -6,18 +11,6 @@ import type { AccountsOverviewTile, TileFilter } from './accountsOverviewTilesLo
import type { AccountFilter } from './accountsPropertyFilters'
import { DEFAULT_TILES } from './constants'
-// The single canonical assignment filter state. `all` shows every account (assigned
-// and unassigned) and omits the assignment query filter; `assigned` narrows to accounts
-// with an active assignment (optionally to specific users); `unassigned` shows only
-// accounts with no assignment.
-export type AssignmentStatus = 'all' | 'assigned' | 'unassigned'
-
-export const ASSIGNMENT_STATUS_VALUES: readonly AssignmentStatus[] = ['all', 'assigned', 'unassigned']
-
-export function isAssignmentStatus(value: unknown): value is AssignmentStatus {
- return typeof value === 'string' && (ASSIGNMENT_STATUS_VALUES as readonly string[]).includes(value)
-}
-
export interface AccountsViewFilters {
search: string
assignmentStatus: AssignmentStatus
diff --git a/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts b/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts
index 4c1fcea8a150..95102c6e98a8 100644
--- a/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts
+++ b/products/customer_analytics/frontend/components/Accounts/accountsViewsLogic.ts
@@ -5,6 +5,7 @@ import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
import posthog from 'posthog-js'
+import type { AssignmentStatus } from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { getCurrentTeamId } from 'lib/utils/getAppContext'
import { objectsEqual } from 'lib/utils/objects'
@@ -26,7 +27,7 @@ import type { UserType } from '../../../../../frontend/src/types'
import { ACCOUNTS_COLUMN_CONFIG_KEY, accountsColumnConfigLogic } from './accountsColumnConfigLogic'
import type { AccountColumnDisplayState } from './accountsColumnConfigLogic'
import { accountsLogic } from './accountsLogic'
-import type { AccountSortOrder, AssignmentStatus, RoleFilterValue } from './accountsLogic'
+import type { AccountSortOrder, RoleFilterValue } from './accountsLogic'
import { accountsOverviewTilesLogic } from './accountsOverviewTilesLogic'
import type { AccountsOverviewTile, TileFilter } from './accountsOverviewTilesLogic'
import type { AccountFilter } from './accountsPropertyFilters'
diff --git a/products/customer_analytics/frontend/components/Announcements/AnnouncementAccountFilters.tsx b/products/customer_analytics/frontend/components/Announcements/AnnouncementAccountFilters.tsx
index 94732cf50066..bceaa3a23381 100644
--- a/products/customer_analytics/frontend/components/Announcements/AnnouncementAccountFilters.tsx
+++ b/products/customer_analytics/frontend/components/Announcements/AnnouncementAccountFilters.tsx
@@ -1,17 +1,9 @@
import { useActions, useValues } from 'kea'
import { IconCheck, IconChevronDown, IconX } from '@posthog/icons'
-import {
- LemonButton,
- LemonCheckbox,
- LemonDivider,
- LemonDropdown,
- LemonInput,
- LemonInputSelect,
- LemonSnack,
-} from '@posthog/lemon-ui'
+import { LemonButton, LemonCheckbox, LemonDropdown, LemonInput, LemonInputSelect, LemonSnack } from '@posthog/lemon-ui'
-import { MemberSelectMultiple } from 'lib/components/MemberSelectMultiple'
+import { AccountAssignmentFilter } from 'lib/components/AccountAssignmentFilter/AccountAssignmentFilter'
import { tagsModel } from '~/models/tagsModel'
@@ -22,7 +14,7 @@ export function AnnouncementAccountFilters(): JSX.Element {
accountSearch,
accountTags,
assignedTo,
- allUnassigned,
+ assignmentStatus,
assignedToCurrentUser,
filtersActive,
filteredChannels,
@@ -33,7 +25,7 @@ export function AnnouncementAccountFilters(): JSX.Element {
setAccountSearch,
setAccountTags,
setAssignedTo,
- setAllUnassigned,
+ setAssignmentStatus,
setMyAccounts,
clearAccountFilters,
selectAllFilteredChannels,
@@ -43,14 +35,6 @@ export function AnnouncementAccountFilters(): JSX.Element {
const tagsButtonLabel =
accountTags.length === 0 ? 'All tags' : accountTags.length === 1 ? accountTags[0] : `${accountTags.length} tags`
- const assignedButtonLabel = allUnassigned
- ? 'Unassigned'
- : assignedTo.length === 0
- ? 'Assigned to anyone'
- : assignedTo.length === 1
- ? 'Assigned to 1 person'
- : `Assigned to ${assignedTo.length} people`
-
const matchCountLabel = filteredAccountChannelIdsLoading
? 'Finding matching channels…'
: `${filteredChannels.length} ${filteredChannels.length === 1 ? 'channel matches' : 'channels match'}`
@@ -87,29 +71,17 @@ export function AnnouncementAccountFilters(): JSX.Element {
{tagsButtonLabel}
</LemonButton>
</LemonDropdown>
- <LemonDropdown
- closeOnClickInside={false}
- overlay={
- <div className="p-2 min-w-64 flex flex-col gap-2">
- <LemonCheckbox
- checked={allUnassigned}
- onChange={setAllUnassigned}
- label="Unassigned only"
- data-attr="announcement-accounts-unassigned-filter"
- />
- <LemonDivider className="my-0" />
- <MemberSelectMultiple
- idKey="id"
- value={assignedTo}
- onChange={(users) => setAssignedTo(users.map((user) => user.id))}
- />
- </div>
- }
- >
- <LemonButton type="secondary" size="small" sideIcon={<IconChevronDown />}>
- {assignedButtonLabel}
- </LemonButton>
- </LemonDropdown>
+ <AccountAssignmentFilter
+ assignedToUserIds={assignedTo}
+ status={assignmentStatus}
+ onAssignedToUserIdsChange={setAssignedTo}
+ onStatusChange={setAssignmentStatus}
+ dataAttrs={{
+ unassigned: 'announcement-accounts-unassigned-filter',
+ assigned: 'announcement-accounts-assigned-filter',
+ all: 'announcement-accounts-all-assignment-filter',
+ }}
+ />
<LemonCheckbox
checked={assignedToCurrentUser}
onChange={setMyAccounts}
diff --git a/products/customer_analytics/frontend/components/Announcements/announcementsLogic.test.ts b/products/customer_analytics/frontend/components/Announcements/announcementsLogic.test.ts
index 47092ae3cb26..c9f4997742e1 100644
--- a/products/customer_analytics/frontend/components/Announcements/announcementsLogic.test.ts
+++ b/products/customer_analytics/frontend/components/Announcements/announcementsLogic.test.ts
@@ -164,22 +164,38 @@ describe('announcementsLogic', () => {
expect(logic.values.selectedChannelIds).toEqual(['C9'])
})
- it('treats "my accounts" as the current user and keeps assigned/unassigned mutually exclusive', async () => {
+ it.each([
+ ['assigned', { assignedOnly: true }],
+ ['unassigned', { allRolesUnassigned: true }],
+ ] as const)('maps the %s status to the accounts query', async (status, expectedFilter) => {
+ mockPerformQuery.mockResolvedValue({ columns: ['name', 'slack_channel_id'], results: [] })
+ logic = announcementsLogic()
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.setAssignmentStatus(status)
+ }).toDispatchActions(['loadFilteredAccountChannelsSuccess'])
+
+ expect(mockPerformQuery).toHaveBeenCalledWith(expect.objectContaining(expectedFilter))
+ })
+
+ it('treats "my accounts" as the current user and keeps assignment state canonical', async () => {
mockPerformQuery.mockResolvedValue({ columns: ['name', 'slack_channel_id'], results: [] })
logic = announcementsLogic()
logic.mount()
userLogic.actions.loadUserSuccess({ id: 7, email: '[email protected]' } as UserType)
logic.actions.setMyAccounts(true)
+ expect(logic.values.assignmentStatus).toBe('assigned')
expect(logic.values.assignedTo).toEqual([7])
expect(logic.values.assignedToCurrentUser).toBe(true)
- logic.actions.setAllUnassigned(true)
+ logic.actions.setAssignmentStatus('unassigned')
expect(logic.values.assignedTo).toEqual([])
expect(logic.values.assignedToCurrentUser).toBe(false)
logic.actions.setAssignedTo([9])
- expect(logic.values.allUnassigned).toBe(false)
+ expect(logic.values.assignmentStatus).toBe('assigned')
})
it('does not submit while a send is already in flight', async () => {
diff --git a/products/customer_analytics/frontend/components/Announcements/announcementsLogic.ts b/products/customer_analytics/frontend/components/Announcements/announcementsLogic.ts
index 226fc76e1ace..c73c8694920f 100644
--- a/products/customer_analytics/frontend/components/Announcements/announcementsLogic.ts
+++ b/products/customer_analytics/frontend/components/Announcements/announcementsLogic.ts
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import type { AssignmentStatus } from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
import { userLogic } from 'scenes/userLogic'
@@ -32,11 +33,11 @@ export interface announcementsLogicValues {
user: UserType | null // userLogic
accountSearch: string
accountTags: string[]
- allUnassigned: boolean
announcements: AnnouncementApi[]
announcementsLoading: boolean
assignedTo: number[]
assignedToCurrentUser: boolean
+ assignmentStatus: AssignmentStatus
channelOptions: {
key: string
label: string
@@ -126,12 +127,12 @@ export interface announcementsLogicActions {
setAccountTags: (tags: string[]) => {
tags: string[]
}
- setAllUnassigned: (value: boolean) => {
- value: boolean
- }
setAssignedTo: (userIds: number[]) => {
userIds: number[]
}
+ setAssignmentStatus: (status: AssignmentStatus) => {
+ status: AssignmentStatus
+ }
setMessage: (message: string) => {
message: string
}
@@ -157,12 +158,7 @@ export interface announcementsLogicMeta {
__keaTypeGenInternalSelectorTypes: {
slackConnected: (currentTeam: TeamPublicType | TeamType | null) => boolean
currentUserId: (user: UserType | null) => number | null
- filtersActive: (
- accountSearch: string,
- accountTags: string[],
- allUnassigned: boolean,
- assignedTo: number[]
- ) => boolean
+ filtersActive: (accountSearch: string, accountTags: string[], assignmentStatus: AssignmentStatus) => boolean
assignedToCurrentUser: (assignedTo: number[], currentUserId: number | null) => boolean
filteredChannels: (
memberChannels: AnnouncementChannelApi[],
@@ -216,7 +212,7 @@ export const announcementsLogic = kea<announcementsLogicType>([
setAccountSearch: (search: string) => ({ search }),
setAccountTags: (tags: string[]) => ({ tags }),
setAssignedTo: (userIds: number[]) => ({ userIds }),
- setAllUnassigned: (value: boolean) => ({ value }),
+ setAssignmentStatus: (status: AssignmentStatus) => ({ status }),
setMyAccounts: (value: boolean) => ({ value }),
clearAccountFilters: true,
selectAllFilteredChannels: true,
@@ -271,11 +267,14 @@ export const announcementsLogic = kea<announcementsLogicType>([
if (values.accountTags.length > 0) {
source.tagNames = values.accountTags
}
- if (values.allUnassigned) {
+ if (values.assignmentStatus === 'unassigned') {
source.allRolesUnassigned = true
- }
- if (values.assignedTo.length > 0) {
- source.assignedToUserIds = values.assignedTo
+ } else if (values.assignmentStatus === 'assigned') {
+ if (values.assignedTo.length > 0) {
+ source.assignedToUserIds = values.assignedTo
+ } else {
+ source.assignedOnly = true
+ }
}
const response = await performQuery(source)
breakpoint()
@@ -302,7 +301,7 @@ export const announcementsLogic = kea<announcementsLogicType>([
accountSearch: ['', { setAccountSearch: (_state, { search }) => search }],
accountTags: [[] as string[], { setAccountTags: (_state, { tags }) => tags }],
assignedTo: [[] as number[], { setAssignedTo: (_state, { userIds }) => userIds }],
- allUnassigned: [false, { setAllUnassigned: (_state, { value }) => value }],
+ assignmentStatus: ['all' as AssignmentStatus, { setAssignmentStatus: (_state, { status }) => status }],
}),
selectors({
slackConnected: [
@@ -312,9 +311,9 @@ export const announcementsLogic = kea<announcementsLogicType>([
],
currentUserId: [(s) => [s.user], (user: UserType | null): number | null => user?.id ?? null],
filtersActive: [
- (s) => [s.accountSearch, s.accountTags, s.allUnassigned, s.assignedTo],
- (accountSearch: string, accountTags: string[], allUnassigned: boolean, assignedTo: number[]): boolean =>
- !!accountSearch.trim() || accountTags.length > 0 || allUnassigned || assignedTo.length > 0,
+ (s) => [s.accountSearch, s.accountTags, s.assignmentStatus],
+ (accountSearch: string, accountTags: string[], assignmentStatus: AssignmentStatus): boolean =>
+ !!accountSearch.trim() || accountTags.length > 0 || assignmentStatus !== 'all',
],
assignedToCurrentUser: [
(s) => [s.assignedTo, s.currentUserId],
@@ -392,14 +391,16 @@ export const announcementsLogic = kea<announcementsLogicType>([
},
setAccountTags: () => actions.loadFilteredAccountChannels(null),
setAssignedTo: ({ userIds }) => {
- if (userIds.length > 0 && values.allUnassigned) {
- actions.setAllUnassigned(false)
+ if (userIds.length > 0 && values.assignmentStatus !== 'assigned') {
+ actions.setAssignmentStatus('assigned')
+ return
}
actions.loadFilteredAccountChannels(null)
},
- setAllUnassigned: ({ value }) => {
- if (value && values.assignedTo.length > 0) {
+ setAssignmentStatus: ({ status }) => {
+ if (status !== 'assigned' && values.assignedTo.length > 0) {
actions.setAssignedTo([])
+ return
}
actions.loadFilteredAccountChannels(null)
},
@@ -411,7 +412,7 @@ export const announcementsLogic = kea<announcementsLogicType>([
actions.setAccountSearch('')
actions.setAccountTags([])
actions.setAssignedTo([])
- actions.setAllUnassigned(false)
+ actions.setAssignmentStatus('all')
},
selectAllFilteredChannels: () => {
actions.setSelectedChannelIds([...new Set([...values.selectedChannelIds, ...values.filteredChannelIds])])
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index bf680ce1fe11..86cd560e658b 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -8383,6 +8383,8 @@ export interface AccountsQueryResponseApi {
export interface AccountsQueryApi {
/** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean | null
+ /** Match accounts with at least one active relationship of any definition. */
+ assignedOnly?: boolean | null
/** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: number[] | null
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index dfa375086e75..afff7e59de48 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -7377,6 +7377,8 @@ export interface AccountsQueryResponseApi {
export interface AccountsQueryApi {
/** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean | null
+ /** Match accounts with at least one active relationship of any definition. */
+ assignedOnly?: boolean | null
/** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: number[] | null
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.py
index 6dcc6538155d..b90e7af91771 100644
--- a/products/workflows/backend/api/hog_flow.py
+++ b/products/workflows/backend/api/hog_flow.py
@@ -1212,7 +1212,9 @@ class HogFlowActionSerializer(serializers.Serializer):
"batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts "
"audience fans out one run per customer analytics account and takes account filters instead: "
"properties entries of type 'account_custom_property' (key = definition id), plus "
- "tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. "
+ "tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and "
+ "assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. "
+ "all_roles_unassigned remains accepted for workflows saved before assignment_status was added. "
"function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable "
"hog templating ({person.x}, {event.x}); flat strings won't interpolate. "
"function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open "
diff --git a/products/workflows/backend/services/account_audience.py b/products/workflows/backend/services/account_audience.py
index 46294f66fa35..81f8a458ecba 100644
--- a/products/workflows/backend/services/account_audience.py
+++ b/products/workflows/backend/services/account_audience.py
@@ -2,20 +2,21 @@
The trigger's stored ``filters`` dict is the single source of truth. ``audience_type:
'accounts'`` switches the batch resolver from persons to accounts; the remaining keys
-(``properties`` of account custom property filters, ``tag_names``, ``assigned_to_user_ids``,
-``all_roles_unassigned``) narrow which accounts a firing fans out to.
+(``properties`` of account custom property filters, ``tag_names``, ``assignment_status``, and
+``assigned_to_user_ids``) narrow which accounts a firing fans out to. ``all_roles_unassigned``
+remains accepted for workflows saved before assignment statuses were explicit.
customer_analytics owns the account data but already depends on workflows, so the query
implementation arrives through a provider registered during ``django.setup()``
(``CustomerAnalyticsConfig.ready``) — the same hook inversion warehouse_sources uses.
"""
-from dataclasses import dataclass
-from typing import Any, Protocol
+from typing import Any, Literal, Protocol
from uuid import UUID
from rest_framework import exceptions
+from posthog.dataclasses import frozen
from posthog.models.team.team import Team
ACCOUNT_BATCH_SIZE = 500
@@ -45,7 +46,7 @@ SUPPORTED_CUSTOM_PROPERTY_OPERATORS = frozenset(
_VALUELESS_OPERATORS = frozenset({"is_set", "is_not_set"})
-@dataclass(frozen=True, kw_only=True)
+@frozen
class AccountAudienceCustomPropertyFilter:
"""One custom-property predicate of a batch audience (key = definition id)."""
@@ -54,11 +55,15 @@ class AccountAudienceCustomPropertyFilter:
value: Any = None
-@dataclass(frozen=True, kw_only=True)
+AccountAssignmentStatus = Literal["all", "assigned", "unassigned"]
+
+
+@frozen
class AccountAudienceFilters:
"""Account selection for a batch run; empty filters mean every account with an external_id."""
tag_names: tuple[str, ...] = ()
+ assignment_status: AccountAssignmentStatus | None = None
assigned_to_user_ids: tuple[int, ...] = ()
all_roles_unassigned: bool = False
custom_properties: tuple[AccountAudienceCustomPropertyFilter, ...] = ()
@@ -143,10 +148,33 @@ def parse_account_audience_filters(filters: dict) -> AccountAudienceFilters:
):
raise exceptions.ValidationError({"filters": {"assigned_to_user_ids": "Must be a list of user ids."}})
+ raw_assignment_status = filters.get("assignment_status")
+ assignment_status: AccountAssignmentStatus | None
+ if raw_assignment_status is None:
+ assignment_status = None
+ elif raw_assignment_status in ("all", "assigned", "unassigned"):
+ assignment_status = raw_assignment_status
+ else:
+ raise exceptions.ValidationError(
+ {"filters": {"assignment_status": "Must be 'all', 'assigned', or 'unassigned'."}}
+ )
+
+ all_roles_unassigned = bool(filters.get("all_roles_unassigned"))
+ if assignment_status is not None:
+ if all_roles_unassigned:
+ raise exceptions.ValidationError(
+ {"filters": {"all_roles_unassigned": "Cannot be combined with assignment_status."}}
+ )
+ if assignment_status != "assigned" and assigned_to_user_ids:
+ raise exceptions.ValidationError(
+ {"filters": {"assigned_to_user_ids": "Can only be used with assignment_status 'assigned'."}}
+ )
+
return AccountAudienceFilters(
tag_names=tuple(tag_names),
+ assignment_status=assignment_status,
assigned_to_user_ids=tuple(assigned_to_user_ids),
- all_roles_unassigned=bool(filters.get("all_roles_unassigned")),
+ all_roles_unassigned=all_roles_unassigned,
custom_properties=tuple(custom_properties),
)
diff --git a/products/workflows/backend/test/test_account_audience_filters.py b/products/workflows/backend/test/test_account_audience_filters.py
index 7c12079caaa8..8c2209023b8e 100644
--- a/products/workflows/backend/test/test_account_audience_filters.py
+++ b/products/workflows/backend/test/test_account_audience_filters.py
@@ -18,14 +18,15 @@ class TestParseAccountAudienceFilters(SimpleTestCase):
{"key": str(definition_id), "type": "account_custom_property", "operator": "exact", "value": ["x"]}
],
"tag_names": ["vip"],
+ "assignment_status": "assigned",
"assigned_to_user_ids": [7],
- "all_roles_unassigned": True,
}
)
assert parsed.tag_names == ("vip",)
+ assert parsed.assignment_status == "assigned"
assert parsed.assigned_to_user_ids == (7,)
- assert parsed.all_roles_unassigned is True
+ assert parsed.all_roles_unassigned is False
assert parsed.custom_properties[0].definition_id == definition_id
assert parsed.custom_properties[0].operator == "exact"
assert parsed.custom_properties[0].value == ["x"]
@@ -65,12 +66,41 @@ class TestParseAccountAudienceFilters(SimpleTestCase):
("non_list_tag_names", {"tag_names": "vip"}),
("non_str_tag_entries", {"tag_names": [1]}),
("non_int_user_ids", {"assigned_to_user_ids": ["7"]}),
+ ("invalid_assignment_status", {"assignment_status": "any"}),
+ (
+ "status_with_legacy_unassigned",
+ {"assignment_status": "assigned", "all_roles_unassigned": True},
+ ),
+ (
+ "all_with_assigned_users",
+ {"assignment_status": "all", "assigned_to_user_ids": [7]},
+ ),
+ (
+ "unassigned_with_assigned_users",
+ {"assignment_status": "unassigned", "assigned_to_user_ids": [7]},
+ ),
]
)
def test_malformed_filters_raise(self, _name, overrides):
with self.assertRaises(exceptions.ValidationError):
parse_account_audience_filters({"audience_type": "accounts", **overrides})
+ @parameterized.expand(
+ [
+ ("empty", {}, None, (), False),
+ ("assigned_users", {"assigned_to_user_ids": [7]}, None, (7,), False),
+ ("unassigned", {"all_roles_unassigned": True}, None, (), True),
+ ]
+ )
+ def test_legacy_assignment_filters_round_trip(
+ self, _name, filters, expected_status, expected_user_ids, expected_unassigned
+ ):
+ parsed = parse_account_audience_filters({"audience_type": "accounts", **filters})
+
+ assert parsed.assignment_status == expected_status
+ assert parsed.assigned_to_user_ids == expected_user_ids
+ assert parsed.all_roles_unassigned is expected_unassigned
+
@parameterized.expand(
[
("accounts", {"audience_type": "accounts"}, True),
diff --git a/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButtonLogic.ts b/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButtonLogic.ts
index 29cdf94837b7..0a2764bb49ef 100644
--- a/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButtonLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/HogFlowManualTriggerButtonLogic.ts
@@ -47,6 +47,7 @@ export interface hogFlowManualTriggerButtonLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -55,6 +56,7 @@ export interface hogFlowManualTriggerButtonLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
diff --git a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx
index 3880b97efb52..3196a6c70a26 100644
--- a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx
@@ -755,6 +755,7 @@ export interface hogFlowEditorLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -920,6 +921,7 @@ export interface hogFlowEditorLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -1610,6 +1612,7 @@ export interface hogFlowEditorLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -1775,6 +1778,7 @@ export interface hogFlowEditorLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
diff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts
index ecd8b56122ad..7712d45384a8 100644
--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts
@@ -316,6 +316,7 @@ export interface hogFlowEditorTestLogicMeta {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -448,6 +449,7 @@ export interface hogFlowEditorTestLogicMeta {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx b/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx
index d29730022ce8..e05f884051a3 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/steps/StepTrigger.tsx
@@ -29,8 +29,9 @@ import {
Tooltip,
} from '@posthog/lemon-ui'
+import { AccountAssignmentFilter } from 'lib/components/AccountAssignmentFilter/AccountAssignmentFilter'
+import type { AssignmentStatus } from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
import { CodeSnippet } from 'lib/components/CodeSnippet'
-import { MemberSelectMultiple } from 'lib/components/MemberSelectMultiple'
import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -57,6 +58,7 @@ import { workflowLogic } from '../../workflowLogic'
import { HogFlowEventFilters, WORKFLOW_OPERATOR_ALLOWLIST } from '../filters/HogFlowFilters'
import { TriggerFrequencyOption, getRegisteredTriggerTypes } from '../registry/triggers/triggerTypeRegistry'
import { HogFlowAction } from '../types'
+import { createAccountAssignmentFilterUpdate, parseAccountAssignmentFilter } from './accountAssignmentFilter'
import { batchTriggerLogic, getAudienceDedupeKey, hogFlowSendsEmail } from './batchTriggerLogic'
import { HogFlowFunctionConfiguration } from './components/HogFlowFunctionConfiguration'
import { RecurringSchedulePicker } from './components/RecurringSchedulePicker'
@@ -611,7 +613,11 @@ function StepTriggerBatchAccountFilters({
partialSetWorkflowActionConfig(actionId, { filters: { ...filters, ...update } })
}
- const assignedToUserIds = filters.assigned_to_user_ids ?? []
+ const { status: assignmentStatus, assignedToUserIds } = parseAccountAssignmentFilter(filters)
+
+ const setAssignmentFilter = (status: AssignmentStatus, userIds: number[]): void => {
+ setFilters(createAccountAssignmentFilterUpdate(status, userIds))
+ }
return (
<div className="flex flex-col gap-2">
@@ -631,33 +637,18 @@ function StepTriggerBatchAccountFilters({
placeholder="Filter by tags"
data-attr="workflows-batch-account-tags-filter"
/>
- <LemonDropdown
- closeOnClickInside={false}
- overlay={
- <div className="p-2 min-w-64 flex flex-col gap-2">
- <LemonCheckbox
- checked={!!filters.all_roles_unassigned}
- onChange={(all_roles_unassigned) => setFilters({ all_roles_unassigned })}
- label="Unassigned only"
- data-attr="workflows-batch-account-unassigned-filter"
- />
- <LemonDivider className="my-0" />
- <MemberSelectMultiple
- idKey="id"
- value={assignedToUserIds}
- onChange={(users) => setFilters({ assigned_to_user_ids: users.map((user) => user.id) })}
- />
- </div>
- }
- >
- <LemonButton type="secondary" size="small" data-attr="workflows-batch-account-assigned-filter">
- {filters.all_roles_unassigned
- ? 'Unassigned'
- : assignedToUserIds.length === 0
- ? 'Assigned to anyone'
- : `Assigned to ${assignedToUserIds.length} ${assignedToUserIds.length === 1 ? 'person' : 'people'}`}
- </LemonButton>
- </LemonDropdown>
+ <AccountAssignmentFilter
+ assignedToUserIds={assignedToUserIds}
+ status={assignmentStatus}
+ onAssignedToUserIdsChange={(userIds) => setAssignmentFilter('assigned', userIds)}
+ onStatusChange={(status) => setAssignmentFilter(status, assignedToUserIds)}
+ dataAttrs={{
+ trigger: 'workflows-batch-account-assigned-filter',
+ unassigned: 'workflows-batch-account-unassigned-filter',
+ assigned: 'workflows-batch-account-assigned-status-filter',
+ all: 'workflows-batch-account-all-assignment-filter',
+ }}
+ />
</div>
{customPropertyTaxonomicOptions.length > 0 && (
<PropertyFilters
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/accountAssignmentFilter.test.ts b/products/workflows/frontend/Workflows/hogflows/steps/accountAssignmentFilter.test.ts
new file mode 100644
index 000000000000..724d0fb0f010
--- /dev/null
+++ b/products/workflows/frontend/Workflows/hogflows/steps/accountAssignmentFilter.test.ts
@@ -0,0 +1,30 @@
+import { createAccountAssignmentFilterUpdate, parseAccountAssignmentFilter } from './accountAssignmentFilter'
+
+describe('accountAssignmentFilter', () => {
+ it.each([
+ ['new all status', { assignment_status: 'all' as const }, 'all'],
+ ['new assigned status', { assignment_status: 'assigned' as const }, 'assigned'],
+ ['new unassigned status', { assignment_status: 'unassigned' as const }, 'unassigned'],
+ ['legacy empty filter', {}, 'all'],
+ ['legacy assigned users', { assigned_to_user_ids: [7] }, 'assigned'],
+ ['legacy unassigned filter', { all_roles_unassigned: true }, 'unassigned'],
+ ])('parses %s', (_name, filters, expectedStatus) => {
+ expect(parseAccountAssignmentFilter(filters).status).toBe(expectedStatus)
+ })
+
+ it.each([
+ ['all', [7], { assignment_status: 'all', assigned_to_user_ids: [], all_roles_unassigned: undefined }],
+ [
+ 'assigned',
+ [7],
+ { assignment_status: 'assigned', assigned_to_user_ids: [7], all_roles_unassigned: undefined },
+ ],
+ [
+ 'unassigned',
+ [7],
+ { assignment_status: 'unassigned', assigned_to_user_ids: [], all_roles_unassigned: undefined },
+ ],
+ ] as const)('creates a canonical %s update', (status, assignedToUserIds, expected) => {
+ expect(createAccountAssignmentFilterUpdate(status, [...assignedToUserIds])).toEqual(expected)
+ })
+})
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/accountAssignmentFilter.ts b/products/workflows/frontend/Workflows/hogflows/steps/accountAssignmentFilter.ts
new file mode 100644
index 000000000000..85208709b6fb
--- /dev/null
+++ b/products/workflows/frontend/Workflows/hogflows/steps/accountAssignmentFilter.ts
@@ -0,0 +1,43 @@
+import {
+ type AssignmentStatus,
+ isAssignmentStatus,
+} from 'lib/components/AccountAssignmentFilter/accountAssignmentFilterTypes'
+
+export interface WorkflowAccountAssignmentFilters {
+ assignment_status?: AssignmentStatus
+ assigned_to_user_ids?: number[]
+ all_roles_unassigned?: boolean
+}
+
+export interface WorkflowAccountAssignmentFilterValue {
+ status: AssignmentStatus
+ assignedToUserIds: number[]
+}
+
+export function parseAccountAssignmentFilter(
+ filters: WorkflowAccountAssignmentFilters
+): WorkflowAccountAssignmentFilterValue {
+ const assignedToUserIds = filters.assigned_to_user_ids ?? []
+ // Infer the status without rewriting workflows saved before assignment_status existed.
+ const status = isAssignmentStatus(filters.assignment_status)
+ ? filters.assignment_status
+ : filters.all_roles_unassigned
+ ? 'unassigned'
+ : assignedToUserIds.length > 0
+ ? 'assigned'
+ : 'all'
+
+ return { status, assignedToUserIds }
+}
+
+export function createAccountAssignmentFilterUpdate(
+ status: AssignmentStatus,
+ assignedToUserIds: number[]
+): WorkflowAccountAssignmentFilters {
+ // New edits remove the legacy flag so it cannot conflict with the canonical status.
+ return {
+ assignment_status: status,
+ assigned_to_user_ids: status === 'assigned' ? assignedToUserIds : [],
+ all_roles_unassigned: undefined,
+ }
+}
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts
index ece17568704e..289b7c3b201a 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts
@@ -201,6 +201,7 @@ export interface stepDelayLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -514,6 +515,7 @@ export interface stepDelayLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts
index 49b2dd7d274b..3581b8912674 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts
@@ -126,6 +126,7 @@ export interface stepWaitUntilTimeWindowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -440,6 +441,7 @@ export interface stepWaitUntilTimeWindowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.test.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.test.ts
index 9969051b41db..757363a39e5e 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/types.test.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.test.ts
@@ -42,6 +42,27 @@ describe('HogFlowActionSchema', () => {
expect(result.success).toBe(true)
})
+ it('preserves account assignment status in batch trigger filters', () => {
+ const action = {
+ id: 'trigger_node',
+ name: 'Trigger',
+ type: 'trigger',
+ description: '',
+ config: {
+ type: 'batch',
+ filters: {
+ audience_type: 'accounts',
+ properties: [],
+ assignment_status: 'assigned',
+ },
+ },
+ }
+
+ const result = HogFlowActionSchema.parse(action)
+
+ expect(result).toMatchObject(action)
+ })
+
// A cleared HogFlowDuration input emits just the unit (e.g. "d") and clobbering that with a
// permissive schema lets users activate a wait step with no real timeout, so the workflow could
// wait indefinitely. These cases lock in that only real durations pass.
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.ts
index c215df66e3e7..59eab4276934 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/types.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.ts
@@ -178,6 +178,7 @@ export const HogFlowTriggerSchema = z.discriminatedUnion('type', [
audience_type: z.enum(['persons', 'accounts']).optional(),
properties: z.array(z.any()),
tag_names: z.array(z.string()).optional(),
+ assignment_status: z.enum(['all', 'assigned', 'unassigned']).optional(),
assigned_to_user_ids: z.array(z.number()).optional(),
all_roles_unassigned: z.boolean().optional(),
}),
diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.ts
index a90aba4be914..f095ed33033c 100644
--- a/products/workflows/frontend/Workflows/workflowLogic.ts
+++ b/products/workflows/frontend/Workflows/workflowLogic.ts
@@ -758,6 +758,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -1033,6 +1034,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -1613,6 +1615,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -1888,6 +1891,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -2073,6 +2077,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -2452,6 +2457,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -2778,6 +2784,7 @@ export interface workflowLogicActions {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
@@ -2847,6 +2854,7 @@ export interface workflowLogicMeta {
filters: {
all_roles_unassigned?: boolean | undefined
assigned_to_user_ids?: number[] | undefined
+ assignment_status?: 'all' | 'assigned' | 'unassigned' | undefined
audience_type?: 'accounts' | 'persons' | undefined
properties: any[]
tag_names?: string[] | undefined
diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.ts
index 4ec84cbf90fc..4a110afd032a 100644
--- a/products/workflows/frontend/generated/api.schemas.ts
+++ b/products/workflows/frontend/generated/api.schemas.ts
@@ -455,7 +455,7 @@ export const HogFlowActionTypeEnumApi = {
} as const
/**
- * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
+ * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
*/
export type HogFlowActionApiConfig =
| { [key: string]: unknown }
@@ -516,7 +516,7 @@ export interface HogFlowActionApi {
* * `random_cohort_branch` - random_cohort_branch
* * `exit` - exit */
type: HogFlowActionTypeEnumApi
- /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
+ /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
config: HogFlowActionApiConfig
/** Output variable for downstream actions: {key, result_path?, spread?, label?} or a list of those. */
output_variable?: unknown
diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.ts
index b5682994e814..e9696f9cea65 100644
--- a/products/workflows/frontend/generated/api.zod.ts
+++ b/products/workflows/frontend/generated/api.zod.ts
@@ -771,7 +771,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -1158,7 +1158,7 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -1550,7 +1550,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -2199,7 +2199,7 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
@@ -2885,7 +2885,7 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 966deb4f6d61..5d115aa283f6 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -1451,6 +1451,8 @@ export namespace Schemas {
export interface AccountsQuery {
/** Match accounts with no active relationship of any definition. */
allRolesUnassigned?: boolean | null;
+ /** Match accounts with at least one active relationship of any definition. */
+ assignedOnly?: boolean | null;
/** Match accounts where any of these user ids actively holds any relationship (CSM, Account executive, or a custom definition). Drives the "My accounts" shortcut (the current user's id) and the shareable "Assigned to" filter — the ids are explicit so a shared URL resolves identically for every viewer. */
assignedToUserIds?: number[] | null;
/** Optional HogQL boolean expression AND-ed into the WHERE clause. Used by the overview tile click-to-filter affordance. */
@@ -43671,7 +43673,7 @@ export namespace Schemas {
} as const;
/**
- * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
+ * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.
*/
export type HogFlowActionConfig = { [key: string]: unknown } | {
/** Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout. */
@@ -43730,7 +43732,7 @@ export namespace Schemas {
* * `random_cohort_branch` - random_cohort_branch
* * `exit` - exit */
type: HogFlowActionTypeEnum;
- /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
+ /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */
config: HogFlowActionConfig;
/** Output variable for downstream actions: {key, result_path?, spread?, label?} or a list of those. */
output_variable?: unknown;
diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.ts
index f3f118878399..d1ae149c489e 100644
--- a/services/mcp/src/generated/workflows/api.ts
+++ b/services/mcp/src/generated/workflows/api.ts
@@ -425,7 +425,7 @@ export const HogFlowsCreateBody = () => zod
),
])
.describe(
- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
),
output_variable: zod
.unknown()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
index b340b9ba5bc1..9a402f0d468d 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
@@ -197,7 +197,7 @@
"type": "object"
}
],
- "description": "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
+ "description": "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|internal-event, filters?}. internal-event requires filters.events naming one or more allowed event ids, and runs once for each matching event on the internal-events stream. Runs are person-less, so person-dependent steps are rejected. $slack_message_received takes filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply), and requires an exact-match channel filter; without one it runs on every message in every connected channel. $github_event_received takes filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility), and requires exact-match repository and event_type filters; without them it runs on every delivery from every connected repository. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assignment_status: 'all'|'assigned'|'unassigned', and assigned_to_user_ids: [<int>] when assignment_status is 'assigned'. all_roles_unassigned remains accepted for workflows saved before assignment_status was added. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."
},
"created_at": {
"description": "Created at (epoch ms). Frontend-managed.",