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 frequency cap columns to the workflows team config (#110082)

Harley Alexander822950a7d685
diff --git a/products/workflows/backend/migrations/0031_team_workflows_config_frequency_cap.py b/products/workflows/backend/migrations/0031_team_workflows_config_frequency_cap.py
new file mode 100644
index 000000000000..047c11f15a92
--- /dev/null
+++ b/products/workflows/backend/migrations/0031_team_workflows_config_frequency_cap.py
@@ -0,0 +1,31 @@
+# Generated by Django 5.2.17 on 2026-10-01 10:32
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("workflows", "0030_workflowproposal_rejection_reason"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="teamworkflowsconfig",
+ name="marketing_frequency_cap_max_messages",
+ field=models.IntegerField(
+ blank=True,
+ null=True,
+ validators=[django.core.validators.MinValueValidator(1)],
+ ),
+ ),
+ migrations.AddField(
+ model_name="teamworkflowsconfig",
+ name="marketing_frequency_cap_window_days",
+ field=models.IntegerField(
+ blank=True,
+ null=True,
+ validators=[django.core.validators.MinValueValidator(1)],
+ ),
+ ),
+ ]
diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txt
index 3434c9359664..6e4cea6c9acd 100644
--- a/products/workflows/backend/migrations/max_migration.txt
+++ b/products/workflows/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0030_workflowproposal_rejection_reason
+0031_team_workflows_config_frequency_cap
diff --git a/products/workflows/backend/models/team_workflows_config.py b/products/workflows/backend/models/team_workflows_config.py
index 470afba6edf0..682634b89f57 100644
--- a/products/workflows/backend/models/team_workflows_config.py
+++ b/products/workflows/backend/models/team_workflows_config.py
@@ -56,3 +56,7 @@ class TeamWorkflowsConfig(models.Model):
workflow_task_team_rate_limit_per_day = models.IntegerField(
null=True, blank=True, validators=[MinValueValidator(0)]
)
+
+ # Max marketing messages per person per rolling window across all workflows; null on either means no cap.
+ marketing_frequency_cap_max_messages = models.IntegerField(null=True, blank=True, validators=[MinValueValidator(1)])
+ marketing_frequency_cap_window_days = models.IntegerField(null=True, blank=True, validators=[MinValueValidator(1)])