Skip to content

Show which recipients bounced or complained from a sequence or broadcast - #214

Merged
s3rot0n1n merged 1 commit into
mainfrom
t3/issue-213
Nov 22, 2026
Merged

s3rot0n1n merged 1 commit into
mainfrom
t3/issue-213

Conversation

@s3rot0n1n

Copy link
Copy Markdown
Contributor

Closes #213

What

A broadcast or sequence showed a bounce rate and a spam complaint rate, but there was no way to see who they referred to. This adds the recipients behind those numbers, plus each send's outcome on the contact page.

API, MCP, SDK

  • GET /sequences/{sequenceId}/deliveries?outcome=bounced|complained: one row per send, with the recipient, contact, which email it was, the outcome (sent, delivered, bounced, complained, failed), hard or soft bounce, the ESP's reason and SMTP codes, when it happened, and the address's active suppression. Paged with offset/itemsPerPage (100 at most).
  • Counts match the stats: the list reads the same outbound-ledger rows as sequenceDeliveryRates, so a filtered total equals the number behind bounceRate/complaintRate. A test asserts this. I chose this over adding sequenceId to /delivery-events because events can be duplicated by retries, and an inline SMTP 5xx bounce has no event at all, so an event-based list wouldn't match the rate. A bounced send with no event is reported as a hard bounce with no reason.
  • GET /contacts/{contactId}/deliveries now returns messageId and outcome for each send (both null for sends from before outbound messages were recorded).
  • MCP: new list_sequence_deliveries tool, with a parity manifest entry and scope policy. The MCP's copy of the contact-delivery schema is replaced by the contract's, so the two can't drift.
  • SDK: sequences.deliveries() and sequences.listAllDeliveries(), documented in the README.
  • openapi.json is regenerated.

Database

  • Migration 0033: adds an index on outbound_messages.campaign_delivery_id. Both the contact history and the sequence list join on that column, which had no index. The migration only adds an index (IF NOT EXISTS), so the previous release still runs against the new schema.

Dashboard

  • Clickable rates: Bounce rate and Spam complaints become clickable once they're above zero and open a dialog of the recipients. It follows the dashboard dialog guidelines: status is words plus colour (hard bounce red, soft bounce amber), codes are monospace, suppressed addresses link to Suppressions, and sequences show which email each row was.
  • Contact page: Delivery history shows each send's outcome as a status pill.
  • Shared labels: suppression reason labels now come from one shared map.

email-blocks

  • Clickable metrics: SequenceAnalyticsMetric gains onSelect/selectLabel, and sequenceStatsMetrics gains onViewBounced/onViewComplained. The accessible name keeps the number ("Bounce rate 15.0%: View recipients who bounced").
  • Tooltips: the bounce and complaint tooltips now say sending only pauses once 100 emails have gone out (AUTO_PAUSE_MIN_SENT), which is the related fix the issue asked for.

Changeset: sendlit and @sendlit/email-blocks minor.

Testing

  • Automated: API suite (1077 pass), including new DB-backed tests for listSequenceDeliveries and the contact outcomes, plus web (116), SDK and email-blocks tests, platform conformance, MCP parity, and check:drift.
  • Local browser smoke test: isolated stack with seeded hard, soft and inline bounces, a complaint, and suppressions. Checked the broadcast and sequence dialogs, the contact history, API validation (400 on a bad outcome or itemsPerPage over 100) and the 404 for an unknown sequence.
  • QA: deployed as qa-issue-213 (arm64). Migration 0033 applied, the health check passes, and the endpoint returns 200 with totals matching sent for every sequence. The sequence and contact pages render with no console errors. QA only has Mailpit, so no real bounce or complaint could be exercised there.

Not in this PR

  • No PostHog event for opening the list: read endpoints in the API don't send events. Errors are covered by the central REST and MCP handlers.
  • No hard/soft distinction on the contact page: contact history shows "Bounced" without hard or soft, because that endpoint doesn't return the bounce type.

🤖 Generated with Claude Code

- API: GET /sequences/{sequenceId}/deliveries lists each send with its
  outcome, hard/soft bounce, the ESP's reason and SMTP codes, and the
  address's active suppression. outcome=bounced|complained lists exactly
  the sends behind the stats' bounce and complaint rates (same ledger rows).
  Contact deliveries now include messageId and outcome.
- MCP list_sequence_deliveries, SDK sequences.deliveries()/listAllDeliveries(),
  openapi.json regenerated. MCP reuses the contract's contact-delivery schema.
- Index outbound_messages.campaign_delivery_id (migration 0033) for the
  delivery-to-ledger joins.
- Dashboard: Bounce rate and Spam complaints open the recipients behind them;
  contact Delivery history shows each send's outcome as a status pill.
- Tooltips mention that auto-pause is checked once 100 emails have gone out.

Closes #213

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T11:07:29.417360Z 46b4f6d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46b4f6d0f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

...(stats.bounceRate > 0 && actions.onViewBounced
? {
onSelect: actions.onViewBounced,
selectLabel: "View recipients who bounced",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make recipient action labels configurable

When a library consumer supplies these callbacks, the new action labels are still fixed in English and cannot be customized through SequenceStatsActions; expose the labels as caller-provided props so third-party apps can localize or rebrand this UI.

AGENTS.md reference: packages/email-blocks/AGENTS.md:L3-L4

Useful? React with 👍 / 👎.

@s3rot0n1n
s3rot0n1n merged commit 95090c3 into main Nov 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show which recipients bounced or complained from a sequence or broadcast

1 participant