Repository navigation
feat(email): add SMTP conversation threading - #1750
Merged
Merged
Conversation
- 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.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
pnpm lintpnpm --filter worker check-typespnpm --filter @chatbotx.io/business check-typespnpm --filter @chatbotx.io/database check-typespnpm --filter worker testpnpm --filter @chatbotx.io/integration-smtp testpnpm --filter @chatbotx.io/utils test