:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): add a cohort membership trigger type (#116922)
Harley Alexanderf3722a585dfa
diff --git a/nodejs/src/cdp/schema/hogflow.ts b/nodejs/src/cdp/schema/hogflow.tsindex 6f8c8b81a2e4..f5a262099462 100644--- a/nodejs/src/cdp/schema/hogflow.ts+++ b/nodejs/src/cdp/schema/hogflow.ts@@ -69,6 +69,11 @@ const HogFlowTriggerSchema = z.discriminatedUnion('type', [z.object({type: z.literal('schedule'),}),+ z.object({+ type: z.literal('cohort'),+ cohort_id: z.number(),+ transition: z.enum(['entered', 'left']),+ }),z.object({type: z.literal('batch'),filters: z.object({diff --git a/products/cdp/backend/presentation/hog_functions.py b/products/cdp/backend/presentation/hog_functions.pyindex 93f9c92cf6b1..915b9106498d 100644--- a/products/cdp/backend/presentation/hog_functions.py+++ b/products/cdp/backend/presentation/hog_functions.py@@ -18,4 +18,5 @@ from products.cdp.backend.flag_gated_templates import (from products.cdp.backend.validation import (build_html_wrap_design as build_html_wrap_design,generate_template_bytecode as generate_template_bytecode,+ validate_realtime_cohorts as validate_realtime_cohorts,)diff --git a/products/cdp/backend/validation.py b/products/cdp/backend/validation.pyindex cb22cb4bbe78..319daa526f91 100644--- a/products/cdp/backend/validation.py+++ b/products/cdp/backend/validation.py@@ -1,6 +1,7 @@import reimport jsonimport logging+from collections.abc import Iterablefrom typing import Any, Optionalfrom django.db import models@@ -1209,11 +1210,9 @@ class HogFunctionFiltersSerializer(serializers.Serializer):return datadef _validate_realtime_cohorts(self, data: dict, team: Team) -> set[int]:- """A cohort without maintained cohort_membership rows would evaluate everyone as a non-member.+ """Validate every cohort these filters reference, including inside referenced Actions.Returns the validated ids so the compiler can reject any IN COHORT operand outside them.- Error messages carry the id rather than the name: they surface to callers holding only- workflow scopes, and a name would hand them a cohort-metadata oracle."""collected = set(filter_cohort_ids(data))action_ids = filter_action_ids(data)@@ -1222,25 +1221,33 @@ class HogFunctionFiltersSerializer(serializers.Serializer):for action in Action.objects.filter(id__in=action_ids, team__project_id=team.project_id, deleted=False):for step in action.steps:collected |= collect_property_cohort_ids(step.properties or [])- cohort_ids = sorted(collected)- if not cohort_ids:- return set()-- cohorts = {cohort.pk: cohort for cohort in Cohort.objects.filter(pk__in=cohort_ids, team=team, deleted=False)}- for cohort_id in cohort_ids:- cohort = cohorts.get(cohort_id)- if cohort is None:- raise serializers.ValidationError(f"Cohort {cohort_id} doesn't exist in this environment.")- if cohort.is_static:- raise serializers.ValidationError(- f"Cohort {cohort_id} is a static cohort. Conditions can only use realtime cohorts."- )- if not cohort.is_flag_compatible:- raise serializers.ValidationError(- f"Cohort {cohort_id} isn't ready for realtime evaluation. "- f"Conditions can only use realtime cohorts that have finished calculating."- )- return set(cohort_ids)+ validate_realtime_cohorts(collected, team)+ return collected+++def validate_realtime_cohorts(cohort_ids: Iterable[int], team: Team) -> None:+ """Reject any cohort without maintained cohort_membership rows, which would treat everyone as a non-member.++ Error messages carry the id rather than the name: they surface to callers holding only workflow+ scopes, and a name would hand them a cohort-metadata oracle.+ """+ ids = sorted(set(cohort_ids))+ if not ids:+ return+ cohorts = {cohort.pk: cohort for cohort in Cohort.objects.filter(pk__in=ids, team=team, deleted=False)}+ for cohort_id in ids:+ cohort = cohorts.get(cohort_id)+ if cohort is None:+ raise serializers.ValidationError(f"Cohort {cohort_id} doesn't exist in this environment.")+ if cohort.is_static:+ raise serializers.ValidationError(+ f"Cohort {cohort_id} is a static cohort. Workflows can only use realtime cohorts."+ )+ if not cohort.is_flag_compatible:+ raise serializers.ValidationError(+ f"Cohort {cohort_id} isn't ready for realtime evaluation. "+ f"Workflows can only use realtime cohorts that have finished calculating."+ )class FunctionInputsSerializer(serializers.Serializer):diff --git a/products/workflows/backend/facade/workflows.py b/products/workflows/backend/facade/workflows.pyindex 890772c1cf7b..7bf186c2d79f 100644--- a/products/workflows/backend/facade/workflows.py+++ b/products/workflows/backend/facade/workflows.py@@ -3,6 +3,7 @@ each with its secret inputs masked."""from products.workflows.backend.models.hog_flow.hog_flow import (BILLABLE_ACTION_TYPES,+ COHORT_TRIGGER_TRANSITIONS,PERSON_DEPENDENT_ACTION_TYPES,ROW_SCOPED_TRIGGER_TYPES,SUPPORTED_ACTION_TYPES,@@ -24,6 +25,7 @@ from products.workflows.backend.services.hog_flow_reads import (__all__ = ["BILLABLE_ACTION_TYPES",+ "COHORT_TRIGGER_TRANSITIONS","PERSON_DEPENDENT_ACTION_TYPES","ROW_SCOPED_TRIGGER_TYPES","SUPPORTED_ACTION_TYPES",diff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.pyindex 071bdae91ca8..839dc80a49da 100644--- a/products/workflows/backend/models/hog_flow/hog_flow.py+++ b/products/workflows/backend/models/hog_flow/hog_flow.py@@ -60,9 +60,13 @@ TRIGGER_TYPES: Final[frozenset[str]] = frozenset("data-warehouse-table","data-warehouse-view","internal-event",+ "cohort",})+# Membership changes a cohort trigger can start a run on.+COHORT_TRIGGER_TRANSITIONS: Final[tuple[str, ...]] = ("entered", "left")+# The internal events a workflow may subscribe to. The internal-events stream carries payloads# that each owning product gates behind its own scopes — recording content, exception detail,# activity detail, alert bodies — while starting a workflow needs only hog_flow:write. Andiff --git a/products/workflows/backend/presentation/views/hog_flow.py b/products/workflows/backend/presentation/views/hog_flow.pyindex dfc8449ac95e..05c23eebe5ab 100644--- a/products/workflows/backend/presentation/views/hog_flow.py+++ b/products/workflows/backend/presentation/views/hog_flow.py@@ -93,6 +93,7 @@ from products.cdp.backend.presentation.hog_functions import (filter_action_ids,filter_cohort_ids,gated_template_enabled,+ validate_realtime_cohorts,)from products.cdp.backend.presentation.hog_invocations.cancel import (HogInvocationCancelRequestSerializer,@@ -264,6 +265,7 @@ from products.workflows.backend.facade.validation import (from products.workflows.backend.facade.workflows import (BILLABLE_ACTION_TYPES,BROADCAST_STATUSES,+ COHORT_TRIGGER_TRANSITIONS,PERSON_DEPENDENT_ACTION_TYPES,ROW_SCOPED_TRIGGER_TYPES,SUPPORTED_ACTION_TYPES,@@ -1317,6 +1319,23 @@ class HogFlowActionSerializer(serializers.Serializer):except Exception:return False+ def _validate_cohort_trigger(self, action: dict) -> None:+ config = action.get("config") or {}+ cohort_id = config.get("cohort_id")+ if isinstance(cohort_id, bool) or not isinstance(cohort_id, int):+ raise serializers.ValidationError({"cohort_id": "Choose a cohort for this trigger."})+ if config.get("transition") not in COHORT_TRIGGER_TRANSITIONS:+ raise serializers.ValidationError({"transition": "Must be 'entered' or 'left'."})+ # The flag polices new adoption only, so an active flow keeps saving after a dial-down.+ stored = (self.context.get("stored_cohort_triggers") or {}).get(action.get("id"))+ unchanged = stored == {"cohort_id": cohort_id, "transition": config.get("transition")}+ if not unchanged and not self._cohort_conditions_enabled():+ raise serializers.ValidationError({"type": "Cohort triggers aren't available for this organization."})+ try:+ validate_realtime_cohorts([cohort_id], self.context["get_team"]())+ except serializers.ValidationError as error:+ raise serializers.ValidationError({"cohort_id": error.detail})+def _reject_behavioral_cohorts_in_audience(self, properties) -> None:# Batch/schedule audiences resolve offline by precalculated membership and can't evaluate event# behavior the way it's intended; the UI hides behavioral cohorts from the audience picker. Mirror@@ -1486,6 +1505,9 @@ class HogFlowActionSerializer(serializers.Serializer):data["config"]["filters"] = serializer.validated_dataelif not is_draft:raise serializers.ValidationError({"filters": _EVENT_TRIGGER_NEEDS_A_TARGET})+ elif data.get("config", {}).get("type") == "cohort":+ if strict:+ self._validate_cohort_trigger(data)elif data.get("config", {}).get("type") == "batch":filters = data.get("config", {}).get("filters", {})if strict:@@ -2910,6 +2932,18 @@ class HogFlowSerializer(HogFlowMinimalSerializer):and (action.get("config") or {}).get("template_id") in FLAG_GATED_TEMPLATE_IDS}+ self.context["stored_cohort_triggers"] = {+ action["id"]: {+ "cohort_id": (action.get("config") or {}).get("cohort_id"),+ "transition": (action.get("config") or {}).get("transition"),+ }+ for action in ((instance.actions if instance and instance.status == HogFlow.State.ACTIVE else None) or [])+ if isinstance(action, dict)+ and action.get("id")+ and action.get("type") == "trigger"+ and (action.get("config") or {}).get("type") == "cohort"+ }+self.context["stored_cohort_conditions"] = {action["id"]: [_authored_condition(stored_condition)diff --git a/products/workflows/backend/presentation/views/hog_flow_template.py b/products/workflows/backend/presentation/views/hog_flow_template.pyindex 3a7db1dacc58..91321c9e12aa 100644--- a/products/workflows/backend/presentation/views/hog_flow_template.py+++ b/products/workflows/backend/presentation/views/hog_flow_template.py@@ -105,6 +105,9 @@ class HogFlowTemplateActionSerializer(serializers.Serializer):elif trigger_type == "schedule":# The schedule itself lives on a separate row, so the trigger carries nothing to validate.pass+ elif trigger_type == "cohort":+ # The cohort is checked when a workflow made from this template goes live.+ passelif trigger_type in ["event", "internal-event"]:filters = data.get("config", {}).get("filters", {})if filters:diff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.pyindex 3d078763df2e..a26d90f9ff17 100644--- a/products/workflows/backend/tests/api/test_hog_flow.py+++ b/products/workflows/backend/tests/api/test_hog_flow.py@@ -1906,6 +1906,84 @@ class TestHogFlowAPI(APIBaseTest):assert new_adoption.status_code == 400, new_adoption.json()assert "Cohort membership can't be evaluated" in new_adoption.json()["detail"]+ def _cohort_trigger_flow(self, config: dict) -> dict:+ return {+ "name": "Cohort trigger flow",+ "status": "active",+ "actions": [+ {"id": "trigger_node", "name": "trigger_1", "type": "trigger", "config": {"type": "cohort", **config}}+ ],+ }++ @parameterized.expand([("entered",), ("left",)])+ @patch("products.workflows.backend.presentation.views.hog_flow.feature_enabled_or_false", return_value=True)+ def test_hog_flow_saves_cohort_trigger_on_realtime_cohort(self, transition, _mock_flag):+ cohort = self._create_behavioral_cohort(CohortType.REALTIME, backfilled=True)++ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_flows",+ self._cohort_trigger_flow({"cohort_id": cohort.id, "transition": transition}),+ )++ assert response.status_code == 201, response.json()+ assert response.json()["trigger"] == {"type": "cohort", "cohort_id": cohort.id, "transition": transition}++ @parameterized.expand(+ [+ ("missing_cohort_id", "realtime", {"transition": "entered"}, True, "Choose a cohort"),+ ("unknown_transition", "realtime", {"transition": "joined"}, True, "Must be 'entered' or 'left'"),+ ("flag_off", "realtime", {"transition": "entered"}, False, "Cohort triggers aren't available"),+ ("static_cohort", "static", {"transition": "entered"}, True, "is a static cohort"),+ ("not_backfilled", "realtime_unbackfilled", {"transition": "entered"}, True, "isn't ready"),+ ]+ )+ def test_hog_flow_rejects_invalid_cohort_trigger(self, _name, cohort_kind, config, flag_on, expected_error):+ if cohort_kind == "static":+ cohort = Cohort.objects.create(team=self.team, name="static-cohort", is_static=True)+ else:+ cohort = self._create_behavioral_cohort(CohortType.REALTIME, backfilled=cohort_kind == "realtime")+ if _name != "missing_cohort_id":+ config = {**config, "cohort_id": cohort.id}++ with patch(+ "products.workflows.backend.presentation.views.hog_flow.feature_enabled_or_false", return_value=flag_on+ ):+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", self._cohort_trigger_flow(config))++ assert response.status_code == 400, response.json()+ assert expected_error in response.json()["detail"]++ def test_hog_flow_grandfathers_stored_cohort_trigger_after_flag_dial_down(self):+ cohort = self._create_behavioral_cohort(CohortType.REALTIME, backfilled=True)+ other_cohort = self._create_behavioral_cohort(CohortType.REALTIME, backfilled=True)+ with patch(+ "products.workflows.backend.presentation.views.hog_flow.feature_enabled_or_false", return_value=True+ ):+ created = self.client.post(+ f"/api/projects/{self.team.id}/hog_flows",+ self._cohort_trigger_flow({"cohort_id": cohort.id, "transition": "entered"}),+ )+ assert created.status_code == 201, created.json()+ flow_id = created.json()["id"]+ stored_actions = created.json()["actions"]++ with patch(+ "products.workflows.backend.presentation.views.hog_flow.feature_enabled_or_false", return_value=False+ ):+ resave = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}",+ {"name": "renamed", "actions": stored_actions},+ )+ assert resave.status_code == 200, resave.json()++ edited_actions = deepcopy(stored_actions)+ edited_actions[0]["config"]["cohort_id"] = other_cohort.id+ new_adoption = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}", {"actions": edited_actions}+ )+ assert new_adoption.status_code == 400, new_adoption.json()+ assert "Cohort triggers aren't available" in new_adoption.json()["detail"]+@parameterized.expand([("expression_only", False),diff --git a/products/workflows/backend/tests/api/test_hog_flow_template.py b/products/workflows/backend/tests/api/test_hog_flow_template.pyindex e385ee83cfbc..7313bc5d56a7 100644--- a/products/workflows/backend/tests/api/test_hog_flow_template.py+++ b/products/workflows/backend/tests/api/test_hog_flow_template.py@@ -251,6 +251,7 @@ class TestHogFlowTemplateAPI(APIBaseTest):@parameterized.expand([("schedule", {"type": "schedule"}, 201),+ ("cohort", {"type": "cohort", "cohort_id": 1, "transition": "entered"}, 201),("slack_message",{diff --git a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsxindex 413e6a83be18..ccebc3e197ab 100644--- a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx+++ b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx@@ -821,6 +821,11 @@ export interface hogFlowEditorLogicActions {}type: 'batch'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -987,6 +992,11 @@ export interface hogFlowEditorLogicActions {}type: 'batch'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -1686,6 +1696,11 @@ export interface hogFlowEditorLogicActions {}type: 'batch'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -1852,6 +1867,11 @@ export interface hogFlowEditorLogicActions {}type: 'batch'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.tsindex 724eae28bdff..637b296f098b 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts@@ -367,6 +367,11 @@ export interface hogFlowEditorTestLogicMeta {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -496,6 +501,11 @@ export interface hogFlowEditorTestLogicMeta {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -629,6 +639,11 @@ export interface hogFlowEditorTestLogicMeta {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -758,6 +773,11 @@ export interface hogFlowEditorTestLogicMeta {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/cohort.tsx b/products/workflows/frontend/Workflows/hogflows/registry/triggers/cohort.tsxnew file mode 100644index 000000000000..b54dfa2f57eb--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/cohort.tsx@@ -0,0 +1,92 @@+import { useActions, useValues } from 'kea'+import { useEffect } from 'react'++import { IconPeople } from '@posthog/icons'+import { LemonSegmentedButton } from '@posthog/lemon-ui'++import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'+import { TaxonomicPopover } from 'lib/components/TaxonomicPopover/TaxonomicPopover'+import { LemonField } from 'lib/lemon-ui/LemonField'++import { cohortsModel } from '~/models/cohortsModel'++import { registerTriggerType } from 'products/workflows/frontend/Workflows/hogflows/registry/triggers/triggerTypeRegistry'+import { workflowLogic } from 'products/workflows/frontend/Workflows/workflowLogic'++import { HogFlowAction } from '../../types'++export type CohortTriggerConfig = Extract<Extract<HogFlowAction, { type: 'trigger' }>['config'], { type: 'cohort' }>++export function isCohortTriggerConfig(+ config: Extract<HogFlowAction, { type: 'trigger' }>['config']+): config is CohortTriggerConfig {+ return config.type === 'cohort'+}++function StepTriggerConfigurationCohort({ node }: { node: any }): JSX.Element {+ const { setWorkflowActionConfig } = useActions(workflowLogic)+ const { actionValidationErrorsById } = useValues(workflowLogic)+ const { cohortsById } = useValues(cohortsModel)+ const { loadCohortsByIds } = useActions(cohortsModel)++ const config = node.data.config as CohortTriggerConfig+ const validationResult = actionValidationErrorsById[node.data.id]++ useEffect(() => {+ if (config.cohort_id) {+ loadCohortsByIds({ ids: [config.cohort_id] })+ }+ }, [config.cohort_id, loadCohortsByIds])++ return (+ <div className="flex flex-col gap-2 w-full">+ <p className="mb-0 text-sm text-muted-alt">+ This workflow runs for a person when they join or leave the selected cohort. Only realtime cohorts that+ have finished calculating can start a workflow.+ </p>+ <LemonField.Pure label="Cohort" error={validationResult?.errors?.cohort_id}>+ <TaxonomicPopover+ groupType={TaxonomicFilterGroupType.Cohorts}+ value={config.cohort_id}+ onChange={(cohortId) =>+ setWorkflowActionConfig(node.data.id, { ...config, cohort_id: Number(cohortId) })+ }+ renderValue={(cohortId) => <>{cohortsById[cohortId]?.name ?? `Cohort ${cohortId}`}</>}+ placeholder="Choose a cohort"+ data-attr="workflow-cohort-trigger-cohort"+ />+ </LemonField.Pure>+ <LemonField.Pure label="Start the workflow when a person">+ <LemonSegmentedButton+ value={config.transition}+ onChange={(transition) => setWorkflowActionConfig(node.data.id, { ...config, transition })}+ options={[+ { value: 'entered', label: 'Joins the cohort' },+ { value: 'left', label: 'Leaves the cohort' },+ ]}+ data-attr="workflow-cohort-trigger-transition"+ />+ </LemonField.Pure>+ </div>+ )+}++registerTriggerType({+ value: 'cohort',+ label: 'Cohort membership',+ icon: <IconPeople />,+ description: 'Trigger when a person joins or leaves a cohort',+ featureFlag: 'workflows-cohort-conditions',+ matchConfig: (config) => isCohortTriggerConfig(config),+ buildConfig: () => ({ type: 'cohort', cohort_id: null, transition: 'entered' }),+ validate: (config): { valid: boolean; errors: Record<string, string> } | null => {+ if (config.type !== 'cohort') {+ return null+ }+ if (!config.cohort_id) {+ return { valid: false, errors: { cohort_id: 'Choose a cohort' } }+ }+ return { valid: true, errors: {} }+ },+ ConfigComponent: StepTriggerConfigurationCohort,+})diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.tsindex f8a22b21afcf..c53688b6b0d8 100644--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.ts+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.ts@@ -1,3 +1,4 @@+import './cohort'import './conversations'import './customer_analytics'import './data_warehouse_table'diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.tsindex b31782d37a71..aaadc2fd86b6 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts@@ -265,6 +265,11 @@ export interface stepDelayLogicActions {| undefinedmax_delay_duration?: string | undefined}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {inputs: Record<string,@@ -528,6 +533,11 @@ export interface stepDelayLogicActions {}type: 'batch'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {condition: {filters?:diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.tsindex 943e20296f02..075e5a60b6ee 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts@@ -191,6 +191,11 @@ export interface stepWaitUntilTimeWindowLogicActions {| undefinedmax_delay_duration?: string | undefined}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {inputs: Record<string,@@ -455,6 +460,11 @@ export interface stepWaitUntilTimeWindowLogicActions {}type: 'batch'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {condition: {filters?:diff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.tsindex a975deb1db88..70ca44740c2e 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/types.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.ts@@ -172,6 +172,12 @@ export const HogFlowTriggerSchema = z.discriminatedUnion('type', [z.object({type: z.literal('schedule'),}),+ z.object({+ type: z.literal('cohort'),+ // Null until a cohort is picked. The backend requires one before the workflow runs.+ cohort_id: z.number().nullable(),+ transition: z.enum(['entered', 'left']),+ }),z.object({type: z.literal('batch'),filters: z.object({diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.tsindex 4703dea2605c..fa6718729a1e 100644--- a/products/workflows/frontend/Workflows/workflowLogic.ts+++ b/products/workflows/frontend/Workflows/workflowLogic.ts@@ -864,6 +864,11 @@ export interface workflowLogicActions {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -1140,6 +1145,11 @@ export interface workflowLogicActions {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -1729,6 +1739,11 @@ export interface workflowLogicActions {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -2005,6 +2020,11 @@ export interface workflowLogicActions {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined@@ -2235,6 +2255,11 @@ export interface workflowLogicActions {| undefinedmax_delay_duration?: string | undefined}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {inputs: Record<string,@@ -2626,6 +2651,11 @@ export interface workflowLogicActions {| undefinedmax_delay_duration?: string | undefined}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {inputs: Record<string,@@ -2996,6 +3026,11 @@ export interface workflowLogicMeta {}type: 'internal-event'}+ | {+ cohort_id: number | null+ transition: 'entered' | 'left'+ type: 'cohort'+ }| {filters: {properties?: any[] | undefined