: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 team config + settings UI for messaging engagement events (#50122)
posthog[bot]e001466cc9af
diff --git a/.semgrep/rules/idor-team-scoped-models.yaml b/.semgrep/rules/idor-team-scoped-models.yamlindex ddc8435e6dd1..a0b523285dfd 100644--- a/.semgrep/rules/idor-team-scoped-models.yaml+++ b/.semgrep/rules/idor-team-scoped-models.yaml@@ -131,6 +131,7 @@ rules:|TeamExperimentsConfig|TeamFeatureFlagDefaultsConfig|TeamSessionSummariesConfig+ |TeamWorkflowsConfig|FileSystem|GithubCommentMapping|GitHubSyncConfig@@ -364,6 +365,7 @@ rules:|TeamExperimentsConfig|TeamFeatureFlagDefaultsConfig|TeamSessionSummariesConfig+ |TeamWorkflowsConfig|FileSystem|GithubCommentMapping|GitHubSyncConfigdiff --git a/frontend/src/lib/api.mock.ts b/frontend/src/lib/api.mock.tsindex d60494312631..7fe0f75b980a 100644--- a/frontend/src/lib/api.mock.ts+++ b/frontend/src/lib/api.mock.ts@@ -205,6 +205,9 @@ export const MOCK_DEFAULT_TEAM: TeamType = {subscription_event: {},payment_event: {},} as CustomerAnalyticsConfig,+ workflows_config: {+ capture_workflows_engagement_events: false,+ },base_currency: CurrencyCode.USD,default_evaluation_contexts_enabled: false,managed_viewsets: { revenue_analytics: true },diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 49e5ce482ddc..82ee2517f2d4 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -523,6 +523,7 @@ export const FEATURE_FLAGS = {WEB_ANALYTICS_TILE_TOGGLES: 'web-analytics-tile-toggles', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_TOOLTIP_COMPARISON_LABELS: 'web-analytics-tooltip-comparison-labels', // owner: @lricoy #team-web-analyticsWORKFLOWS_BATCH_TRIGGERS: 'workflows-batch-triggers', // owner: #team-workflows+ WORKFLOWS_ENGAGEMENT_EVENTS: 'workflows-engagement-events', // owner: #team-workflowsWORKFLOWS_INTERNAL_EVENT_FILTERS: 'workflows-internal-event-filters', // owner: @haven #team-workflowsWORKFLOWS_PERSON_TIMEZONE: 'workflows-person-timezone', // owner: #team-workflowsWORKFLOWS_PUSH_NOTIFICATIONS: 'workflows-push-notifications', // owner: @Odin #team-workflowsdiff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex 9e5891e82f76..b99ae0d3521b 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -50,6 +50,7 @@ import { SuppressionRules } from 'products/error_tracking/frontend/scenes/ErrorTimport { LogsAlertingSection } from 'products/logs/frontend/components/LogsAlerting/LogsAlertingSection'import { LogsSamplingSection } from 'products/logs/frontend/components/LogsSampling/LogsSamplingSection'import { LogsFeatureFlagKeys } from 'products/logs/frontend/logsFeatureFlagKeys'+import { WorkflowsEngagementEventsSettings } from 'products/workflows/frontend/scenes/settings/WorkflowsEngagementEventsSettings'import { IntegrationsList } from '../../lib/integrations/IntegrationsList'import {@@ -1230,6 +1231,38 @@ export const SETTINGS_MAP: SettingSection[] = [},],},+ {+ level: 'environment',+ id: 'environment-workflows',+ title: 'Workflows',+ group: 'Products',+ flag: 'WORKFLOWS_ENGAGEMENT_EVENTS',+ settings: [+ {+ id: 'workflows-engagement-events',+ title: 'Engagement events',+ description:+ 'When enabled, email engagement activity (sent, delivered, opened, link clicked, bounced, blocked, failed) is captured as standard PostHog events alongside the existing workflow metrics. This lets you build insights, funnels, and dashboards from workflows data. These events count toward your event usage and are billed like any other event.',+ docsUrl: 'https://posthog.com/docs/workflows/engagement-events',+ component: <WorkflowsEngagementEventsSettings />,+ keywords: [+ 'workflows',+ 'email',+ 'engagement',+ 'events',+ 'capture',+ 'tracking',+ 'sent',+ 'delivered',+ 'opened',+ 'clicked',+ 'bounced',+ 'blocked',+ 'failed',+ ],+ },+ ],+ },{level: 'environment',id: 'environment-access-control',diff --git a/frontend/src/scenes/settings/types.ts b/frontend/src/scenes/settings/types.tsindex 659546d945f9..550c73f6d059 100644--- a/frontend/src/scenes/settings/types.ts+++ b/frontend/src/scenes/settings/types.ts@@ -46,6 +46,7 @@ export type SettingSectionId =| 'environment-secret-api-keys'| 'environment-surveys'| 'environment-web-analytics'+ | 'environment-workflows'| 'environment-danger-zone'// Project (backward compat – remove when Environments are rolled out)| 'project-details'@@ -241,6 +242,7 @@ export type SettingId =| 'web-analytics-pre-aggregated-tables'| 'web-revenue-events'| 'web-vitals-autocapture'+ | 'workflows-engagement-events'type FeatureFlagKey = keyof typeof FEATURE_FLAGSdiff --git a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx b/frontend/src/scenes/team-activity/teamActivityDescriber.tsxindex bdd3ce63e618..e3de890d6a5b 100644--- a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx+++ b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx@@ -752,6 +752,7 @@ const TEAM_PROPERTIES_MAPPING: Record<keyof TeamType, (change: ActivityChange) =web_analytics_pre_aggregated_tables_enabled: () => null,web_analytics_pre_aggregated_tables_version: () => null,managed_viewsets: () => null,+ workflows_config: () => null,}function nameAndLink(logItem?: ActivityLogItem): JSX.Element {diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 4ced2b65d109..b6a760fdc80b 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -798,9 +798,14 @@ export interface TeamType extends TeamBasicType {managed_viewsets: Record<DataWarehouseManagedViewsetKind, boolean>receive_org_level_activity_logs: boolean | nullcustomer_analytics_config: CustomerAnalyticsConfig+ workflows_config: WorkflowsConfigbusiness_model?: 'b2b' | 'b2c' | 'other' | null}+export interface WorkflowsConfig {+ capture_workflows_engagement_events: boolean+}+export interface ProductIntentType {product_type: stringcreated_at: stringdiff --git a/posthog/api/team.py b/posthog/api/team.pyindex ebd41a706ebd..53b14d46c6ba 100644--- a/posthog/api/team.py+++ b/posthog/api/team.py@@ -96,6 +96,7 @@ from products.feature_flags.backend.models.evaluation_context import ()from products.logs.backend.models import TeamLogsConfigfrom products.signals.backend.models import SignalSourceConfig+from products.workflows.backend.models.team_workflows_config import TeamWorkflowsConfigtracer = trace.get_tracer(__name__)@@ -283,6 +284,7 @@ TEAM_CONFIG_FIELDS = ("conversations_enabled","conversations_settings","proactive_tasks_enabled",+ "workflows_config",)TEAM_CONFIG_FIELDS_SET = set(TEAM_CONFIG_FIELDS)@@ -407,6 +409,21 @@ class TeamMarketingAnalyticsConfigSerializer(serializers.ModelSerializer, UserAcreturn instance+class TeamWorkflowsConfigSerializer(serializers.ModelSerializer, UserAccessControlSerializerMixin):+ capture_workflows_engagement_events = serializers.BooleanField(+ required=False,+ help_text=(+ "When enabled, workflows engagement activity (email sends, opens, clicks, bounces, "+ "spam reports, unsubscribes) is captured as standard PostHog events ($workflows_email_*) "+ "alongside the existing workflow metrics."+ ),+ )++ class Meta:+ model = TeamWorkflowsConfig+ fields = ["capture_workflows_engagement_events"]++class TeamCustomerAnalyticsConfigSerializer(serializers.ModelSerializer, UserAccessControlSerializerMixin):activity_event = serializers.JSONField(required=False, help_text="Event used as the activity signal (DAU/WAU/MAU).")signup_pageview_event = serializers.JSONField(@@ -582,6 +599,7 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixinrevenue_analytics_config = TeamRevenueAnalyticsConfigSerializer(required=False)marketing_analytics_config = TeamMarketingAnalyticsConfigSerializer(required=False)customer_analytics_config = TeamCustomerAnalyticsConfigSerializer(required=False)+ workflows_config = TeamWorkflowsConfigSerializer(required=False)base_currency = serializers.ChoiceField(choices=CURRENCY_CODE_CHOICES, default=DEFAULT_CURRENCY)class Meta:@@ -731,6 +749,16 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixinraise exceptions.ValidationError(_format_serializer_errors(serializer.errors))return serializer.validated_data+ @staticmethod+ def validate_workflows_config(value):+ if value is None:+ return None++ serializer = TeamWorkflowsConfigSerializer(data=value)+ if not serializer.is_valid():+ raise exceptions.ValidationError(_format_serializer_errors(serializer.errors))+ return serializer.validated_data+@staticmethoddef validate_session_recording_linked_flag(value) -> dict | None:if value is None:@@ -1269,6 +1297,9 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixinif config_data := validated_data.pop("customer_analytics_config", None):self._update_customer_analytics_config(instance, config_data)+ if config_data := validated_data.pop("workflows_config", None):+ self._update_workflows_config(instance, config_data)+if "session_recording_retention_period" in validated_data:self._verify_update_session_recording_retention_period(instance, validated_data["session_recording_retention_period"]@@ -1491,6 +1522,28 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixinself._capture_diff(instance, "customer_analytics_config", old_config, new_config)return instance+ def _update_workflows_config(self, instance: Team, validated_data: dict[str, Any]) -> Team:+ old_config = {+ field: getattr(instance.workflows_config, field) for field in TeamWorkflowsConfigSerializer.Meta.fields+ }++ serializer = TeamWorkflowsConfigSerializer(+ instance.workflows_config,+ data=validated_data,+ partial=True,+ context={**self.context, "user_access_control": self.user_access_control},+ )+ if not serializer.is_valid():+ raise serializers.ValidationError(_format_serializer_errors(serializer.errors))++ serializer.save()++ new_config = {+ field: getattr(instance.workflows_config, field) for field in TeamWorkflowsConfigSerializer.Meta.fields+ }+ self._capture_diff(instance, "workflows_config", old_config, new_config)+ return instance+def _verify_update_session_recording_retention_period(self, instance: Team, new_retention_period: str):retention_feature = instance.organization.get_available_feature(AvailableFeature.SESSION_REPLAY_DATA_RETENTION)highest_retention_entitlement = parse_feature_to_entitlement(retention_feature)diff --git a/posthog/models/scoping/baseline_unmigrated.txt b/posthog/models/scoping/baseline_unmigrated.txtindex e642b97f47e7..eeba7d215f99 100644--- a/posthog/models/scoping/baseline_unmigrated.txt+++ b/posthog/models/scoping/baseline_unmigrated.txt@@ -167,6 +167,7 @@ TaskRunTeamConversationsTeamsConfigTeamFeatureFlagDefaultsConfigTeamSessionSummariesConfig+TeamWorkflowsConfigTextThresholdTicketdiff --git a/posthog/models/team/team.py b/posthog/models/team/team.pyindex f382861bbfc8..da3f1711e67a 100644--- a/posthog/models/team/team.py+++ b/posthog/models/team/team.py@@ -732,6 +732,12 @@ class Team(UUIDTClassicModel):self, TeamCustomerAnalyticsConfig, defaults={"activity_event": DEFAULT_ACTIVITY_EVENT})+ @cached_property+ def workflows_config(self):+ from products.workflows.backend.models.team_workflows_config import TeamWorkflowsConfig++ return get_or_create_team_extension(self, TeamWorkflowsConfig)+@propertydef default_modifiers(self) -> dict:modifiers = HogQLQueryModifiers()diff --git a/products/workflows/backend/migrations/0008_teamworkflowsconfig.py b/products/workflows/backend/migrations/0008_teamworkflowsconfig.pynew file mode 100644index 000000000000..d751f6135610--- /dev/null+++ b/products/workflows/backend/migrations/0008_teamworkflowsconfig.py@@ -0,0 +1,27 @@+import django.db.models.deletion+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("posthog", "1178_datadeletionrequest_person_properties"),+ ("workflows", "0007_migrate_hog_flow_models"),+ ]++ operations = [+ migrations.CreateModel(+ name="TeamWorkflowsConfig",+ fields=[+ (+ "team",+ models.OneToOneField(+ on_delete=django.db.models.deletion.CASCADE,+ primary_key=True,+ serialize=False,+ to="posthog.team",+ ),+ ),+ ("capture_workflows_engagement_events", models.BooleanField(default=False)),+ ],+ ),+ ]diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txtindex 94bb3e7dff70..c91fcd8e0f1d 100644--- a/products/workflows/backend/migrations/max_migration.txt+++ b/products/workflows/backend/migrations/max_migration.txt@@ -1 +1 @@-0007_migrate_hog_flow_models+0008_teamworkflowsconfigdiff --git a/products/workflows/backend/models/__init__.py b/products/workflows/backend/models/__init__.pyindex f1fe3d358c67..6cd2675c3b85 100644--- a/products/workflows/backend/models/__init__.py+++ b/products/workflows/backend/models/__init__.py@@ -1,5 +1,6 @@from .hog_flow.hog_flow import HogFlowfrom .hog_flow.hog_flow_template import HogFlowTemplatefrom .hog_flow_batch_job import HogFlowBatchJob+from .team_workflows_config import TeamWorkflowsConfig-__all__ = ["HogFlow", "HogFlowBatchJob", "HogFlowTemplate"]+__all__ = ["HogFlow", "HogFlowBatchJob", "HogFlowTemplate", "TeamWorkflowsConfig"]diff --git a/products/workflows/backend/models/team_workflows_config.py b/products/workflows/backend/models/team_workflows_config.pynew file mode 100644index 000000000000..3edc28ebf8d4--- /dev/null+++ b/products/workflows/backend/models/team_workflows_config.py@@ -0,0 +1,19 @@+import logging++from django.db import models++from posthog.models.team import Team+from posthog.models.team.extensions import register_team_extension_signal++logger = logging.getLogger(__name__)+++class TeamWorkflowsConfig(models.Model):+ team = models.OneToOneField(Team, on_delete=models.CASCADE, primary_key=True)++ # Opt-in toggle for emitting workflows engagement activity (sends, opens, clicks, bounces, etc.)+ # as standard PostHog events alongside the existing workflow metrics.+ capture_workflows_engagement_events = models.BooleanField(default=False)+++register_team_extension_signal(TeamWorkflowsConfig, logger=logger)diff --git a/products/workflows/backend/test/test_team_workflows_config.py b/products/workflows/backend/test/test_team_workflows_config.pynew file mode 100644index 000000000000..3c2245afbf4a--- /dev/null+++ b/products/workflows/backend/test/test_team_workflows_config.py@@ -0,0 +1,72 @@+from posthog.test.base import APIBaseTest++from rest_framework import status++from posthog.models import OrganizationMembership++from products.workflows.backend.models.team_workflows_config import TeamWorkflowsConfig+++class TestTeamWorkflowsConfig(APIBaseTest):+ """End-to-end coverage of the ``workflows_config`` nested field on the team API.++ Mirrors the pattern used for other team-extension configs (e.g. customer_analytics_config,+ session_replay_config) so that future regressions in the diff / update plumbing get caught+ on the team API path rather than only by the plugin-server consumer of the config.+ """++ def setUp(self) -> None:+ super().setUp()+ self.organization_membership.level = OrganizationMembership.Level.ADMIN+ self.organization_membership.save()+ self.url = f"/api/environments/{self.team.id}/"++ def test_defaults_to_capture_disabled_when_no_extension_row_exists(self) -> None:+ response = self.client.get(self.url)+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["workflows_config"] == {"capture_workflows_engagement_events": False}++ def test_patch_enables_capture(self) -> None:+ # APIBaseTest.setUp may trigger the workflows_config cached_property (which calls+ # get_or_create_team_extension) so the extension row can already exist with the default+ # value. Either way, the patch must end with the row present and capture enabled.+ response = self.client.patch(self.url, {"workflows_config": {"capture_workflows_engagement_events": True}})+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["workflows_config"] == {"capture_workflows_engagement_events": True}++ row = TeamWorkflowsConfig.objects.get(team=self.team)+ assert row.capture_workflows_engagement_events is True++ def test_patch_can_toggle_capture_back_off(self) -> None:+ self.client.patch(self.url, {"workflows_config": {"capture_workflows_engagement_events": True}})+ response = self.client.patch(self.url, {"workflows_config": {"capture_workflows_engagement_events": False}})++ assert response.status_code == status.HTTP_200_OK+ assert response.json()["workflows_config"] == {"capture_workflows_engagement_events": False}+ assert TeamWorkflowsConfig.objects.get(team=self.team).capture_workflows_engagement_events is False++ def test_patch_with_other_team_fields_does_not_disturb_workflows_config(self) -> None:+ self.client.patch(self.url, {"workflows_config": {"capture_workflows_engagement_events": True}})++ response = self.client.patch(self.url, {"name": "renamed team"})+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["workflows_config"] == {"capture_workflows_engagement_events": True}+ assert TeamWorkflowsConfig.objects.get(team=self.team).capture_workflows_engagement_events is True++ def test_patch_rejects_non_boolean_capture_workflows_engagement_events(self) -> None:+ response = self.client.patch(+ self.url, {"workflows_config": {"capture_workflows_engagement_events": "yes please"}}+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ # DRF nested-serializer validation surfaces the inner field path, not the parent name.+ assert response.json()["attr"] == "workflows_config__capture_workflows_engagement_events"++ def test_patch_ignores_unknown_keys_in_workflows_config(self) -> None:+ # ModelSerializer silently drops fields not in Meta.fields — this regression-tests that+ # behaviour so we notice if a future serializer change starts rejecting unknown keys+ # (which would break clients that send forward-compatible payloads).+ response = self.client.patch(+ self.url, {"workflows_config": {"capture_workflows_engagement_events": True, "future_flag": "ignored"}}+ )+ assert response.status_code == status.HTTP_200_OK+ assert response.json()["workflows_config"] == {"capture_workflows_engagement_events": True}diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsxindex c5bf26ac574a..38ac291ca8f4 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx@@ -1,10 +1,15 @@-import { useValues } from 'kea'+import { useActions, useValues } from 'kea'import { useEffect } from 'react'-import { Spinner } from '@posthog/lemon-ui'+import { IconCheck } from '@posthog/icons'+import { LemonBanner, LemonButton, Link, Spinner } from '@posthog/lemon-ui'import { CyclotronJobInputs } from 'lib/components/CyclotronJob/CyclotronJobInputs'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { templateToConfiguration } from 'scenes/hog-functions/configuration/hogFunctionConfigurationLogic'+import { teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'import { CyclotronJobInputType, HogFunctionMappingType } from '~/types'@@ -27,8 +32,14 @@ export function HogFlowFunctionConfiguration({errors?: Record<string, string>}): JSX.Element {const { workflow, hogFunctionTemplatesById, hogFunctionTemplatesByIdLoading } = useValues(workflowLogic)+ const { currentTeam, currentTeamLoading } = useValues(teamLogic)+ const { updateCurrentTeam } = useActions(teamLogic)+ const { featureFlags } = useValues(featureFlagLogic)const template = hogFunctionTemplatesById[templateId]+ const isEmailStep = templateId === 'template-email'+ const engagementEventsAvailable = !!featureFlags[FEATURE_FLAGS.WORKFLOWS_ENGAGEMENT_EVENTS]+ const engagementEventsEnabled = !!currentTeam?.workflows_config?.capture_workflows_engagement_eventsuseEffect(() => {// oxlint-disable-next-line exhaustive-depsif (template && Object.keys(inputs ?? {}).length === 0) {@@ -120,6 +131,63 @@ export function HogFlowFunctionConfiguration({sampleGlobalsWithInputs={sampleGlobals}onInputChange={(key, value) => setInputs({ ...inputs, [key]: value })}/>+ {isEmailStep && engagementEventsAvailable ? (+ engagementEventsEnabled ? (+ <div className="flex items-center gap-1.5 mt-2 text-xs text-muted-alt">+ <IconCheck className="text-success text-base" />+ <span>Email engagement is being captured as PostHog events.</span>+ <Link+ to={urls.settings('environment-workflows', 'workflows-engagement-events')}+ target="_blank"+ >+ Manage in settings+ </Link>+ </div>+ ) : (+ <LemonBanner type="info" hideIcon className="mt-2">+ <div className="flex flex-col gap-2">+ <span className="text-xs">+ Email engagement (sends, opens, clicks, bounces) is recorded as workflow metrics. You+ can also capture these as standard PostHog events for use in insights and funnels. They+ count toward your event usage and are billed like any other event.+ </span>+ <div className="flex items-center gap-2">+ <LemonButton+ type="primary"+ size="xsmall"+ loading={currentTeamLoading}+ onClick={() =>+ updateCurrentTeam({+ workflows_config: {+ ...currentTeam?.workflows_config,+ capture_workflows_engagement_events: true,+ },+ })+ }+ >+ Enable engagement events+ </LemonButton>+ <LemonButton+ type="tertiary"+ size="xsmall"+ to={urls.settings('environment-workflows', 'workflows-engagement-events')}+ targetBlank+ >+ Manage in settings+ </LemonButton>+ <LemonButton+ type="tertiary"+ size="xsmall"+ to="https://posthog.com/docs/workflows/engagement-events"+ targetBlank+ >+ Learn more+ </LemonButton>+ </div>+ </div>+ </LemonBanner>+ )+ ) : null}<HogFlowFunctionMappingsuseMapping={Array.isArray(mappings) || (template?.mapping_templates?.length ?? 0) > 0}inputs={inputs}diff --git a/products/workflows/frontend/scenes/settings/WorkflowsEngagementEventsSettings.tsx b/products/workflows/frontend/scenes/settings/WorkflowsEngagementEventsSettings.tsxnew file mode 100644index 000000000000..bb3a40cfeb8e--- /dev/null+++ b/products/workflows/frontend/scenes/settings/WorkflowsEngagementEventsSettings.tsx@@ -0,0 +1,30 @@+import { useActions, useValues } from 'kea'++import { LemonSwitch } from '@posthog/lemon-ui'++import { teamLogic } from 'scenes/teamLogic'++export function WorkflowsEngagementEventsSettings(): JSX.Element {+ const { currentTeam, currentTeamLoading } = useValues(teamLogic)+ const { updateCurrentTeam } = useActions(teamLogic)++ const enabled = !!currentTeam?.workflows_config?.capture_workflows_engagement_events++ return (+ <LemonSwitch+ id="workflows-capture-engagement-events"+ onChange={(checked) => {+ updateCurrentTeam({+ workflows_config: {+ ...currentTeam?.workflows_config,+ capture_workflows_engagement_events: checked,+ },+ })+ }}+ checked={enabled}+ disabled={currentTeamLoading}+ label="Capture email engagement events"+ bordered+ />+ )+}diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 76257b98db15..ed07953050c5 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -32410,6 +32410,11 @@ export namespace Schemas {account_group_type_index?: number | null;}+ export interface TeamWorkflowsConfig {+ /** When enabled, workflows engagement activity (email sends, opens, clicks, bounces, spam reports, unsubscribes) is captured as standard PostHog events ($workflows_email_*) alongside the existing workflow metrics. */+ capture_workflows_engagement_events?: boolean;+ }+export interface PatchedTeam {readonly id?: number;readonly uuid?: string;@@ -32579,6 +32584,7 @@ export namespace Schemas {conversations_settings?: unknown;/** @nullable */proactive_tasks_enabled?: boolean | null;+ workflows_config?: TeamWorkflowsConfig;readonly effective_membership_level?: EffectiveMembershipLevelEnum;readonly has_group_types?: boolean;readonly group_types?: readonly PatchedTeamGroupTypesItem[];@@ -39555,6 +39561,7 @@ export namespace Schemas {conversations_settings?: unknown;/** @nullable */proactive_tasks_enabled?: boolean | null;+ workflows_config?: TeamWorkflowsConfig;readonly effective_membership_level: EffectiveMembershipLevelEnum;readonly has_group_types: boolean;readonly group_types: readonly TeamGroupTypesItem[];