> ## Documentation Index
> Fetch the complete documentation index at: https://www.voiceflow.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Keep conversations together

> Map customer email replies to isolated Voiceflow sessions and test new threads, changed senders and expired conversations.

Continue a customer's support question while keeping unrelated messages separate. This guide assumes one of the [Email connections](/docs/guides/channels/email) is running with the supplied relay and a persistent database. The backend developer owns the mapping; the CX reviewer checks what the customer sees.

## Before you begin

Have two test senders, the support address, access to the relay queue and runtime transcripts. Keep the provider's original messages available. Decide whether a finished or expired support conversation should start afresh; the sample preserves active sessions but cannot restore expired runtime memory.

## Define the continuity policy

### 1. Keep mailbox and sender boundaries

Use one `PROVIDER`, `MAILBOX`, project and released Environment per database. Retain `IDENTITY_SECRET` and `DB_PATH` across ordinary restarts. The relay derives a pseudonymous runtime user ID from a thread key scoped by provider, mailbox and normalized sender. Subject alone never joins threads.

| Message | Result in the supplied relay |
| --- | --- |
| Gmail/Outlook reply in a native thread | Reuse its stored thread for that sender/mailbox. |
| Other provider reply with known In-Reply-To/References | Find the known message within that sender/mailbox scope. |
| New message with no known references | Start a new thread, even if the subject matches. |
| Changed sender or new participant | Use a separate scope; no automatic sharing of prior agent context. |
| Completed agent conversation | Start a fresh runtime session on the next message. |
| Expired/failed session | Hold the turn for explicit recovery. |

### 2. Check the reply address

Set `REPLY_TO` to the address the installed receiver actually handles. For generated Postmark, Resend or Mailjet addresses, this may differ from the verified outbound From. Include only genuine support aliases in `MAILBOX_ALIASES`. The provider manual owns native reply IDs, DNS and forwarding rules.

If a provider rewrites the outgoing Message-ID and a client removes older References, the next reply may start a new session; test the clients your customers use. The sample replies to one sender. A changed Reply-To is held for review; CC/BCC recipients are not copied. A forwarded email does not authorize joining the original sender’s agent session.

### 3. Preserve state during maintenance

Stop the worker before copying/backing up SQLite, including WAL files if present. Keep its tokens, deduplication record, thread references and session keys together. Do not delete it or reuse one user ID across all customers to fix lost context.

For a changed project, mailbox, Environment, cutoff or identity secret, drain old jobs and use a new database as the installation manual describes. Existing sessions can retain an earlier release; verify a fresh thread after publishing. The [Sessions reference](/docs/api-reference/v4interact/start-session-specific-environment) owns the exact runtime contract.

## Test continuity and isolation

### 1. Continue a real customer question

From sender A, ask a question and approve the reply. Reply in that email thread with a follow-up requiring the earlier context. In `cli.mjs show JOB_ID`, compare the two stored `thread` values; inspect Transcripts and the delivered answer. Both should reflect the same active conversation.

### 2. Try an unrelated message and another sender

Send a fresh email without reply references, then send from sender B using the same subject. Expect independent thread values and no disclosure of A’s prior support context. Copying A’s Message-ID into B’s reply must not join A’s stored session. Sender headers are still spoofable: this is isolation, not authenticated account access.

### 3. Exercise the lifecycle

Restart the service with the same volume and send another follow-up; processed input should not resend. End the agent conversation and test a later reply. Separately let a session expire in the test Environment: expect held recovery, not silent replay. Use the installation manual's reviewed restart command only after checking side effects.

### Every reply starts a new conversation

Compare native IDs, headers and the preserved database.

Check provider `threadId`/`conversationId` or Internet In-Reply-To/References on both messages. Verify the actual Reply-To returns to the same receiver, sender normalization matches and the same persistent database is mounted. Missing/rewritten headers may require a new conversation; do not fall back to subject or one global session.

### An old conversation uses an earlier answer

Separate release testing from conversation recovery.

Use a new email thread to test the newly published Environment. Confirm the service's deployment fingerprint and routing values. Resolve or finish older support sessions deliberately; starting another session with the same runtime identity supersedes the prior one and does not merge its history.
