Technology7 min read

Customer identity stitching for AI agents across email, WhatsApp, web chat, and SMS

by Alex

Customer identity stitching for AI agents across email, WhatsApp, web chat, and SMS

Why identity stitching becomes the bottleneck for omnichannel AI agents

When an AI agent works in a single channel, “customer context” is usually whatever that channel provides: an email address, a phone number, a chat session ID, or a WhatsApp handle. The moment you run the same agent across email, WhatsApp, web chat, and SMS, the agent needs a stable way to answer one question: “Is this the same person?” Without a stitching layer, you get duplicated profiles, broken histories, inconsistent policy enforcement, and agents that ask customers to repeat themselves.

The hard part is not matching identifiers. The hard part is doing it without breaking privacy, while honoring consent, and while staying resilient to account sharing, recycled phone numbers, forwarded email threads, and channel-specific identity quirks.

Start with principles, not a matching algorithm

1) Minimize what you store

Your stitching layer should not become a shadow CRM. Store only what is needed to route conversations, enforce consent, and fetch context from systems of record. In practice, that means keeping a small set of stable internal IDs plus metadata about how you arrived at a match.

2) Treat consent as a first-class object

Consent is not a checkbox. It’s a scoped permission that changes by channel, purpose, and time. A customer may consent to transactional SMS but not marketing, or allow WhatsApp support but not cross-channel personalization. Your identity layer must attach consent state to identities and make it queryable by agents before any action (sending messages, pulling sensitive data, updating systems).

3) Prefer deterministic links, then probabilistic hints

Deterministic links are verifiable connections like a login, an OTP challenge, a signed link, or an explicit “yes, that’s me” confirmation. Probabilistic hints (device signals, IP, behavioral similarity) can help reduce friction but should not be used to reveal sensitive information or to merge accounts irreversibly without confirmation.

A reference architecture for identity and context stitching

Core objects

  • Person: Your canonical customer entity. It contains an internal ID and references to linked identifiers.
  • Identifier: Channel-specific IDs (email address, phone number, WhatsApp number, chat user ID, CRM contact ID). Store normalized values and verification status.
  • Conversation: A thread boundary. Each message belongs to a conversation that has a channel and a linked Person (or is unlinked).
  • Consent: Purpose-based permissions per channel and per identifier, with timestamps, source, and proof (e.g., opt-in record).
  • Context pointers: References to data stored elsewhere (CRM case, order ID, billing account). Avoid copying full records into the stitching layer.

Services in the layer

  • Normalization & hashing: Normalize phone numbers (E.164), lower-case emails, strip formatting, and hash where appropriate.
  • Linking service: Rules engine that creates links, proposes links, or rejects links.
  • Consent gatekeeper: Central decision point for “can the agent do X now?”
  • Audit trail: Append-only logs of linking decisions, consent checks, and data fetches.
  • Policy engine: Data minimization, redaction, retention, and escalation policies enforced consistently across channels.

Channel-specific realities and how to stitch safely

Email

Email is deceptively unreliable as identity. Shared inboxes, aliases, and forwarding can blur who is speaking. Treat the email address as an identifier, but require stronger confirmation before showing account-specific details. A common pattern is a “magic link” that authenticates the user in web chat, then links that session back to the email conversation deterministically.

SMS

Phone numbers recycle. SIM swaps happen. For low-risk tasks (status updates, generic FAQs), a phone number match may be enough. For account changes, payments, or refunds, require step-up verification: OTP, knowledge-based confirmation (carefully), or authenticated web session handoff.

WhatsApp

WhatsApp identity is strongly tied to the phone number, but consent and message templates may differ by region and use case. Keep WhatsApp consent separate from SMS consent even if the identifier is the same number, and store the proof of opt-in at the channel level.

Web chat

Web chat sessions are ephemeral. If the user logs in, you get a strong deterministic key (account ID). If not, you should treat the session as anonymous and avoid auto-linking based on device signals. Use progressive disclosure: capture minimal details first, then ask for verification only when the intent requires it.

Matching logic that won’t burn you later

Use a link confidence model with “merge” and “associate” states

Identity stitching often fails because every match becomes a permanent merge. Instead:

  • Associate: “This conversation may relate to this Person.” Useful for routing and context suggestions, not for revealing sensitive data.
  • Link: Deterministic, verified connection between an identifier and a Person.
  • Merge: Administrative action with review, used when two Persons are proven duplicates.

Design for step-up verification

Agents should follow a simple rule: the higher the risk, the stronger the required identity proof. Pair this with clear UX: explain why verification is needed and what will happen next. This is where hybrid workflows matter: if verification fails or signals conflict, route to a human with a concise audit trail.

Keep sensitive context out of prompts by default

The stitching layer is a good place to enforce prompt hygiene. Instead of dumping customer data into an LLM prompt, fetch only what is needed for the current intent, then redact or summarize. If you want a practical approach to keeping notes usable while protecting personal data, the principles in this guide to redacting PII and PHI without losing searchability are directly applicable: LLM-proof meeting notes redaction playbook.

Privacy, consent, and governance controls that actually work

Make consent checks mandatory and observable

Every outbound action and every sensitive data read should pass through the consent gatekeeper and be logged. This makes policy enforcement consistent across email, WhatsApp, web chat, and SMS, and simplifies audits.

Retention and deletion must propagate

If a customer requests deletion, your stitching layer must delete or anonymize identifiers and sever links, and it must propagate deletion requests to downstream stores where required. Store references to systems of record, not copied datasets, to reduce blast radius.

Defend against injection and channel abuse

Identity stitching increases the value of any conversation endpoint. Treat public-facing channels as hostile: attackers will try to coerce the agent into revealing linked context. Pair your identity layer with endpoint hardening and progressive trust checks. A useful mental model is “cold-start defense” for new or suspicious sessions: Cold-start defense for public AI agent endpoints.

How Typewise fits into an identity-aware agent stack

Platforms that sit above existing systems are in a good position to standardize identity, consent, and policy enforcement across channels. Typewise, for example, is built for omnichannel customer experience agents that can read and write across business systems while keeping humans in control through approvals and handoffs. If you’re designing a stitching layer, anchor it to an agent platform that can consistently apply policies and orchestrate multi-step workflows across email, WhatsApp, web chat, and SMS, rather than rebuilding those controls separately per channel. The best place to start is seeing how typewise.app positions the AI-native layer above your CRM, billing, and knowledge tools.

A practical rollout plan

Phase 1: Unify identifiers and audit logs

Normalize identifiers, implement the audit trail, and keep linking conservative. Focus on observability: how often do you mis-link, and where does consent get ambiguous?

Phase 2: Add step-up verification and purpose-based consent

Introduce risk tiers for intents (order status vs. refunds vs. account changes), then require stronger proof only when needed.

Phase 3: Expand context pointers and policy enforcement

Integrate with CRM and order systems using pointers, not copies. Enforce retention, redaction, and escalation consistently across channels.

FAQ