Home / Insights / Generative AI and LLMs

Generative AI and LLMs

Adding AI to a Secure Messaging Product: Summaries, Smart Replies and the Privacy Boundaries We Kept

A messaging product holds the most sensitive conversations a company has. Adding AI to it is easy; adding AI without quietly changing who can see what is the hard part. This is how we approached it on a real product, and the boundaries we refused to cross.

TopicsGenerative AI and LLMsWeb and SaaS Development

Key takeaways

  • Treat every AI feature in a messaging product as a new data flow: define exactly which messages leave the application boundary, to which provider, for how long, and who can switch it off.
  • Make AI optional at the workspace, channel and user level. ‘Available when it helps rather than everywhere’ is a product principle, not a marketing line, and it drives the architecture.
  • The model never sees more than the requesting user could see. Enforce permissions in your own retrieval layer before any prompt is assembled; do not rely on the model to respect access rules.
  • A provider-neutral AI layer (we used OpenAI, Google Gemini and Anthropic Claude behind one interface) keeps the privacy policy enforceable in one place and lets you move workloads as terms change.
  • Document the retention and training commitments of each provider you use, cite them in your own privacy notice, and re-check them on a schedule, because they change.

When a client asked us to build a secure team messaging and collaboration tool with AI built in, the most important sentence in the brief was a constraint rather than a feature: AI should be available when it helps rather than everywhere. That sentence shaped almost every technical decision in the project, because a chat product is different from a document tool or a CRM. Conversations are private by default, they include people who did not consent to being summarised, and a single leaked thread can expose a hiring decision, a security incident or a customer complaint.

This article is written for CTOs, product leads and security owners who are being asked to add generative AI to a product that already holds confidential data. It describes the product we built, the privacy boundaries we set before writing any AI code, the architecture that enforces those boundaries, and the trade-offs we accepted. Where the public case page does not state a detail, we describe our general engineering approach rather than inventing specifics, and any figures are labelled as illustrative. If your data cannot leave your environment at all, the same principles apply with self-hosted models, which is the territory of our private AI deployment work: running open models inside infrastructure you control, with retrieval, access control and audit kept inside the same boundary.

What we built, and what ‘optional AI’ meant in practice

The product is a secure team messaging and collaboration tool, delivered end to end by our team for an international client whose name is withheld. The public case page for Team Messaging with Built-in AI lists the shape of it:

  • Multiple workspaces and channels, with real-time messaging.
  • Optional AI chat summaries, smart replies and action items.
  • Customisable AI personas for team workflows.
  • Integrations with Jira, GitHub, Bitbucket and Google Drive.
  • A Windows desktop app alongside the web app.

The stack is Next.js and React with Redux Toolkit on the front end, Electron for the desktop app, and Cloudflare in front of the web tier. The AI features are built on three providers, OpenAI, Google Gemini and Anthropic Claude, behind a single internal interface, so that no feature is coupled to one vendor’s API or data terms.

Three meanings of ‘optional’

‘Optional AI’ sounds simple until you ask who gets to opt. We ended up with three distinct layers of control, and we recommend all three for any messaging or collaboration product:

  1. Workspace level. An administrator can enable or disable each AI capability for the whole workspace. A legal team can have summaries off while an engineering team has them on.
  2. Channel level. Channel owners can mark a channel as excluded from AI processing. This matters for HR, incident and executive channels, where the people in the room should decide, not the global admin.
  3. Interaction level. Nothing is sent to a model unless a user asks for it. Summaries, smart replies and action items are generated on request, not continuously in the background.

That third layer is the one most teams skip, and it is the one that changes the risk profile most. A product that continuously indexes every message into a model-backed pipeline has created a second copy of every conversation, with its own retention and access story. A product that sends a bounded set of messages when a user clicks ‘summarise’ has created a transient data flow that is far easier to explain and to audit.

Action: before designing AI features for an existing product, write down the three layers of control you will offer and who owns each. If you cannot name an owner for a layer, you have found a gap in your privacy model.

The privacy boundaries we set before writing any AI code

We wrote the boundaries as short, testable statements, agreed them with the client, and treated them as acceptance criteria rather than aspirations. They are reproduced here in general form because they transfer well to other products.

BoundaryWhat it means in the productHow it is enforced
The model sees only what the requesting user can seeA summary of a channel includes only messages that user is authorised to read at the moment of the requestPermission filtering in the application’s own data layer, before prompt assembly; the AI service has no direct database access
No background processing of message contentNo scheduled jobs send conversations to a provider; every call is traceable to a user actionArchitectural: the AI service exposes request-scoped operations only, and there is no worker that reads channels
Excluded channels never leave the boundaryChannels flagged by their owners are invisible to the AI layer, including to persona workflowsExclusion checked in the same retrieval filter as permissions; tested with negative test cases
Provider calls carry the minimum neededMessage text and the names needed for attribution; no email addresses, profile metadata or integration tokensA typed request object that cannot carry those fields, plus a redaction step for obvious identifiers
Outputs are suggestions, not recordsSummaries, replies and action items are drafts the user can edit or discard; nothing is posted automaticallyUI pattern: generate, show, accept or discard; the accept step is a normal user message with normal audit
Provider terms must exclude training on our dataOnly providers and tiers whose published terms state that API content is not used to train modelsReviewed at selection, recorded in the architecture decision log, re-checked on a schedule

Why ‘the model sees only what the user can see’ is the central rule

Most AI incidents in collaboration tools are not model failures; they are access-control failures dressed up as AI. If a summarisation feature can read a channel that the requesting user cannot, the model has become a privilege-escalation path. The OWASP Top 10 for LLM Applications (2025) lists sensitive information disclosure and excessive agency among the core risks for LLM applications, and both are usually introduced by giving the AI layer broader data access than any single user holds. Our rule was to make the AI service a client of the same permission-checked APIs the chat UI uses, never a privileged reader.

Data minimisation is a legal principle as well as good engineering

The UK Information Commissioner’s Office, in its guidance on security and data minimisation in AI, is direct about it: process only the personal data needed for the purpose, map every process that uses personal data, consider minimisation at the design stage, and do not collect data because it might be useful later. For a messaging product that translates into two habits. First, every AI request carries the smallest window of messages that produces a useful result, not the whole channel history. Second, there is no AI-side copy of conversations: no separate index of message content that outlives the request.

Architecture: a provider-neutral AI layer inside the application boundary

The architecture is less novel than it is disciplined. The point is that the privacy boundaries live in one place, the AI service, and every feature passes through it.

Request flow for a summary (general description)

  1. A user with read access to a channel clicks ‘summarise’ and chooses a window, for example since they last read, or the last day.
  2. The web or desktop client calls the application API with the channel, window and user session; this is a normal authenticated request.
  3. The application loads messages through the same permission-checked repository the chat UI uses, drops excluded channels, and trims to the window.
  4. A redaction step removes identifiers that are not needed for the task.
  5. The AI service assembles a prompt from a versioned template and calls the configured provider through a single adapter interface.
  6. The response is validated (length, structure, absence of unexpected content), returned to the client as a draft, and the request is logged with provider, model, token counts and the user, but not the message text.

Why three providers behind one interface

Using OpenAI, Google Gemini and Anthropic Claude behind one internal interface was a privacy decision as much as a quality decision. Provider terms differ and change. At the time of writing, OpenAI’s API data guidance states that data sent to the API is not used to train or improve its models unless you opt in, that abuse-monitoring logs are retained for up to 30 days by default, and that a zero data retention option exists for eligible customers subject to approval. Anthropic’s retention policy states that API inputs and outputs are deleted within 30 days of receipt or generation by default, with exceptions where the customer controls storage or has agreed otherwise. Google’s Gemini API terms distinguish paid from unpaid services: for paid services, Google states that it does not use prompts or responses to improve its products, while for unpaid services it may, and it warns against submitting sensitive information to the unpaid tier.

Those three paragraphs are the reason an adapter layer matters. The policy ‘only paid tiers, only providers that do not train on API content, retention documented’ is enforceable only if there is one place where provider selection happens. It also means that if a provider changes its terms, or a client’s compliance team objects to one vendor, the workload can move without touching product code.

Where the AI personas fit

Customisable AI personas let teams define assistants for their workflows, for example a release-notes drafter or a support triage helper. Personas are configuration, not privilege: a persona runs with the permissions of the user invoking it, and it cannot be pointed at excluded channels. That constraint removed an entire class of ‘the admin’s bot could read everything’ problems.

Integrations

Integrations with Jira, GitHub, Bitbucket and Google Drive bring external context into channels. We kept them on the application side of the boundary: an integration posts into a channel as a normal message, and only then can it be part of an AI request, under the same permission rules. The AI layer never holds integration tokens.

If you are weighing a similar gateway design, our earlier article on LLM gateways and model routing covers the routing and fallback mechanics in more depth.

Summaries, smart replies and action items: the trade-offs in each

The three headline features look similar from the outside but carry different privacy and quality risks.

FeatureInput scopeMain riskMitigation we used
Chat summariesA bounded window of one channel or threadOver-broad windows; summarising people who are not presentUser-chosen window; summaries shown only to the requester; excluded channels unreachable
Smart repliesThe last few messages in the threadReplies that commit the user to something they did not say; tone mismatchShort context; always a draft; never auto-sent; persona tone limits
Action itemsA bounded window, with attributionHallucinated owners or deadlines; items extracted from excluded contentStructured output with explicit ‘unknown’ values; user confirms before anything is created in Jira or elsewhere

Summaries

Summaries are the most requested and the most dangerous feature. The danger is not that a summary is wrong; it is that a summary makes a long, low-visibility conversation suddenly legible to someone who skimmed past it. We kept summaries private to the requester by default. A user can paste a summary into the channel, which is a deliberate act with normal audit, but the product does not publish summaries on anyone’s behalf.

Smart replies

Smart replies are low-risk from a data perspective because the context is small, but they are high-risk from a trust perspective. A suggested reply that sounds confident about a delivery date is a problem if the user taps it without reading. Our pattern is unglamorous: suggestions are visibly drafts, they are short, and sending still requires the user’s normal send action.

Action items

Action items are where structured output earns its keep. We ask the model for a fixed structure, with owner and due date allowed to be unknown, and we show the list for confirmation before anything is created. For the mechanics, see our article on structured outputs and function calling. The privacy rule is the same as elsewhere: the extraction only sees what the requesting user sees, so an action item cannot surface a decision from a channel the user is not in.

Action: for each AI feature, write one sentence describing its input scope and one describing the worst plausible outcome if the output is wrong or over-shared. If either sentence is hard to write, the feature is not ready.

Security controls that the privacy boundaries depend on

Privacy boundaries are only as good as the security controls underneath them. The ones below are standard, but each one closes a specific gap that AI features open.

Prompt injection from message content

In a messaging product, every message is untrusted input, and a summary prompt is built from dozens of them. OWASP lists prompt injection as the first item in its 2025 Top 10 for LLM applications. Our mitigations were layered: message content is clearly delimited from instructions in the template; the model is not given tools during summarisation, so an injected instruction has nothing to act on; outputs are validated and rendered as text, never as markup or links that are automatically followed; and the only ‘actions’ downstream (creating an action item, posting a summary) require a human click. The feature set was chosen partly because it is read-only with respect to the outside world.

Logging without content

AI request logs record who asked, which feature, which provider and model, token counts, latency and outcome. They do not record message text or model output. That decision cost us some debuggability, which we recovered with opt-in diagnostic sessions on test workspaces, and it meant the logs could be retained for operations without becoming a second message archive.

Secrets and provider credentials

Provider keys live only in the AI service’s runtime secrets, scoped per environment, and rotated on a schedule. The web and desktop clients never hold provider credentials; the Electron app talks to the same application API as the browser.

Edge and transport

Cloudflare fronts the web tier, which gives us TLS termination, rate limiting and bot filtering at the edge. Rate limiting matters for AI features specifically: OWASP’s ‘unbounded consumption’ item is a cost problem as much as a security one, and per-user and per-workspace limits on AI requests were in from the first release.

Retention review as a recurring task

Provider retention and training commitments are facts about today, not forever. We recorded each provider’s published position in the architecture decision log, with the URL and the date checked, and scheduled a review. When a client’s privacy notice says ‘we use third-party AI providers that do not train on your content’, that statement needs an owner and a re-check date.

When cloud providers are not enough: the private AI path

For this client, cloud providers on paid, no-training tiers with documented retention met the requirement. For some organisations they will not, and it is worth being honest about where the line falls.

Signals that you need models inside your own boundary

  • A regulator, contract or internal policy prohibits any external processor for message content, regardless of retention terms.
  • Data residency requirements that a provider’s regional options do not satisfy for every endpoint you use.
  • Very high request volumes where per-request pricing dominates the cost of running models yourself.
  • Conversations that routinely contain special categories of data (health, legal privilege, security incidents) and an organisation that is unwilling to rely on redaction.

What changes architecturally

Surprisingly little. The adapter interface that lets us choose between OpenAI, Gemini and Claude can point at a self-hosted inference server running an open model instead. The permission filter, the request-scoped design, the logging rules and the human-confirmation steps are unchanged. What does change is operational: you own model selection and evaluation, GPU capacity, patching, monitoring and the quality gap between open and frontier models for your tasks. The ICO guidance quoted earlier notes that running models locally reduces what leaves the environment but does not remove the controller’s obligations, which is a useful corrective to the idea that self-hosting is automatically compliant.

OptionData leaves your environment?Who owns model quality and updatesTypical fit
Cloud provider, paid tier, no training, documented retentionYes, transiently, under contractProviderMost SaaS products; this project
Cloud provider with zero data retention and regional processingYes, with stronger limitsProviderRegulated clients that accept an external processor with conditions
Self-hosted open model in your VPC or data centreNoYou (or your partner)Strict residency, no-external-processor policies, very high volume

Our private AI deployment work covers that third row: benchmarking open models such as the Llama, Mistral and Qwen families on a client’s own tasks, deploying them in a VPC or data centre with network isolation, and building private retrieval and assistants on top. The design principles in this article were written so that the same product could move to that model without a rewrite.

Checklist: adding AI to a product that holds confidential conversations

Use this as a gate before the first AI feature ships. It reflects what we would want to see on any messaging, support or collaboration product.

  1. The three layers of control (workspace, channel or object, interaction) are designed, and each has a named owner.
  2. The AI service reads data only through the same permission-checked APIs as the user interface, and this is covered by negative tests (a user cannot summarise a channel they cannot read).
  3. No background or scheduled job sends content to a model; every provider call is traceable to a user action.
  4. Each AI request carries a bounded window of content and a minimal set of identifiers; a redaction step exists and is tested.
  5. Every provider in use is on a tier whose published terms state that content is not used for training, with retention documented, linked and dated in your decision log.
  6. Outputs are drafts; any action that creates or sends something requires a human confirmation.
  7. AI logs record metadata, not content, and have their own retention period.
  8. Prompt templates are versioned; content is delimited from instructions; the model has no tools during read-only features.
  9. Per-user and per-workspace rate limits are in place for AI requests.
  10. The privacy notice describes the AI data flow accurately, and a review date is set for provider terms.
  11. A migration path to self-hosted models exists on paper, even if you never use it.

If you are also deciding how much agency to give AI features beyond read-only summaries, our article on customer support AI agent architecture describes the escalation and guardrail patterns we use once the model can act.

Frequently asked questions

Did you build your own model for the messaging product?

No. The product uses OpenAI, Google Gemini and Anthropic Claude through a single internal interface. Building or fine-tuning a model was not needed for summaries, smart replies and action items, and it would have added a second copy of conversation data to manage. The interface is designed so that a self-hosted open model can be added later if a client requires it.

Can an administrator read AI summaries of channels they are not in?

Not in the design we describe. Summaries are generated on request, only from messages the requesting user can read, and are private to that user unless they choose to share them. An administrator can switch AI features on or off, but switching them on does not grant read access to anything.

Are conversations used to train the AI providers’ models?

The providers used were selected on tiers whose published terms state that API content is not used to train their models, with retention periods documented. We record those commitments with links and dates and review them on a schedule, because provider terms change over time.

How do you stop prompt injection through chat messages?

Message content is delimited from instructions in the prompt template, the model has no tools during read-only features such as summarisation, outputs are validated and rendered as plain text, and any downstream action such as creating a task requires a human confirmation. These layers mean an injected instruction has nothing to act on.

What would make you recommend self-hosted models instead?

A policy or contract that prohibits any external processor for message content, residency requirements the providers cannot meet for every endpoint, or request volumes where self-hosting is cheaper. The architecture in this article moves to a self-hosted inference server by changing the provider adapter, not the product.

How long did the AI features take relative to the messaging core?

We do not publish project-specific effort figures. As an illustrative guide, on a product of this type the AI features are a modest share of the total build; the larger effort goes into real-time messaging, permissions, desktop packaging and integrations, which the AI features then depend on.

Sources and methodology

Guidance reflects PoliteTech delivery experience. The external references below informed specific points in this article.

  1. OWASP GenAI Security Project: OWASP Top 10 for LLM Applications 2025 — accessed 10 November 2026. Prompt injection, sensitive information disclosure, excessive agency and unbounded consumption as core LLM application risks.
  2. Information Commissioner’s Office: How should we assess security and data minimisation in AI? — accessed 10 November 2026. Data minimisation principle applied to AI, mapping personal data flows, design-stage minimisation, and the note that local processing does not remove controller obligations.
  3. OpenAI: Your data (API data usage and retention guidance) — accessed 10 November 2026. API data not used for training unless opted in, default abuse-monitoring retention of up to 30 days, and zero data retention availability for eligible customers.
  4. Anthropic Privacy Center: How long do you store my organization’s data? — accessed 10 November 2026. Default deletion of API inputs and outputs within 30 days and the exceptions to it.
  5. Google AI for Developers: Gemini API Additional Terms of Service — accessed 10 November 2026. Distinction between paid and unpaid services in how Google uses prompts and responses, and the warning against sensitive data on unpaid services.

Adding AI to a product that already holds confidential data?

We can map the data flows, set the privacy boundaries and build the AI layer so it can run on cloud providers or inside your own environment.