Add automatic reply tracking webhook - #4
guillaumegay13 wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
2 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/app/app/page.tsx">
<violation number="1" location="src/app/app/page.tsx:394">
P2: `normalizeHistoryEventType` only recognizes `"reply"`, so `reply_received` events are skipped when building the history index and reply-based conditions can fail to match.</violation>
</file>
<file name="src/app/api/webhooks/replies/route.ts">
<violation number="1" location="src/app/api/webhooks/replies/route.ts:262">
P2: Long idempotency keys can collapse `reply_outcome` into the same dedupe key as `reply_received`, causing outcome events to be skipped.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| return "delivery"; | ||
| case "open": | ||
| return "open"; | ||
| case "reply": |
There was a problem hiding this comment.
P2: normalizeHistoryEventType only recognizes "reply", so reply_received events are skipped when building the history index and reply-based conditions can fail to match.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/app/app/page.tsx, line 394:
<comment>`normalizeHistoryEventType` only recognizes `"reply"`, so `reply_received` events are skipped when building the history index and reply-based conditions can fail to match.</comment>
<file context>
@@ -384,6 +391,8 @@ function normalizeHistoryEventType(eventType: string): HistoryEventType | null {
return "delivery";
case "open":
return "open";
+ case "reply":
+ return "reply";
case "click":
</file context>
| case "reply": | |
| case "reply": | |
| case "reply_received": | |
| case "replyreceived": |
There was a problem hiding this comment.
3 issues found across 11 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/lib/openapi.ts">
<violation number="1">
P2: The description was narrowed from "Tracked event type" to "SES event type" and "Reply" was dropped from the examples, but this PR adds `Replied` as a first-class history event. Since reply events don't originate from SES, this description is now inaccurate and will confuse API consumers.</violation>
</file>
<file name="src/app/app/page.tsx">
<violation number="1">
P1: Removing `"reply"` from `HistoryEventType` breaks the ability to create workflow conditions that filter by reply events. The PR adds a reply-tracking webhook that produces `reply_received` events, but this change removes the only frontend type that could represent them in `HistoryCondition`. Consider keeping or replacing it (e.g., with `"reply_received"`).</violation>
<violation number="2">
P1: Removing the `"reply"` / `"replyreceived"` cases from `normalizeEventType` and the `Reply` entry from `HISTORY_EVENT_META` breaks display of `reply_received` events produced by the new webhook. `normalizeEventTypeKey` would convert `"reply_received"` → `"replyreceived"`, which the old switch case handled correctly by returning `"Reply"`. Now these events render unstyled with no label. Both the normalization case and the metadata entry should be retained.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| @@ -764,7 +764,7 @@ export const openapiSpec = { | |||
| }, | |||
There was a problem hiding this comment.
P2: The description was narrowed from "Tracked event type" to "SES event type" and "Reply" was dropped from the examples, but this PR adds Replied as a first-class history event. Since reply events don't originate from SES, this description is now inaccurate and will confuse API consumers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/lib/openapi.ts, line 164:
<comment>The description was narrowed from "Tracked event type" to "SES event type" and "Reply" was dropped from the examples, but this PR adds `Replied` as a first-class history event. Since reply events don't originate from SES, this description is now inaccurate and will confuse API consumers.</comment>
<file context>
@@ -161,7 +161,7 @@ export const openapiSpec = {
type: "string",
description:
- "Tracked event type (for example: Send, Delivery, Open, Reply, Click, Bounce, Complaint, Reject, DeliveryDelay, RenderingFailure, Subscription).",
+ "SES event type (for example: Send, Delivery, Open, Click, Bounce, Complaint, Reject, DeliveryDelay, RenderingFailure, Subscription).",
},
timestamp: { type: "string", format: "date-time" },
</file context>
| }, | |
| "Tracked event type (for example: Send, Delivery, Open, Click, Replied, Bounce, Complaint, Reject, DeliveryDelay, RenderingFailure, Subscription).", |
Summary
Reply-Toon outbound emails whenREPLY_TRACKING_DOMAINis configuredPOST /api/webhooks/repliesto resolve inbound replies by tracked address orIn-Reply-To/Referencesreply_receivedasRepliedin History and as a first-class workflow history eventVerification
Summary by cubic
Adds automatic, provider-agnostic reply tracking. Outbound emails set a signed tracked Reply-To, and a new webhook resolves inbound replies and records them as Replied in History.
New Features
Reply-Toon outbound emails whenREPLY_TRACKING_DOMAINis set.POST /api/webhooks/repliesingests replies, matching by tracked address orIn-Reply-To/References.reply_receivedand optionalreply_outcomecontact events; shown asRepliedin History and workflow events..env.exampleaddsREPLY_TRACKING_SECRETandREPLY_TRACKING_DOMAIN.Migration
REPLY_TRACKING_SECRETandREPLY_TRACKING_DOMAIN./api/webhooks/replieswith workspace auth (JWT or API key).Written for commit 3acf71c. Summary will update on new commits.