: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 the api trigger and transactional email workflows (#117663)
Harley Alexander836a3ea9bbe3
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.tsindex 35955192ca5a..80e434766f5d 100644--- a/products/desktop/packages/api-client/src/generated.ts+++ b/products/desktop/packages/api-client/src/generated.ts@@ -15396,8 +15396,12 @@ export namespace Schemas {/*** * `loops` - Loops* * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails*/- export type HogFlowOriginProductEnum = "loops" | "broadcasts";+ export type HogFlowOriginProductEnum =+ | "loops"+ | "broadcasts"+ | "transactional_emails";export type HogFlowMasking = {ttl?: (number | null) | undefined;threshold?: (number | null) | undefined;@@ -15820,6 +15824,7 @@ export namespace Schemas {** * `loops` - Loops* * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails*/origin_product: HogFlowOriginProductEnum | NullEnum;created_at: string;@@ -22298,7 +22303,7 @@ export namespace Endpoints {limit: number;offset: number;optimization_enabled: boolean;- origin_product: "broadcasts" | "loops";+ origin_product: "broadcasts" | "loops" | "transactional_emails";search: string;status: "active" | "archived" | "draft";trigger: string;diff --git a/products/workflows/backend/facade/contracts.py b/products/workflows/backend/facade/contracts.pyindex 332b4bf859da..f55652bcba8b 100644--- a/products/workflows/backend/facade/contracts.py+++ b/products/workflows/backend/facade/contracts.py@@ -488,6 +488,29 @@ class WorkflowRef:has_email_step: bool+@frozen+class TransactionalEmailContent:+ """What a transactional email's workflow sends, taken from the message template it was made from."""++ message_template_id: UUID+ name: str+ subject: str+ preheader: str+ html: str+ text: str+ # None uses the project's default sender on create, and keeps the workflow's sender on update.+ from_integration_id: int | None+ message_category_id: UUID | None+++class TransactionalEmailSenderUnavailable(Exception):+ """No verified email sender: neither the requested one nor the project's default."""+++class TransactionalEmailContentInvalid(Exception):+ """The content has no subject or no body, so the workflow could not send it."""++class WorkflowNotFound(Exception):passdiff --git a/products/workflows/backend/facade/enums.py b/products/workflows/backend/facade/enums.pyindex 3e8ddbd14167..eaa447ae190c 100644--- a/products/workflows/backend/facade/enums.py+++ b/products/workflows/backend/facade/enums.py@@ -78,6 +78,7 @@ class HogFlowOriginProduct(LabeledStrEnum):LOOPS = "loops", "Loops"BROADCASTS = "broadcasts", "Broadcasts"+ TRANSACTIONAL_EMAILS = "transactional_emails", "Transactional emails"class HogFlowEmailSendingPausedBy(LabeledStrEnum):diff --git a/products/workflows/backend/facade/transactional_emails.py b/products/workflows/backend/facade/transactional_emails.pynew file mode 100644index 000000000000..fd1036a81b88--- /dev/null+++ b/products/workflows/backend/facade/transactional_emails.py@@ -0,0 +1,21 @@+"""Transactional emails: a message template made sendable over the API, backed by a one-step workflow."""++from products.workflows.backend.facade.contracts import (+ TransactionalEmailContent,+ TransactionalEmailContentInvalid,+ TransactionalEmailSenderUnavailable,+ WorkflowNotFound,+)+from products.workflows.backend.services.transactional_email_workflows import (+ create_transactional_email_workflow,+ update_transactional_email_workflow,+)++__all__ = [+ "TransactionalEmailContent",+ "TransactionalEmailContentInvalid",+ "TransactionalEmailSenderUnavailable",+ "WorkflowNotFound",+ "create_transactional_email_workflow",+ "update_transactional_email_workflow",+]diff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.pyindex 839dc80a49da..553c2c98d042 100644--- a/products/workflows/backend/models/hog_flow/hog_flow.py+++ b/products/workflows/backend/models/hog_flow/hog_flow.py@@ -52,6 +52,8 @@ SUPPORTED_ACTION_TYPES: Final[list[str]] = [TRIGGER_TYPES: Final[frozenset[str]] = frozenset({"event",+ # A transactional email: one authenticated API call runs the workflow once.+ "api","schedule","manual","batch",diff --git a/products/workflows/backend/presentation/views/hog_flow.py b/products/workflows/backend/presentation/views/hog_flow.pyindex b10138dbe14f..f2a890f702d3 100644--- a/products/workflows/backend/presentation/views/hog_flow.py+++ b/products/workflows/backend/presentation/views/hog_flow.py@@ -1654,6 +1654,10 @@ class HogFlowActionSerializer(serializers.Serializer):parse_account_audience_filters(filters)else:self._reject_behavioral_cohorts_in_audience(filters.get("properties"))+ elif data.get("config", {}).get("type") == "api":+ # A transactional email's trigger: the authenticated send endpoint runs the workflow once+ # per call, so the trigger has nothing to configure.+ passelif data.get("config", {}).get("type") == "schedule":# The schedule definition lives on a separate HogFlowSchedule row, but a schedule trigger# resolves the same offline audience as batch — guard its cohort refs the same way.diff --git a/products/workflows/backend/services/hog_flow_reads.py b/products/workflows/backend/services/hog_flow_reads.pyindex c9b11f77e960..9ee32e2bd9e6 100644--- a/products/workflows/backend/services/hog_flow_reads.py+++ b/products/workflows/backend/services/hog_flow_reads.py@@ -387,10 +387,11 @@ def _to_workflow(# by surface in the UI (see WorkflowTypeTag), so returning it under `messaging` would contradict the# tag on the row. Accepting several lets a list say which surfaces it covers, which is how the# workflows page asks for everything except the ones that moved out.-WORKFLOW_TYPES: Final[tuple[str, ...]] = ("messaging", "automation", "loop", "broadcast")+WORKFLOW_TYPES: Final[tuple[str, ...]] = ("messaging", "automation", "loop", "broadcast", "transactional_email")OWNED_WORKFLOW_TYPES: Final[dict[str, str]] = {"loop": HogFlow.OriginProduct.LOOPS,"broadcast": HogFlow.OriginProduct.BROADCASTS,+ "transactional_email": HogFlow.OriginProduct.TRANSACTIONAL_EMAILS,}diff --git a/products/workflows/backend/services/transactional_email_workflows.py b/products/workflows/backend/services/transactional_email_workflows.pynew file mode 100644index 000000000000..729b4b239023--- /dev/null+++ b/products/workflows/backend/services/transactional_email_workflows.py@@ -0,0 +1,170 @@+"""A transactional email is a workflow that one authenticated API call runs once: an `api` trigger, one email step+and an exit. The message template it was made from owns the content, so each content change writes a new version+of the workflow through the same write path as the workflows UI, with its revision history."""++from typing import Optional+from uuid import UUID++from django.db import transaction++from posthog.models.integration import Integration+from posthog.models.scoping import with_team_scope++from products.workflows.backend.facade.contracts import (+ TransactionalEmailContent,+ TransactionalEmailContentInvalid,+ TransactionalEmailSenderUnavailable,+ WorkflowNotFound,+)+from products.workflows.backend.facade.enums import HogFlowOriginProduct+from products.workflows.backend.models import HogFlow, TeamWorkflowsConfig+from products.workflows.backend.services.hog_flow_writes import create_workflow, update_workflow++TRIGGER_ACTION_ID = "trigger_node"+# Engagement tracking and message assets key on this id, so it stays stable across versions.+EMAIL_ACTION_ID = "transactional_email"+EXIT_ACTION_ID = "exit_node"++# The send endpoint passes the recipient as an event property. Liquid output is never parsed again, so an+# address that contains Liquid markup is sent as typed. `raw` skips the HTML escaping that would turn a+# valid address like o'[email protected] into a different one.+RECIPIENT_EXPRESSION = "{{ event.properties.to | raw }}"+++def transactional_email_actions(content: TransactionalEmailContent, from_integration_id: int) -> list[dict]:+ return [+ {+ "id": TRIGGER_ACTION_ID,+ "name": "Trigger",+ "description": "",+ "type": "trigger",+ "config": {"type": "api"},+ },+ {+ "id": EMAIL_ACTION_ID,+ "name": content.name,+ "description": "",+ "type": "function_email",+ # Nothing comes after the email, so a failed send must fail the run.+ "on_error": "abort",+ "config": {+ "template_id": "template-email",+ # Provenance only: the body below is set, so a save never re-reads the template.+ "template_uuid": str(content.message_template_id),+ "message_category_id": str(content.message_category_id) if content.message_category_id else None,+ # Puts the send on the email queue's fast lane and skips marketing opt-outs.+ "message_category_type": "transactional",+ "inputs": {+ "email": {+ "templating": "liquid",+ "value": {+ "to": {"email": RECIPIENT_EXPRESSION, "name": ""},+ "from": {"integrationId": from_integration_id},+ "replyTo": "",+ "cc": "",+ "bcc": "",+ "subject": content.subject,+ "preheader": content.preheader,+ "text": content.text,+ "html": content.html,+ },+ }+ },+ },+ },+ {+ "id": EXIT_ACTION_ID,+ "name": "Exit",+ "description": "",+ "type": "exit",+ "config": {"reason": "Default exit"},+ },+ ]+++def _content_fields(content: TransactionalEmailContent, from_integration_id: int) -> dict:+ if not content.subject or not (content.html or content.text):+ raise TransactionalEmailContentInvalid()+ actions = transactional_email_actions(content, from_integration_id)+ return {+ "name": content.name,+ "actions": actions,+ "edges": [+ {"from": TRIGGER_ACTION_ID, "to": EMAIL_ACTION_ID, "type": "continue"},+ {"from": EMAIL_ACTION_ID, "to": EXIT_ACTION_ID, "type": "continue"},+ ],+ # The API serializer derives these two from the actions on every save.+ "trigger": actions[0]["config"],+ "billable_action_types": ["function_email"],+ }+++def _verified_sender(team_id: int, requested_id: int | None) -> int:+ # A fresh read: Team.workflows_config is memoized for the whole process.+ sender_id = requested_id or (+ TeamWorkflowsConfig.objects.filter(team_id=team_id)+ .values_list("default_email_integration_id", flat=True)+ .first()+ )+ sender = Integration.objects.filter(team_id=team_id, kind="email", id=sender_id).first() if sender_id else None+ if sender is None or not sender.config.get("verified"):+ raise TransactionalEmailSenderUnavailable()+ return sender.id+++def _current_sender(flow: HogFlow) -> int | None:+ # The email step is missing when someone edited the workflow directly. The update writes it back.+ email = next((action for action in flow.actions if action.get("id") == EMAIL_ACTION_ID), None)+ if email is None:+ return None+ return email["config"]["inputs"]["email"]["value"]["from"].get("integrationId")+++# Callers run outside a workflows request, so the revision writes need the team scope set here.+@with_team_scope()+def create_transactional_email_workflow(+ *, team_id: int, user_id: Optional[int], content: TransactionalEmailContent+) -> UUID:+ from_integration_id = _verified_sender(team_id, content.from_integration_id)+ result = create_workflow(+ team_id=team_id,+ user_id=user_id,+ validated_data={+ **_content_fields(content, from_integration_id),+ "status": HogFlow.State.ACTIVE,+ "origin_product": HogFlowOriginProduct.TRANSACTIONAL_EMAILS,+ "exit_condition": "exit_only_at_end",+ },+ )+ return UUID(str(result.current["id"]))+++@with_team_scope()+def update_transactional_email_workflow(+ *, team_id: int, user_id: Optional[int], hog_flow_id: UUID, content: TransactionalEmailContent+) -> None:+ with transaction.atomic():+ # The lock keeps the status read here current, so update_workflow can't find it changed.+ flow = (+ HogFlow.objects.select_for_update()+ .only("status", "actions")+ .filter(team_id=team_id, pk=hog_flow_id)+ .first()+ )+ if flow is None:+ raise WorkflowNotFound()+ if content.from_integration_id:+ from_integration_id = _verified_sender(team_id, content.from_integration_id)+ else:+ from_integration_id = _current_sender(flow) or _verified_sender(team_id, None)+ update_workflow(+ team_id=team_id,+ user_id=user_id,+ hog_flow_id=hog_flow_id,+ validated_data=_content_fields(content, from_integration_id),+ route_to_draft=False,+ base_updated_at=None,+ base_live_updated_at=None,+ includes_staged_draft=False,+ validated_status=flow.status,+ )diff --git a/products/workflows/backend/test/test_transactional_email_workflows.py b/products/workflows/backend/test/test_transactional_email_workflows.pynew file mode 100644index 000000000000..227ab83e7d6b--- /dev/null+++ b/products/workflows/backend/test/test_transactional_email_workflows.py@@ -0,0 +1,164 @@+from copy import deepcopy+from uuid import uuid4++from posthog.test.base import BaseTest++from parameterized import parameterized++from posthog.models import Team+from posthog.models.integration import Integration++from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES+from products.cdp.backend.templates.hog_function_template import sync_template_to_db+from products.workflows.backend.facade.api import set_default_email_sender_if_unset+from products.workflows.backend.facade.contracts import (+ TransactionalEmailContent,+ TransactionalEmailContentInvalid,+ TransactionalEmailSenderUnavailable,+ WorkflowNotFound,+)+from products.workflows.backend.facade.transactional_emails import (+ create_transactional_email_workflow,+ update_transactional_email_workflow,+)+from products.workflows.backend.models.hog_flow.hog_flow import HogFlow+from products.workflows.backend.models.hog_flow_revision import HogFlowRevision+from products.workflows.backend.presentation.views.hog_flow import HogFlowSerializer+++def _content(+ subject: str = "Reset your password",+ from_integration_id: int | None = None,+ html: str = "<a href='{{ variables.link }}'>Reset</a>",+ text: str = "Reset: {{ variables.link }}",+) -> TransactionalEmailContent:+ return TransactionalEmailContent(+ message_template_id=uuid4(),+ name="Password reset",+ subject=subject,+ preheader="",+ html=html,+ text=text,+ from_integration_id=from_integration_id,+ message_category_id=None,+ )+++class TestTransactionalEmailWorkflows(BaseTest):+ def setUp(self):+ super().setUp()+ template = dict(MOCK_NODE_TEMPLATES[0])+ template["id"] = "template-email"+ template["inputs_schema"] = [+ {"key": "email", "type": "native_email", "label": "Email", "required": True, "templating": "liquid"}+ ]+ sync_template_to_db(template)+ self.sender = Integration.objects.create(+ team=self.team, kind="email", integration_id="[email protected]", config={"verified": True}+ )+ set_default_email_sender_if_unset(self.team.id, self.sender.id)++ def test_a_content_change_writes_a_new_version_and_keeps_the_email_live(self):+ flow_id = create_transactional_email_workflow(team_id=self.team.id, user_id=self.user.id, content=_content())++ update_transactional_email_workflow(+ team_id=self.team.id,+ user_id=self.user.id,+ hog_flow_id=flow_id,+ content=_content(subject="New subject"),+ )++ flow = HogFlow.objects.get(id=flow_id)+ assert flow.status == HogFlow.State.ACTIVE+ assert flow.origin_product == "transactional_emails"+ assert flow.version == 2+ email = flow.actions[1]["config"]["inputs"]["email"]["value"]+ assert email["subject"] == "New subject"+ assert email["from"] == {"integrationId": self.sender.id}+ versions = (+ HogFlowRevision.objects.for_team(self.team.id)+ .filter(hog_flow=flow)+ .order_by("version")+ .values_list("version", flat=True)+ )+ assert list(versions) == [1, 2]++ def test_the_stored_workflow_passes_the_workflows_api_validation(self):+ flow = HogFlow.objects.get(+ id=create_transactional_email_workflow(team_id=self.team.id, user_id=self.user.id, content=_content())+ )++ serializer = HogFlowSerializer(+ data=deepcopy({"name": flow.name, "status": "active", "actions": flow.actions, "edges": flow.edges}),+ context={"team_id": self.team.id, "get_team": lambda: self.team, "is_draft": False},+ )++ assert serializer.is_valid(), serializer.errors+ assert serializer.validated_data["trigger"] == flow.trigger == {"type": "api"}+ assert serializer.validated_data["billable_action_types"] == flow.billable_action_types++ @parameterized.expand([("unverified_default", False, None), ("another_teams_sender", True, "other")])+ def test_a_new_transactional_email_needs_a_verified_sender_of_its_own(self, _name, verified, requested):+ self.sender.config = {"verified": verified}+ self.sender.save()+ requested_id = None+ if requested == "other":+ requested_id = self._other_teams_sender()++ with self.assertRaises(TransactionalEmailSenderUnavailable):+ create_transactional_email_workflow(+ team_id=self.team.id, user_id=self.user.id, content=_content(from_integration_id=requested_id)+ )++ assert not HogFlow.objects.filter(team_id=self.team.id).exists()++ def test_an_update_cannot_switch_to_another_teams_sender(self):+ flow_id = create_transactional_email_workflow(team_id=self.team.id, user_id=self.user.id, content=_content())++ with self.assertRaises(TransactionalEmailSenderUnavailable):+ update_transactional_email_workflow(+ team_id=self.team.id,+ user_id=self.user.id,+ hog_flow_id=flow_id,+ content=_content(from_integration_id=self._other_teams_sender()),+ )++ assert HogFlow.objects.get(id=flow_id).version == 1++ @parameterized.expand([("no_subject", {"subject": ""}), ("no_body", {"html": "", "text": ""})])+ def test_content_that_cannot_send_is_refused(self, _name, overrides):+ with self.assertRaises(TransactionalEmailContentInvalid):+ create_transactional_email_workflow(+ team_id=self.team.id, user_id=self.user.id, content=_content(**overrides)+ )++ assert not HogFlow.objects.filter(team_id=self.team.id).exists()++ def test_an_update_restores_an_email_step_removed_from_the_workflow(self):+ flow_id = create_transactional_email_workflow(team_id=self.team.id, user_id=self.user.id, content=_content())+ flow = HogFlow.objects.get(id=flow_id)+ flow.actions = [action for action in flow.actions if action["type"] != "function_email"]+ flow.save()++ update_transactional_email_workflow(+ team_id=self.team.id, user_id=self.user.id, hog_flow_id=flow_id, content=_content(subject="New subject")+ )++ email = HogFlow.objects.get(id=flow_id).actions[1]["config"]["inputs"]["email"]["value"]+ assert email["subject"] == "New subject"+ assert email["from"] == {"integrationId": self.sender.id}++ def _other_teams_sender(self) -> int:+ other_team = Team.objects.create(organization=self.organization, name="Other")+ return Integration.objects.create(+ team=other_team, kind="email", integration_id="[email protected]", config={"verified": True}+ ).id++ def test_updating_a_deleted_transactional_email_says_it_is_gone(self):+ flow_id = create_transactional_email_workflow(team_id=self.team.id, user_id=self.user.id, content=_content())+ HogFlow.objects.filter(id=flow_id).delete()++ with self.assertRaises(WorkflowNotFound):+ update_transactional_email_workflow(+ team_id=self.team.id, user_id=self.user.id, hog_flow_id=flow_id, content=_content()+ )diff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.pyindex 3c36885e2b8c..d30696a57264 100644--- a/products/workflows/backend/tests/api/test_hog_flow.py+++ b/products/workflows/backend/tests/api/test_hog_flow.py@@ -411,6 +411,7 @@ class TestHogFlowAPI(APIBaseTest):("automation", "automation", {"Webhook sync"}),("loop", "loop", {"Loop with email action"}),("broadcast", "broadcast", {"Announcement"}),+ ("transactional_email", "transactional_email", {"Password reset"}),# What the workflows page sends: everything except the surfaces with their own page.("everything_but_broadcasts",@@ -461,6 +462,13 @@ class TestHogFlowAPI(APIBaseTest):origin_product="broadcasts",actions=[{"id": "a", "type": "function_email", "config": {}}],)+ HogFlow.objects.create(+ team=self.team,+ name="Password reset",+ created_by=self.user,+ origin_product="transactional_emails",+ actions=[{"id": "a", "type": "function_email", "config": {}}],+ )response = self.client.get(f"/api/projects/{self.team.id}/hog_flows?type={workflow_type}")assert response.status_code == 200, response.json()diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.tsindex d324208aacc1..5cc707b7db04 100644--- a/products/workflows/frontend/generated/api.schemas.ts+++ b/products/workflows/frontend/generated/api.schemas.ts@@ -329,12 +329,14 @@ export const HogFlowStateEnumApi = {/*** * `loops` - Loops* * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails*/export type HogFlowOriginProductEnumApi = (typeof HogFlowOriginProductEnumApi)[keyof typeof HogFlowOriginProductEnumApi]export const HogFlowOriginProductEnumApi = {Loops: 'loops',Broadcasts: 'broadcasts',+ TransactionalEmails: 'transactional_emails',} as const/**@@ -676,7 +678,8 @@ export interface HogFlowApi {/** Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.** * `loops` - Loops- * * `broadcasts` - Broadcasts */+ * * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails */origin_product?: HogFlowOriginProductEnumApi | nullreadonly created_at: stringreadonly created_by: UserBasicApi@@ -777,7 +780,8 @@ export interface HogFlowUpdateApi {/** Product surface that owns this workflow. This value cannot change after creation.** * `loops` - Loops- * * `broadcasts` - Broadcasts */+ * * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails */readonly origin_product: HogFlowOriginProductEnumApi | nullreadonly created_at: stringreadonly created_by: UserBasicApi@@ -878,7 +882,8 @@ export interface PatchedHogFlowUpdateApi {/** Product surface that owns this workflow. This value cannot change after creation.** * `loops` - Loops- * * `broadcasts` - Broadcasts */+ * * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails */readonly origin_product?: HogFlowOriginProductEnumApi | nullreadonly created_at?: stringreadonly created_by?: UserBasicApi@@ -2484,6 +2489,7 @@ export type HogFlowsListOriginProduct = (typeof HogFlowsListOriginProduct)[keyofexport const HogFlowsListOriginProduct = {Broadcasts: 'broadcasts',Loops: 'loops',+ TransactionalEmails: 'transactional_emails',} as constexport type HogFlowsListStatus = (typeof HogFlowsListStatus)[keyof typeof HogFlowsListStatus]diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.tsindex 81c724f2a05b..f8907c2ebf73 100644--- a/products/workflows/frontend/generated/api.zod.ts+++ b/products/workflows/frontend/generated/api.zod.ts@@ -539,12 +539,16 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod),origin_product: zod.union([- zod.enum(['loops', 'broadcasts']).describe('\* `loops` - Loops\n\* `broadcasts` - Broadcasts'),+ zod+ .enum(['loops', 'broadcasts', 'transactional_emails'])+ .describe(+ '\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'+ ),zod.null(),]).optional().describe(- 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts'+ 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'),trigger_masking: zod.union([@@ -1947,12 +1951,16 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({),origin_product: zod.union([- zod.enum(['loops', 'broadcasts']).describe('\* `loops` - Loops\n\* `broadcasts` - Broadcasts'),+ zod+ .enum(['loops', 'broadcasts', 'transactional_emails'])+ .describe(+ '\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'+ ),zod.null(),]).optional().describe(- 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts'+ 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'),created_at: zod.iso.datetime({ offset: true }),created_by: zod.object({@@ -2829,12 +2837,16 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod),origin_product: zod.union([- zod.enum(['loops', 'broadcasts']).describe('\* `loops` - Loops\n\* `broadcasts` - Broadcasts'),+ zod+ .enum(['loops', 'broadcasts', 'transactional_emails'])+ .describe(+ '\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'+ ),zod.null(),]).optional().describe(- 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts'+ 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'),trigger_masking: zod.union([diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 253c50269035..83986a7d8a18 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -55023,6 +55023,7 @@ export namespace Schemas {/*** * `loops` - Loops* * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails*/export type HogFlowOriginProductEnum = typeof HogFlowOriginProductEnum[keyof typeof HogFlowOriginProductEnum];@@ -55030,6 +55031,7 @@ export namespace Schemas {export const HogFlowOriginProductEnum = {Loops: 'loops',Broadcasts: 'broadcasts',+ TransactionalEmails: 'transactional_emails',} as const;export interface HogFlowMasking {@@ -55347,7 +55349,8 @@ export namespace Schemas {/** Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.** * `loops` - Loops- * * `broadcasts` - Broadcasts */+ * * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails */origin_product?: HogFlowOriginProductEnum | null;readonly created_at: string;readonly created_by: UserBasic;@@ -55924,7 +55927,8 @@ export namespace Schemas {/** Product surface that owns this workflow. This value cannot change after creation.** * `loops` - Loops- * * `broadcasts` - Broadcasts */+ * * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails */readonly origin_product: HogFlowOriginProductEnum | null;readonly created_at: string;readonly created_by: UserBasic;@@ -81846,7 +81850,8 @@ export namespace Schemas {/** Product surface that owns this workflow. This value cannot change after creation.** * `loops` - Loops- * * `broadcasts` - Broadcasts */+ * * `broadcasts` - Broadcasts+ * * `transactional_emails` - Transactional emails */readonly origin_product?: HogFlowOriginProductEnum | null;readonly created_at?: string;readonly created_by?: UserBasic;@@ -125644,6 +125649,7 @@ export namespace Schemas {export const HogFlowsListOriginProduct = {Broadcasts: 'broadcasts',Loops: 'loops',+ TransactionalEmails: 'transactional_emails',} as const;export type HogFlowsListStatus = typeof HogFlowsListStatus[keyof typeof HogFlowsListStatus];diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.tsindex 23f2b67d808d..7238f543a335 100644--- a/services/mcp/src/generated/workflows/api.ts+++ b/services/mcp/src/generated/workflows/api.ts@@ -36,7 +36,7 @@ export const HogFlowsListQueryParams = () => zod.object({offset: zod.number().optional().describe('The initial index from which to return the results.'),optimization_enabled: zod.boolean().optional().describe('Only workflows someone turned suggestions on for.'),origin_product: zod- .enum(['broadcasts', 'loops'])+ .enum(['broadcasts', 'loops', 'transactional_emails']).optional().describe('Filter to workflows owned by a product surface, e.g. `loops` for Desktop loops.'),search: zod@@ -106,12 +106,16 @@ export const HogFlowsCreateBody = () => zod),origin_product: zod.union([- zod.enum(['loops', 'broadcasts']).describe('\* `loops` - Loops\n\* `broadcasts` - Broadcasts'),+ zod+ .enum(['loops', 'broadcasts', 'transactional_emails'])+ .describe(+ '\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'+ ),zod.null(),]).optional().describe(- 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts'+ 'Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n\* `loops` - Loops\n\* `broadcasts` - Broadcasts\n\* `transactional_emails` - Transactional emails'),trigger_masking: zod.union([diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/broadcasts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/broadcasts-create.jsonindex e6f682ac2fd9..9b26929fee3a 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/broadcasts-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/broadcasts-create.json@@ -544,15 +544,15 @@"origin_product": {"anyOf": [{- "description": "* `loops` - Loops\n* `broadcasts` - Broadcasts",- "enum": ["loops", "broadcasts"],+ "description": "* `loops` - Loops\n* `broadcasts` - Broadcasts\n* `transactional_emails` - Transactional emails",+ "enum": ["loops", "broadcasts", "transactional_emails"],"type": "string"},{"type": "null"}],- "description": "Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n* `loops` - Loops\n* `broadcasts` - Broadcasts"+ "description": "Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n* `loops` - Loops\n* `broadcasts` - Broadcasts\n* `transactional_emails` - Transactional emails"},"status": {"description": "draft (no execution), active (live), archived (disabled).\n\n* `draft` - Draft\n* `active` - Active\n* `archived` - Archived",diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.jsonindex e6f682ac2fd9..9b26929fee3a 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json@@ -544,15 +544,15 @@"origin_product": {"anyOf": [{- "description": "* `loops` - Loops\n* `broadcasts` - Broadcasts",- "enum": ["loops", "broadcasts"],+ "description": "* `loops` - Loops\n* `broadcasts` - Broadcasts\n* `transactional_emails` - Transactional emails",+ "enum": ["loops", "broadcasts", "transactional_emails"],"type": "string"},{"type": "null"}],- "description": "Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n* `loops` - Loops\n* `broadcasts` - Broadcasts"+ "description": "Product surface that owns this workflow (e.g. `loops` for Desktop loops). Set only when creating a workflow. Filter the list with `?origin_product=`.\n\n* `loops` - Loops\n* `broadcasts` - Broadcasts\n* `transactional_emails` - Transactional emails"},"status": {"description": "draft (no execution), active (live), archived (disabled).\n\n* `draft` - Draft\n* `active` - Active\n* `archived` - Archived",diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-list.jsonindex 9ad63f6ffeed..18e5d2c3544e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-list.json@@ -35,7 +35,7 @@},"origin_product": {"description": "Filter to workflows owned by a product surface, e.g. `loops` for Desktop loops.",- "enum": ["broadcasts", "loops"],+ "enum": ["broadcasts", "loops", "transactional_emails"],"type": "string"},"search": {