Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(messaging): add sensitive flag to message templates (#120559)

Harley Alexandercc3e9a38d724
diff --git a/products/messaging/backend/migrations/0008_messagetemplate_sensitive.py b/products/messaging/backend/migrations/0008_messagetemplate_sensitive.py
new file mode 100644
index 000000000000..d536d029684f
--- /dev/null
+++ b/products/messaging/backend/migrations/0008_messagetemplate_sensitive.py
@@ -0,0 +1,17 @@
+# Generated by Django 5.2.18 on 2026-10-20 15:19
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("messaging", "0007_messagetemplate_draft_content"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="messagetemplate",
+ name="sensitive",
+ field=models.BooleanField(db_default=False, default=False),
+ ),
+ ]
diff --git a/products/messaging/backend/migrations/max_migration.txt b/products/messaging/backend/migrations/max_migration.txt
index 123776e1eaf8..00e248f74311 100644
--- a/products/messaging/backend/migrations/max_migration.txt
+++ b/products/messaging/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0007_messagetemplate_draft_content
+0008_messagetemplate_sensitive
diff --git a/products/messaging/backend/models/message_template.py b/products/messaging/backend/models/message_template.py
index cada608059c3..cdda6142dfb8 100644
--- a/products/messaging/backend/models/message_template.py
+++ b/products/messaging/backend/models/message_template.py
@@ -23,6 +23,9 @@ class MessageTemplate(UUIDTModel):
transactional_hog_flow_id = models.UUIDField(null=True, blank=True)
# Unpublished edits to a transactional template. Sends keep using `content` until the draft is published.
draft_content = models.JSONField(null=True, blank=True)
+ # For emails carrying codes or reset links: sends keep no rendered body or subject, and clicks keep only
+ # the link's origin.
+ sensitive = models.BooleanField(default=False, db_default=False)
class Meta:
db_table = "posthog_messagetemplate"