: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): add COMPLAINT suppression source (#89830)
Meikel Ratz9c72c982d584
diff --git a/products/messaging/backend/api/message_suppression.py b/products/messaging/backend/api/message_suppression.pyindex f69458a06859..f113d5eced7b 100644--- a/products/messaging/backend/api/message_suppression.py+++ b/products/messaging/backend/api/message_suppression.py@@ -48,7 +48,7 @@ class MessageSuppressionSerializer(serializers.ModelSerializer):"help_text": "Normalized recipient email address. Suppression is keyed on this value, per team."},"source": {- "help_text": "How the entry landed on the list: `BOUNCE` for automatic (bounce-driven), `MANUAL` for user-added via the UI/API."+ "help_text": "How the entry landed on the list: `BOUNCE` for automatic (bounce-driven), `COMPLAINT` for automatic (the recipient reported a message as spam), `MANUAL` for user-added via the UI/API."},"reason": {"help_text": "Human-readable reason for the suppression (e.g. 'Auto-suppressed after 5 consecutive soft bounces')."diff --git a/products/messaging/backend/migrations/0004_alter_messagesuppression_source.py b/products/messaging/backend/migrations/0004_alter_messagesuppression_source.pynew file mode 100644index 000000000000..9c0d301f8daf--- /dev/null+++ b/products/messaging/backend/migrations/0004_alter_messagesuppression_source.py@@ -0,0 +1,25 @@+# Generated by Django 5.2.17 on 2026-08-27 06:38++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("messaging", "0003_message_suppression"),+ ]++ operations = [+ migrations.AlterField(+ model_name="messagesuppression",+ name="source",+ field=models.CharField(+ choices=[+ ("BOUNCE", "Bounce"),+ ("MANUAL", "Manual"),+ ("COMPLAINT", "Complaint"),+ ],+ default="BOUNCE",+ max_length=16,+ ),+ ),+ ]diff --git a/products/messaging/backend/migrations/max_migration.txt b/products/messaging/backend/migrations/max_migration.txtindex a079707d6adf..4f639cfeed73 100644--- a/products/messaging/backend/migrations/max_migration.txt+++ b/products/messaging/backend/migrations/max_migration.txt@@ -1 +1 @@-0003_message_suppression+0004_alter_messagesuppression_sourcediff --git a/products/messaging/backend/models/message_suppression.py b/products/messaging/backend/models/message_suppression.pyindex 1f925f74fe4a..24e715198e3f 100644--- a/products/messaging/backend/models/message_suppression.py+++ b/products/messaging/backend/models/message_suppression.py@@ -11,17 +11,22 @@ class SuppressionSource(models.TextChoices):BOUNCE = "BOUNCE"# Added by a user via the Suppression list tab / API.MANUAL = "MANUAL"+ # Added automatically after the recipient reported a message as spam (a mailbox provider+ # complaint relayed through the SES webhook path).+ COMPLAINT = "COMPLAINT"class MessageSuppression(TeamScopedRootMixin, UUIDModel):"""Per-team list of email addresses we should not send to because they can't (or shouldn't)- receive mail. Two ways an address lands here:+ receive mail. Three ways an address lands here:- Automatically, when it soft-bounces (`Transient`) on `transient_bounce_count` consecutivesends without a successful delivery in between. A single soft bounce is not enough — therecipient server may just be briefly down — so we count and only suppress once the countcrosses a configurable threshold. Any successful delivery resets the count.+ - Automatically, when the recipient reports a message as spam and the mailbox provider+ relays the complaint through the SES webhook. A single complaint suppresses immediately.- Manually, when a user adds it in the Suppression list UI.The pre-send path consults this list (see the Node `EmailSuppressionService`) and skipsdiff --git a/products/messaging/frontend/generated/api.schemas.ts b/products/messaging/frontend/generated/api.schemas.tsindex 84f5b33a4eb9..92851610028c 100644--- a/products/messaging/frontend/generated/api.schemas.ts+++ b/products/messaging/frontend/generated/api.schemas.ts@@ -172,6 +172,7 @@ export interface AddSuppressionRequestApi {/*** * `BOUNCE` - Bounce* * `MANUAL` - Manual+ * * `COMPLAINT` - Complaint*/export type MessageSuppressionSourceEnumApi =(typeof MessageSuppressionSourceEnumApi)[keyof typeof MessageSuppressionSourceEnumApi]@@ -179,6 +180,7 @@ export type MessageSuppressionSourceEnumApi =export const MessageSuppressionSourceEnumApi = {Bounce: 'BOUNCE',Manual: 'MANUAL',+ Complaint: 'COMPLAINT',} as constexport interface MessageSuppressionApi {@@ -186,10 +188,11 @@ export interface MessageSuppressionApi {readonly id: string/** Normalized recipient email address. Suppression is keyed on this value, per team. */readonly identifier: string- /** How the entry landed on the list: `BOUNCE` for automatic (bounce-driven), `MANUAL` for user-added via the UI/API.+ /** How the entry landed on the list: `BOUNCE` for automatic (bounce-driven), `COMPLAINT` for automatic (the recipient reported a message as spam), `MANUAL` for user-added via the UI/API.** * `BOUNCE` - Bounce- * * `MANUAL` - Manual */+ * * `MANUAL` - Manual+ * * `COMPLAINT` - Complaint */readonly source: MessageSuppressionSourceEnumApi/*** Human-readable reason for the suppression (e.g. 'Auto-suppressed after 5 consecutive soft bounces').diff --git a/products/workflows/frontend/Suppression/SuppressionList.tsx b/products/workflows/frontend/Suppression/SuppressionList.tsxindex 46d5e8be2e64..be362fd1e23b 100644--- a/products/workflows/frontend/Suppression/SuppressionList.tsx+++ b/products/workflows/frontend/Suppression/SuppressionList.tsx@@ -45,8 +45,8 @@ export function SuppressionList(): JSX.Element {dataIndex: 'source',key: 'source',render: (source) => (- <LemonTag type={source === 'MANUAL' ? 'completion' : 'warning'}>- {source === 'MANUAL' ? 'Manual' : 'Bounces'}+ <LemonTag type={source === 'MANUAL' ? 'completion' : source === 'COMPLAINT' ? 'danger' : 'warning'}>+ {source === 'MANUAL' ? 'Manual' : source === 'COMPLAINT' ? 'Spam complaint' : 'Bounces'}</LemonTag>),},diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 7c6bdb411b14..92a89cf33eef 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -50007,6 +50007,7 @@ export namespace Schemas {/*** * `BOUNCE` - Bounce* * `MANUAL` - Manual+ * * `COMPLAINT` - Complaint*/export type MessageSuppressionSourceEnum = typeof MessageSuppressionSourceEnum[keyof typeof MessageSuppressionSourceEnum];@@ -50014,6 +50015,7 @@ export namespace Schemas {export const MessageSuppressionSourceEnum = {Bounce: 'BOUNCE',Manual: 'MANUAL',+ Complaint: 'COMPLAINT',} as const;export interface MessageSuppression {@@ -50021,10 +50023,11 @@ export namespace Schemas {readonly id: string;/** Normalized recipient email address. Suppression is keyed on this value, per team. */readonly identifier: string;- /** How the entry landed on the list: `BOUNCE` for automatic (bounce-driven), `MANUAL` for user-added via the UI/API.+ /** How the entry landed on the list: `BOUNCE` for automatic (bounce-driven), `COMPLAINT` for automatic (the recipient reported a message as spam), `MANUAL` for user-added via the UI/API.** * `BOUNCE` - Bounce- * * `MANUAL` - Manual */+ * * `MANUAL` - Manual+ * * `COMPLAINT` - Complaint */readonly source: MessageSuppressionSourceEnum;/*** Human-readable reason for the suppression (e.g. 'Auto-suppressed after 5 consecutive soft bounces').