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(workflows): add email sending suspension fields to team config (#72891)

Meikel Ratz7f3b6c8ab72b
diff --git a/products/notifications/backend/facade/enums.py b/products/notifications/backend/facade/enums.py
index faae7903608b..4b4576cd191f 100644
--- a/products/notifications/backend/facade/enums.py
+++ b/products/notifications/backend/facade/enums.py
@@ -19,6 +19,7 @@ class NotificationType(str, Enum):
WEB_ANALYTICS_DIGEST = "web_analytics_digest"
ACHIEVEMENT_UNLOCKED = "achievement_unlocked"
SUBSCRIPTION_NUDGE = "subscription_nudge"
+ EMAIL_REPUTATION = "email_reputation"
class Priority(str, Enum):
diff --git a/products/notifications/backend/migrations/0020_alter_notificationevent_notification_type.py b/products/notifications/backend/migrations/0020_alter_notificationevent_notification_type.py
new file mode 100644
index 000000000000..5e04ed1f8fad
--- /dev/null
+++ b/products/notifications/backend/migrations/0020_alter_notificationevent_notification_type.py
@@ -0,0 +1,35 @@
+# Generated by Django 5.2.14 on 2026-07-22 13:34
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("notifications", "0019_remove_notificationevent_archivable"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="notificationevent",
+ name="notification_type",
+ field=models.CharField(
+ choices=[
+ ("comment_mention", "COMMENT_MENTION"),
+ ("alert_firing", "ALERT_FIRING"),
+ ("issue_assigned", "ISSUE_ASSIGNED"),
+ ("approval_requested", "APPROVAL_REQUESTED"),
+ ("approval_resolved", "APPROVAL_RESOLVED"),
+ ("experiment_concluded", "EXPERIMENT_CONCLUDED"),
+ ("pipeline_failure", "PIPELINE_FAILURE"),
+ ("project_created", "PROJECT_CREATED"),
+ ("usage_spike", "USAGE_SPIKE"),
+ ("reminder", "REMINDER"),
+ ("web_analytics_digest", "WEB_ANALYTICS_DIGEST"),
+ ("achievement_unlocked", "ACHIEVEMENT_UNLOCKED"),
+ ("subscription_nudge", "SUBSCRIPTION_NUDGE"),
+ ("email_reputation", "EMAIL_REPUTATION"),
+ ],
+ max_length=32,
+ ),
+ ),
+ ]
diff --git a/products/notifications/backend/migrations/max_migration.txt b/products/notifications/backend/migrations/max_migration.txt
index 143e7c56a201..c0fcaac4b6fb 100644
--- a/products/notifications/backend/migrations/max_migration.txt
+++ b/products/notifications/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0019_remove_notificationevent_archivable
+0020_alter_notificationevent_notification_type
diff --git a/products/workflows/backend/migrations/0014_teamworkflowsconfig_email_sending_suspended_at_and_more.py b/products/workflows/backend/migrations/0014_teamworkflowsconfig_email_sending_suspended_at_and_more.py
new file mode 100644
index 000000000000..fe748d19b7ea
--- /dev/null
+++ b/products/workflows/backend/migrations/0014_teamworkflowsconfig_email_sending_suspended_at_and_more.py
@@ -0,0 +1,22 @@
+# Generated by Django 5.2.14 on 2026-07-22 13:12
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("workflows", "0013_teamworkflowsconfig_email_tracking_consent_mode"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="teamworkflowsconfig",
+ name="email_sending_suspended_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="teamworkflowsconfig",
+ name="email_sending_suspension_reason",
+ field=models.TextField(blank=True, default=""),
+ ),
+ ]
diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txt
index d90f79b4dde4..5eddbe3e2c82 100644
--- a/products/workflows/backend/migrations/max_migration.txt
+++ b/products/workflows/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0013_teamworkflowsconfig_email_tracking_consent_mode
+0014_teamworkflowsconfig_email_sending_suspended_at_and_more
diff --git a/products/workflows/backend/models/team_workflows_config.py b/products/workflows/backend/models/team_workflows_config.py
index 52590b3839a2..e13c994ae0ea 100644
--- a/products/workflows/backend/models/team_workflows_config.py
+++ b/products/workflows/backend/models/team_workflows_config.py
@@ -30,5 +30,10 @@ class TeamWorkflowsConfig(models.Model):
max_length=16, choices=EmailTrackingConsentMode.choices, default=EmailTrackingConsentMode.OFF
)
+ # Staff-controlled kill switch: while set, the CDP email worker blocks all workflow email
+ # for this team at send time. Set/cleared via Django admin; audit trail lives in the activity log.
+ email_sending_suspended_at = models.DateTimeField(null=True, blank=True)
+ email_sending_suspension_reason = models.TextField(blank=True, default="")
+
register_team_extension_signal(TeamWorkflowsConfig, logger=logger)