> ## 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.

# Separate app conversations

> Choose mobile chat retention and reset behavior, prevent visible conversation reuse after account changes, and define a trusted boundary for protected data.

A chat conversation ID identifies a conversation participant; it does not prove
who signed in to your app. Start with a working
[iOS](/docs/guides/channels/mobile/ios) or [Android](/docs/guides/channels/mobile/android)
chat screen and agree on which conversations may return after Help closes.
The app developer implements that boundary; the CX owner checks the customer
experience.

The supplied public-widget recipe answers public support questions. Adding a
customer ID, display name or launch payload does not make it an authenticated
account channel. If the agent reads protected records or performs account actions,
complete the trusted-backend handoff below before enabling those operations.

## Set retention and reset behavior

### 1. Choose where continuity should end

Use the [widget persistence options](/docs/documentation/deploy/widget/web-chat-api#configuring-chat-persistence)
to select a deliberate policy:

| Policy | Page behavior | App responsibility |
| --- | --- | --- |
| `memory` | A page reload starts fresh | Explain that reopening/reloading can lose the visible conversation |
| `sessionStorage` | State can return within the surviving page session | Retain one view while Help is open; test view/process recreation separately |
| `localStorage` | State can return across page sessions on that origin | Implement account-specific isolation and explicit cleanup before changing users |

The examples use `sessionStorage` with no supplied user ID. iOS creates a
nonpersistent website store for each view; Android recreates the WebView when
its Help Activity is recreated. Neither sample promises return across an app
restart. Choose persistent continuity only after you implement its lifecycle.

### 2. Close the old conversation on identity changes

Have the developer block further sends and remove the old chat screen when
logout starts or the signed-in account changes. Revoke the app/backend session
and discard its cached conversation mapping before opening the next screen.
Late replies from the old instance must never appear in the new one.

For the iOS sample, destroy the old view and release its nonpersistent data
store. For the Android sample, finish the Help Activity so it destroys its view;
open a fresh Activity only after the identity transition completes. If you add
cookies or persistent web storage, the developer must clear/isolate that data
and await completion before loading another account. Avoid clearing unrelated
WebView data globally as an incidental logout action.

Do not use one hardcoded `userID` for every installation or account. A custom
ID must follow the intended customer/conversation mapping, but it still does
not authorize data access. Widget `destroy()` only unmounts the UI; it is not a
server logout or transcript-deletion operation.

### 3. Gate protected data on a trusted backend

If account operations are required, ask the backend developer to deliver an
app-authenticated conversation service with these properties before adding
protected tools:

- Verify the app's existing login on every request and derive account/tenant identity from that verified session, not the chat payload.
- Keep Voiceflow project credentials and runtime session keys on the server. Map the signed-in principal to the permitted conversation and Environment.
- Allow only the intended customer actions. Reject client-supplied protected variables/state/record IDs, and reconstruct authorized context on every turn and resume.
- Authorize every data read/write again at the business-system boundary. Stop stale sessions on logout/account changes and prevent late responses crossing accounts.

The app then uses your service and its own conversation UI; this is a different
architecture from the public widget example. The backend developer uses
[Authentication](/docs/api-reference/authentication),
[Sessions](/docs/api-reference/v4interact/start-session-specific-environment),
[Sending actions](/docs/api-reference/v4interact/interact-non-stream) and
[Handling responses](/docs/api-reference/agent-runtime/chat/responses) for the
exact contracts. Creating a runtime session on every foreground transition is
not resume: a new session for the same runtime user can supersede an existing one.

Have the developer provide the service endpoint, app authentication integration,
logout behavior and passing two-account tests. A launch-only identity variable,
private page URL or instruction telling the agent to respect an account ID does
not replace these deliverables. This guide defines the handoff; it does not
supply a ready-made authentication service.

## Test conversation separation

1. In test account A, open Help and send a distinctive public message. Close/reopen Help and check the selected retention policy.
2. Sign out, then open Help anonymously or as test account B. A's visible messages must be absent. Repeat while a reply to A is still in flight.
3. Restart the app and repeat with the same account. Confirm the documented continuity or fresh-start behavior on both platforms.
4. If you added protected operations, ask for B's record while signed in as A. Also alter an account/record ID in a later request and a resume request. The backend must deny access or replace the input with A's authorized mapping.
5. After logout, retry an old app/backend request. It must fail authorization. Do not call this boundary complete from a changed UI alone.

### Another account's messages appear

Check retained views, storage and reused identifiers.

Stop the rollout. Trace whether the old view survived, storage was reused,
cleanup finished after the new load, or all accounts shared a custom user ID.
Hide/remove the old view immediately and finish the identity transition before
creating the next one. Clearing only displayed text leaves the underlying
conversation boundary unresolved.

### The backend trusts a launch value

Move authorization to the verified app session and operation boundary.

A client can change context and later runtime inputs. Verify the server-side
identity mapping on every request, including later turns and resume. Keep runtime
credentials behind an allowlisting proxy when the client must not alter protected
state, and authorize each business operation. Re-run the later-turn override test.

### Logout is expected to delete transcripts

Treat local cleanup, authorization revocation and retention separately.

Destroying a WebView, clearing local storage or revoking an app session does not
establish deletion from Voiceflow or a connected business system. Apply your
separate transcript/data-retention process; do not label a UI reset as deletion.
