Skip to content

feat(email): add SMTP conversation threading - #1750

Merged
realcodesiman merged 5 commits into
mainfrom
feat/email-conversation-threading
Nov 19, 2026
Merged

realcodesiman merged 5 commits into
mainfrom
feat/email-conversation-threading

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • Route inbound SMTP mail and outbound replies by RFC 5322 thread headers.
  • Open isolated SMTP outreach threads for broadcasts, flows, and rewards.
  • Keep direct-conversation behavior correct for SLA, triggers, and Inbox links.

Verification

  • pnpm lint
  • pnpm --filter worker check-types
  • pnpm --filter @chatbotx.io/business check-types
  • pnpm --filter @chatbotx.io/database check-types
  • pnpm --filter worker test
  • pnpm --filter @chatbotx.io/integration-smtp test
  • pnpm --filter @chatbotx.io/utils test

- Route inbound mail and outbound replies by RFC 5322 thread headers.
- Open isolated, idempotent SMTP outreach threads for broadcasts and flows.
- Preserve direct-conversation behaviors for SLA, triggers, and Inbox links.
@github-actions github-actions Bot added the feature New feature or request label Nov 18, 2026
Replace the last-incoming-email lookup with a shared thread resolver so
API, broadcast, flow-action and minigame sends keep SMTP threading headers.
…arent from shard primaries

Trigger actions on an SMTP contact with no conversation now open a single
email thread per run (seeded by a stable run key), shared by tag and flow
actions and reused on retry. The reply-parent lookup moves into
messageRepository.findEmailParent, filtering in SQL and reading primaries so
a just-persisted mail is never missed. SMTP replies always send as messages.
…ield tests

Flow step fields now resolve from the conversation on the context rather
than a findDMByContact lookup, so the tests pass the conversation directly.
Email threading resolved a per-thread conversation for every channel. Limit
it to SMTP so other channels keep the contact's single DM conversation in
flow sends, trigger action scope, leaderboard rewards, broadcast assigned-user
audience and last/current step variables.
@realcodesiman
realcodesiman merged commit 50e0a11 into main Nov 19, 2026
14 checks passed
@realcodesiman
realcodesiman deleted the feat/email-conversation-threading branch November 19, 2026 03:52
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
* feat(email): add SMTP conversation threading

- Route inbound mail and outbound replies by RFC 5322 thread headers.
- Open isolated, idempotent SMTP outreach threads for broadcasts and flows.
- Preserve direct-conversation behaviors for SLA, triggers, and Inbox links.

* fix(email): resolve email thread per conversation for all outbound sends

Replace the last-incoming-email lookup with a shared thread resolver so
API, broadcast, flow-action and minigame sends keep SMTP threading headers.

* fix(email): open one outreach thread per trigger run and read reply parent from shard primaries

Trigger actions on an SMTP contact with no conversation now open a single
email thread per run (seeded by a stable run key), shared by tag and flow
actions and reused on retry. The reply-parent lookup moves into
messageRepository.findEmailParent, filtering in SQL and reading primaries so
a just-persisted mail is never missed. SMTP replies always send as messages.

* test(variables): read last/current step from conversation in system field tests

Flow step fields now resolve from the conversation on the context rather
than a findDMByContact lookup, so the tests pass the conversation directly.

* fix(email): keep non-smtp channels on their shared DM conversation

Email threading resolved a per-thread conversation for every channel. Limit
it to SMTP so other channels keep the contact's single DM conversation in
flow sends, trigger action scope, leaderboard rewards, broadcast assigned-user
audience and last/current step variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant