: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(messaging): make a message template transactional (#117670)
Harley Alexanderdf05a8c18794
diff --git a/products/messaging/backend/facade/contracts.py b/products/messaging/backend/facade/contracts.pyindex 38ef926574ec..59133d5b431c 100644--- a/products/messaging/backend/facade/contracts.py+++ b/products/messaging/backend/facade/contracts.py@@ -28,3 +28,21 @@ class EmailTemplateContent:name: str# The template's email body: subject, html, text and the editor design.email: dict[str, Any]+++class TransactionalEmailError(Exception):+ """A send the caller has to fix before retrying. `code` is stable for API clients."""++ code = "invalid"+++class TemplateNotSendable(TransactionalEmailError):+ code = "template_not_sendable"+++class MarketingTemplate(TransactionalEmailError):+ code = "marketing_template"+++class SenderUnavailable(TransactionalEmailError):+ code = "sender_unavailable"diff --git a/products/messaging/backend/facade/templates.py b/products/messaging/backend/facade/templates.pyindex ce207f3b3b50..f771e5fb3f1a 100644--- a/products/messaging/backend/facade/templates.py+++ b/products/messaging/backend/facade/templates.py@@ -34,6 +34,7 @@ class MessageTemplateRow:type: strmessage_category_id: UUID | Nonedeleted: bool+ transactional_hog_flow_id: UUID | Nonedef _to_contract(row: MessageTemplate) -> MessageTemplateRow:@@ -48,6 +49,7 @@ def _to_contract(row: MessageTemplate) -> MessageTemplateRow:type=row.type,message_category_id=row.message_category_id,deleted=row.deleted,+ transactional_hog_flow_id=row.transactional_hog_flow_id,)diff --git a/products/messaging/backend/facade/transactional_email.py b/products/messaging/backend/facade/transactional_email.pynew file mode 100644index 000000000000..0b29aa6f1093--- /dev/null+++ b/products/messaging/backend/facade/transactional_email.py@@ -0,0 +1,9 @@+"""Transactional email: a template made sendable over the API, backed by a workflow that runs once per send."""++from products.messaging.backend.facade.contracts import TransactionalEmailError+from products.messaging.backend.services.transactional_email import make_transactional++__all__ = [+ "TransactionalEmailError",+ "make_transactional",+]diff --git a/products/messaging/backend/migrations/0006_messagetemplate_transactional_hog_flow_id.py b/products/messaging/backend/migrations/0006_messagetemplate_transactional_hog_flow_id.pynew file mode 100644index 000000000000..3cbf100a786a--- /dev/null+++ b/products/messaging/backend/migrations/0006_messagetemplate_transactional_hog_flow_id.py@@ -0,0 +1,17 @@+# Generated by Django 5.2.18 on 2026-10-15 11:45++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("messaging", "0005_seal_reverse_accessors"),+ ]++ operations = [+ migrations.AddField(+ model_name="messagetemplate",+ name="transactional_hog_flow_id",+ field=models.UUIDField(blank=True, null=True),+ ),+ ]diff --git a/products/messaging/backend/migrations/max_migration.txt b/products/messaging/backend/migrations/max_migration.txtindex efb3d0e46c38..2345ae4be7e7 100644--- a/products/messaging/backend/migrations/max_migration.txt+++ b/products/messaging/backend/migrations/max_migration.txt@@ -1 +1 @@-0005_seal_reverse_accessors+0006_messagetemplate_transactional_hog_flow_iddiff --git a/products/messaging/backend/models/message_template.py b/products/messaging/backend/models/message_template.pyindex fbf5d1010879..874ed7c81e8e 100644--- a/products/messaging/backend/models/message_template.py+++ b/products/messaging/backend/models/message_template.py@@ -18,6 +18,9 @@ class MessageTemplate(UUIDTModel):content = models.JSONField(default=dict)type = models.CharField(max_length=24, blank=True, default="email")deleted = models.BooleanField(default=False)+ # Set once the template is made transactional: the workflow the send API runs for it. A plain id,+ # because the workflow lives in the workflows product.+ transactional_hog_flow_id = models.UUIDField(null=True, blank=True)class Meta:db_table = "posthog_messagetemplate"diff --git a/products/messaging/backend/presentation/views/message_templates.py b/products/messaging/backend/presentation/views/message_templates.pyindex 3fa268dd66fb..2454ed242e53 100644--- a/products/messaging/backend/presentation/views/message_templates.py+++ b/products/messaging/backend/presentation/views/message_templates.py@@ -4,9 +4,16 @@ from types import SimpleNamespacefrom typing import Anyimport structlog+import posthoganalyticsfrom drf_spectacular.types import OpenApiTypes-from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_field, extend_schema_view-from rest_framework import serializers, status, viewsets+from drf_spectacular.utils import (+ OpenApiParameter,+ OpenApiResponse,+ extend_schema,+ extend_schema_field,+ extend_schema_view,+)+from rest_framework import exceptions, serializers, status, viewsetsfrom rest_framework.decorators import actionfrom rest_framework.exceptions import NotFoundfrom rest_framework.permissions import IsAuthenticated@@ -14,6 +21,7 @@ from rest_framework.request import Requestfrom rest_framework.response import Responsefrom posthog.api.forbid_destroy_model import ForbidDestroyModel+from posthog.api.mixins import validated_requestfrom posthog.api.routing import TeamAndOrgViewSetMixinfrom posthog.api.shared import UserBasicSerializerfrom posthog.event_usage import report_user_action@@ -38,6 +46,7 @@ from products.messaging.backend.facade.templates import (team_category_id,update_template,)+from products.messaging.backend.facade.transactional_email import TransactionalEmailError, make_transactionalfrom products.messaging.backend.presentation.views.serializers import DesignOperationSerializerfrom products.notifications.backend.facade.api import publish_resource_edited@@ -175,6 +184,12 @@ class MessageTemplateSerializer(serializers.Serializer):deleted = serializers.BooleanField(required=False, help_text="Soft-delete flag. Set true to remove the template from the library.")+ transactional_hog_flow_id = serializers.UUIDField(+ read_only=True,+ allow_null=True,+ help_text="The workflow that sends this template over the transactional email API. Null until the "+ "template is made transactional.",+ )def validate(self, data: Any) -> Any:template_type = data.get("type")@@ -231,6 +246,28 @@ TEMPLATE_ID_PARAMETER = OpenApiParameter()+TRANSACTIONAL_EMAIL_API_FLAG = "workflows-transactional-email-api"+++class MakeTransactionalSerializer(serializers.Serializer):+ from_integration_id = serializers.IntegerField(+ required=False,+ allow_null=True,+ help_text="ID of the verified email sender integration the email is sent from. Defaults to the project's "+ "default sender.",+ )+++class TransactionalEmailRejected(exceptions.APIException):+ STATUS_BY_CODE: dict[str, int] = {}+ # The caller has to change the request. Without this the error handler reports a server error.+ default_type = "invalid_request"++ def __init__(self, error: TransactionalEmailError) -> None:+ self.status_code = self.STATUS_BY_CODE.get(error.code, status.HTTP_400_BAD_REQUEST)+ super().__init__(detail=str(error), code=error.code)++@extend_schema_view(retrieve=extend_schema(parameters=[TEMPLATE_ID_PARAMETER]),update=extend_schema(parameters=[TEMPLATE_ID_PARAMETER]),@@ -244,9 +281,17 @@ class MessageTemplatesViewSet():scope_object = "hog_flow"permission_classes = [IsAuthenticated]- # `design` is a custom write action; list it so programmatic callers (MCP/personal API key) get- # hog_flow:write checked instead of being rejected as an action with no declared scope.- scope_object_write_actions = ["create", "update", "partial_update", "patch", "destroy", "design"]+ # `design` and `make_transactional` are custom write actions; list them so programmatic callers (MCP/personal+ # API key) get hog_flow:write checked instead of being rejected as an action with no declared scope.+ scope_object_write_actions = [+ "create",+ "update",+ "partial_update",+ "patch",+ "destroy",+ "design",+ "make_transactional",+ ]serializer_class = MessageTemplateSerializer@@ -320,6 +365,9 @@ class MessageTemplatesViewSet(self._emit_resource_edited(updated)return Response(self._serialize(updated))+ def _actor_id(self) -> int | None:+ return self.request.user.id if self.request.user.is_authenticated else None+def _emit_resource_edited(self, instance: MessageTemplateRow) -> None:# Realtime "edited elsewhere" signal so an open editor can refresh instead of overwriting a write# from another channel (UI/MCP/API). Fires for every channel; the frontend drops its own echo by@@ -383,3 +431,62 @@ class MessageTemplatesViewSet(self._emit_resource_edited(locked)return Response(self._serialize(locked))++ def _require_transactional_email_flag(self) -> None:+ if not posthoganalytics.feature_enabled(+ TRANSACTIONAL_EMAIL_API_FLAG,+ str(self.team.uuid),+ groups={"organization": str(self.team.organization_id)},+ group_properties={"organization": {"id": str(self.team.organization_id)}},+ send_feature_flag_events=False,+ ):+ raise NotFound()++ @validated_request(+ MakeTransactionalSerializer,+ responses={+ 200: OpenApiResponse(response=MessageTemplateSerializer, description="The transactional template"),+ 400: OpenApiResponse(description="The template can't be sent, or there is no verified sender"),+ 404: OpenApiResponse(description="Template not found"),+ },+ summary="Make a template transactional",+ description=(+ "Make this template sendable over the transactional email API. This creates the workflow that sends it, "+ "with its own metrics, run history and versions. Calling it again on a transactional template changes "+ "nothing."+ ),+ parameters=[TEMPLATE_ID_PARAMETER],+ )+ @action(detail=True, methods=["POST"], pagination_class=None)+ def make_transactional(self, request: Any, *args: Any, **kwargs: Any) -> Response:+ self._require_transactional_email_flag()+ template = self.get_object()+ was_transactional = template.transactional_hog_flow_id is not None+ # Access to one workflow lets a member through the viewset's checks, but this can create a new one, also+ # when the linked workflow was deleted.+ if not self.user_access_control.check_access_level_for_resource("hog_flow", "editor"):+ raise exceptions.PermissionDenied("You need editor access to workflows to make a template transactional.")+ try:+ make_transactional(+ self.team_id,+ template.id,+ user_id=self._actor_id(),+ from_integration_id=request.validated_data.get("from_integration_id"),+ )+ except TransactionalEmailError as e:+ raise TransactionalEmailRejected(e) from None+ updated = self.get_object()+ if not was_transactional:+ self._emit_resource_edited(updated)+ try:+ report_user_action(+ self.request.user,+ "message template made transactional",+ {"template_id": str(template.id), "team_id": str(self.team_id)},+ team=self.team,+ organization=self.organization,+ request=self.request,+ )+ except Exception as e:+ logger.warning("Failed to capture message template usage event", error=str(e))+ return Response(self._serialize(updated))diff --git a/products/messaging/backend/services/transactional_email.py b/products/messaging/backend/services/transactional_email.pynew file mode 100644index 000000000000..8d979570d68c--- /dev/null+++ b/products/messaging/backend/services/transactional_email.py@@ -0,0 +1,84 @@+"""Transactional emails: a template made sendable over the API. Each one is backed by a workflow that runs once+per send, so sends get the workflow's metrics, run history and versions."""++from uuid import UUID++from django.db import transaction++from products.messaging.backend.facade.contracts import MarketingTemplate, SenderUnavailable, TemplateNotSendable+from products.messaging.backend.models import MessageCategory, MessageTemplate+from products.messaging.backend.models.message_category import MessageCategoryType+from products.workflows.backend.facade.api import WorkflowNotFound, get_workflow_summary+from products.workflows.backend.facade.transactional_emails import (+ TransactionalEmailContent,+ TransactionalEmailSenderUnavailable,+ create_transactional_email_workflow,+)+++def check_sendable(team_id: int, *, template_type: str, content: dict, message_category_id: UUID | None) -> None:+ """Raise when a template with these fields can't be a transactional email."""+ email = (content or {}).get("email")+ if template_type != "email" or not isinstance(email, dict) or not email.get("subject"):+ raise TemplateNotSendable("The template has no email subject, so it can't be sent.")+ if not (email.get("text") or email.get("html")):+ raise TemplateNotSendable("The template has no email body, so it can't be sent.")+ if message_category_id:+ # A deleted category still classifies the template, and the category field accepts one.+ category = MessageCategory.objects.filter(team_id=team_id, id=message_category_id).first()+ # Transactional sends skip opt-outs, so a marketing template must never go out this way.+ if category and category.category_type == MessageCategoryType.MARKETING:+ raise MarketingTemplate(+ "The template is in a marketing category. Only transactional templates can be sent."+ )+++def _content(template: MessageTemplate, from_integration_id: int | None) -> TransactionalEmailContent:+ email = template.content["email"]+ return TransactionalEmailContent(+ message_template_id=template.id,+ name=template.name,+ subject=email["subject"],+ preheader=email.get("preheader") or "",+ html=email.get("html") or "",+ text=email.get("text") or "",+ from_integration_id=from_integration_id,+ message_category_id=template.message_category_id,+ )+++def make_transactional(+ team_id: int, template_id: UUID, *, user_id: int | None, from_integration_id: int | None+) -> UUID:+ """Create the template's workflow and link it, and return the workflow's id. A template that is already+ transactional keeps the workflow it has."""+ with transaction.atomic():+ # The row lock keeps two concurrent calls from creating two workflows.+ template = MessageTemplate.objects.select_for_update().get(team_id=team_id, id=template_id, deleted=False)+ if template.transactional_hog_flow_id and _workflow_exists(team_id, template.transactional_hog_flow_id):+ return template.transactional_hog_flow_id+ check_sendable(+ team_id,+ template_type=template.type,+ content=template.content,+ message_category_id=template.message_category_id,+ )+ try:+ hog_flow_id = create_transactional_email_workflow(+ team_id=team_id, user_id=user_id, content=_content(template, from_integration_id)+ )+ except TransactionalEmailSenderUnavailable as e:+ raise SenderUnavailable(+ "No verified email sender. Verify a sending domain or pass from_integration_id."+ ) from e+ template.transactional_hog_flow_id = hog_flow_id+ template.save(update_fields=["transactional_hog_flow_id", "updated_at"])+ return hog_flow_id+++def _workflow_exists(team_id: int, hog_flow_id: UUID) -> bool:+ try:+ get_workflow_summary(team_id=team_id, workflow_id=str(hog_flow_id))+ except WorkflowNotFound:+ return False+ return Truediff --git a/products/messaging/backend/tests/api/test_transactional_email.py b/products/messaging/backend/tests/api/test_transactional_email.pynew file mode 100644index 000000000000..4b4f79a92ba7--- /dev/null+++ b/products/messaging/backend/tests/api/test_transactional_email.py@@ -0,0 +1,179 @@+from uuid import uuid4++import pytest+from posthog.test.base import APIBaseTest+from unittest.mock import patch++from parameterized import parameterized+from rest_framework import status++from posthog.constants import AvailableFeature+from posthog.models import OrganizationMembership, User+from posthog.models.integration import Integration++from products.access_control.backend.facade.testing import create_access_control+from products.messaging.backend.models.message_category import MessageCategory, MessageCategoryType+from products.messaging.backend.models.message_template import MessageTemplate+from products.messaging.backend.services.transactional_email import make_transactional+from products.workflows.backend.facade.api import set_default_email_sender_if_unset+++@patch("products.messaging.backend.presentation.views.message_templates.posthoganalytics.capture")+@patch(+ "products.messaging.backend.presentation.views.message_templates.posthoganalytics.feature_enabled",+ return_value=True,+)+@patch("posthog.plugins.plugin_server_api.internal_requests.post")+class TestTransactionalEmail(APIBaseTest):+ def setUp(self):+ super().setUp()+ 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)+ self.template = self._template()+ self.hog_flow_id = make_transactional(+ self.team.id, self.template.id, user_id=self.user.id, from_integration_id=None+ )++ def _template(self, content: dict | None = None) -> MessageTemplate:+ return MessageTemplate.objects.create(+ team=self.team,+ name="Password reset",+ content=content+ or {"email": {"subject": "Reset your password", "html": "<a href='{{ variables.link }}'>Reset</a>"}},+ type="email",+ )++ def _workflow(self, hog_flow_id) -> dict:+ response = self.client.get(f"/api/projects/{self.team.id}/hog_flows/{hog_flow_id}")+ assert response.status_code == status.HTTP_200_OK, response.json()+ return response.json()++ def test_is_hidden_while_the_flag_is_off(self, mock_post, flag, _capture):+ flag.return_value = False++ response = self.client.post(+ f"/api/projects/{self.team.id}/messaging_templates/{self.template.id}/make_transactional/",+ {},+ format="json",+ )++ assert response.status_code == status.HTTP_404_NOT_FOUND++ def test_making_a_template_transactional_creates_its_workflow_once(self, mock_post, _flag, _capture):+ template = self._template()+ url = f"/api/projects/{self.team.id}/messaging_templates/{template.id}/make_transactional/"++ first = self.client.post(url, {}, format="json")+ second = self.client.post(url, {}, format="json")++ assert first.status_code == status.HTTP_200_OK, first.json()+ hog_flow_id = first.json()["transactional_hog_flow_id"]+ assert second.json()["transactional_hog_flow_id"] == hog_flow_id+ workflow = self._workflow(hog_flow_id)+ assert workflow["status"] == "active"+ assert workflow["origin_product"] == "transactional_emails"+ assert workflow["trigger"] == {"type": "api"}+ listed = self.client.get(f"/api/projects/{self.team.id}/hog_flows?type=transactional_email").json()+ assert {flow["id"] for flow in listed["results"]} == {str(self.hog_flow_id), hog_flow_id}++ @parameterized.expand(+ [+ ("marketing_template", "marketing_template"),+ ("deleted_marketing_category", "marketing_template"),+ ("template_without_subject", "template_not_sendable"),+ ("template_without_body", "template_not_sendable"),+ ("unverified_sender", "sender_unavailable"),+ ]+ )+ def test_rejects_making_a_template_transactional_it_cannot_send(+ self, mock_post, _flag, _capture, case, expected_code+ ):+ template = self._template()+ if case in ("marketing_template", "deleted_marketing_category"):+ template.message_category = MessageCategory.objects.create(+ team=self.team,+ key="news",+ name="News",+ category_type=MessageCategoryType.MARKETING,+ deleted=case == "deleted_marketing_category",+ )+ elif case == "template_without_subject":+ template.content = {"email": {"html": "<p>Hi</p>"}}+ elif case == "template_without_body":+ template.content = {"email": {"subject": "Hi"}}+ elif case == "unverified_sender":+ self.sender.config = {"verified": False}+ self.sender.save()+ template.save()++ response = self.client.post(+ f"/api/projects/{self.team.id}/messaging_templates/{template.id}/make_transactional/", {}, format="json"+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()+ assert response.json()["code"] == expected_code+ template.refresh_from_db()+ assert template.transactional_hog_flow_id is None+++@patch(+ "products.messaging.backend.presentation.views.message_templates.posthoganalytics.feature_enabled",+ return_value=True,+)+@patch("posthog.plugins.plugin_server_api.internal_requests.post")+class TestTransactionalEmailWorkflowAccess(APIBaseTest):+ def setUp(self):+ super().setUp()+ self.organization.available_product_features = [+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL},+ ]+ self.organization.save()+ 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, sender.id)+ self.template = MessageTemplate.objects.create(+ team=self.team,+ name="Password reset",+ content={"email": {"subject": "Reset your password", "html": "<p>Reset</p>"}},+ type="email",+ )+ self.hog_flow_id = make_transactional(+ self.team.id, self.template.id, user_id=self.user.id, from_integration_id=None+ )+ self._login_member("[email protected]", {str(self.hog_flow_id): "none"})++ def _login_member(self, email: str, levels: dict[str | None, str]) -> None:+ member = User.objects.create_and_join(self.organization, email, "testtest")+ membership_id = OrganizationMembership.objects.get(user=member, organization=self.organization).id+ for resource_id, access_level in levels.items():+ create_access_control(+ team_id=self.team.id,+ resource="hog_flow",+ resource_id=resource_id,+ access_level=access_level,+ organization_member_id=membership_id,+ )+ self.client.force_login(member)++ @parameterized.expand([("unlinked", None), ("linked_to_a_deleted_workflow", uuid4())])+ def test_editor_access_to_one_workflow_cannot_create_another(self, mock_post, _flag, _name, linked_hog_flow_id):+ self._login_member("[email protected]", {None: "viewer", str(self.hog_flow_id): "editor"})+ template = MessageTemplate.objects.create(+ team=self.team,+ name="Welcome",+ content={"email": {"subject": "Welcome", "html": "<p>Hi</p>"}},+ type="email",+ transactional_hog_flow_id=linked_hog_flow_id,+ )++ response = self.client.post(+ f"/api/projects/{self.team.id}/messaging_templates/{template.id}/make_transactional/", {}, format="json"+ )++ assert response.status_code == status.HTTP_403_FORBIDDEN, response.json()+ template.refresh_from_db()+ assert template.transactional_hog_flow_id == linked_hog_flow_iddiff --git a/products/messaging/frontend/generated/api.schemas.ts b/products/messaging/frontend/generated/api.schemas.tsindex 141e7fe4180d..73b876311bbd 100644--- a/products/messaging/frontend/generated/api.schemas.ts+++ b/products/messaging/frontend/generated/api.schemas.ts@@ -395,6 +395,11 @@ export interface MessageTemplateApi {message_category?: string | null/** Soft-delete flag. Set true to remove the template from the library. */deleted?: boolean+ /**+ * The workflow that sends this template over the transactional email API. Null until the template is made transactional.+ * @nullable+ */+ readonly transactional_hog_flow_id: string | null}export interface PaginatedMessageTemplateListApi {@@ -432,6 +437,11 @@ export interface PatchedMessageTemplateApi {message_category?: string | null/** Soft-delete flag. Set true to remove the template from the library. */deleted?: boolean+ /**+ * The workflow that sends this template over the transactional email API. Null until the template is made transactional.+ * @nullable+ */+ readonly transactional_hog_flow_id?: string | null}/**@@ -492,6 +502,14 @@ export interface PatchedDesignPatchApi {operations?: DesignOperationApi[]}+export interface MakeTransactionalApi {+ /**+ * ID of the verified email sender integration the email is sent from. Defaults to the project's default sender.+ * @nullable+ */+ from_integration_id?: number | null+}+export type MessagingCategoriesListParams = {/*** Number of results to return per page.diff --git a/products/messaging/frontend/generated/api.ts b/products/messaging/frontend/generated/api.tsindex 01d6acf9acae..6fe995268852 100644--- a/products/messaging/frontend/generated/api.ts+++ b/products/messaging/frontend/generated/api.ts@@ -14,6 +14,7 @@ import type {BulkAddOptOutsRequestApi,BulkAddOptOutsResultApi,GenerateLinkRequestApi,+ MakeTransactionalApi,MessageCategoryApi,MessagePreferencesApi,MessageSuppressionApi,@@ -721,3 +722,25 @@ export const messagingTemplatesDesignPartialUpdate = async (body: JSON.stringify(patchedDesignPatchApi),})}++export const getMessagingTemplatesMakeTransactionalCreateUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/messaging_templates/${id}/make_transactional/`+}++/**+ * Make this template sendable over the transactional email API. This creates the workflow that sends it, with its own metrics, run history and versions. Calling it again on a transactional template changes nothing.+ * @summary Make a template transactional+ */+export const messagingTemplatesMakeTransactionalCreate = async (+ projectId: string,+ id: string,+ makeTransactionalApi?: MakeTransactionalApi,+ options?: RequestInit+): Promise<MessageTemplateApi> => {+ return apiMutator<MessageTemplateApi>(getMessagingTemplatesMakeTransactionalCreateUrl(projectId, id), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(makeTransactionalApi),+ })+}diff --git a/products/messaging/frontend/generated/api.zod.ts b/products/messaging/frontend/generated/api.zod.tsindex 3b514b3bce10..f9e744c865a8 100644--- a/products/messaging/frontend/generated/api.zod.ts+++ b/products/messaging/frontend/generated/api.zod.ts@@ -580,3 +580,16 @@ export const MessagingTemplatesDesignPartialUpdateBody = /* @__PURE__ */ zod.obj"Ordered edits applied atomically to a template's Unlayer design: the stored design is read, the ops are applied in order, the result is validated and re-rendered to HTML, and it's saved only if valid — otherwise the template is unchanged. Reference blocks by id so you never resend the whole design."),})++/**+ * Make this template sendable over the transactional email API. This creates the workflow that sends it, with its own metrics, run history and versions. Calling it again on a transactional template changes nothing.+ * @summary Make a template transactional+ */+export const MessagingTemplatesMakeTransactionalCreateBody = /* @__PURE__ */ zod.object({+ from_integration_id: zod+ .number()+ .nullish()+ .describe(+ "ID of the verified email sender integration the email is sent from. Defaults to the project's default sender."+ ),+})diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 83986a7d8a18..90abbf732c21 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -65490,6 +65490,14 @@ export namespace Schemas {error_code?: string | null;}+ export interface MakeTransactional {+ /**+ * ID of the verified email sender integration the email is sent from. Defaults to the project's default sender.+ * @nullable+ */+ from_integration_id?: number | null;+ }+/*** * `not_configured` - not_configured* * `waiting` - waiting@@ -66891,6 +66899,11 @@ export namespace Schemas {message_category?: string | null;/** Soft-delete flag. Set true to remove the template from the library. */deleted?: boolean;+ /**+ * The workflow that sends this template over the transactional email API. Null until the template is made transactional.+ * @nullable+ */+ readonly transactional_hog_flow_id: string | null;}export interface MessagingError {@@ -82831,6 +82844,11 @@ export namespace Schemas {message_category?: string | null;/** Soft-delete flag. Set true to remove the template from the library. */deleted?: boolean;+ /**+ * The workflow that sends this template over the transactional email API. Null until the template is made transactional.+ * @nullable+ */+ readonly transactional_hog_flow_id?: string | null;}export interface PatchedMoveTileRequest {