Skip to main content
Every inbound message passes through Lola Send’s authentication pipeline before reaching any agent. The middleware chain normalizes sender identity, queries the identity service, and injects verified metadata into the message context. No unauthenticated message reaches an agent.

Message authentication flow

1

Message arrives via channel connector

The inbound message enters through a channel connector (WhatsApp, Telegram) and is normalized into Celai’s internal message format.
2

Command authorization check

CommandsAuthMiddleware inspects the message for slash commands. If the message is a command, it verifies whether commands are enabled for this deployment and whether the command is authorized.
3

Phone number normalization

PayhubAuthMiddleware normalizes the sender’s phone number to a standard international format before any identity lookup occurs.
4

Identity service query

PayhubAuthMiddleware queries the identity service using the normalized phone number to fetch the sender’s profile and compliance status.
5

Identity found — metadata injection

If the sender is found, their identity is injected into the message metadata as a ContextUser object containing verification status, payment method summaries, and identity details. The message proceeds to the LogicRouter for agent selection.
6

Identity service unavailable — graceful degradation

If the identity service returns a 404 or is unreachable, the unavailable_service flag is set on the message metadata. The message is not blocked — it is routed to the service unavailable agent for graceful degradation.
7

LogicRouter evaluates authenticated identity

The LogicRouter reads the authenticated identity from the message metadata and selects the appropriate agent: onboarding, sender home, blocked, pending CIP, or service unavailable.

Phone normalization

All phone numbers are normalized to a standard international format before any identity lookup. This prevents identity spoofing through different phone number format representations. For example, +1-555-0100, 15550100, and +15550100 all resolve to the same canonical form before the identity service is queried. Without normalization, a sender could potentially present different identities by varying their phone number format.
Phone normalization runs before the identity lookup. If normalization logic is misconfigured, the identity service query will fail to match the sender, routing them to the onboarding flow instead of their verified agent. This is a fail-safe behavior — the sender never gains elevated access due to a normalization failure.

ContextUser

The authenticated sender object provides agents with the following verified data:
FieldDescription
IdentitySender’s name, phone number, and internal identifier from the identity service
Verification statusCompliance verdict: passed, pending, or blocked
Card payment methodsDisplay names only (e.g., “Visa ending 1234”) — no raw card data
Payment method summariesAvailable payment method types and their display identifiers
Agents receive this object as part of the message context. They cannot modify it, and they cannot access fields beyond what the identity service provides.

Session tokens

JWT tokens with EC key pairs secure communication between Lola Send and the frontend web widgets used for identity verification and card authorization:
PropertyDetails
AlgorithmElliptic curve (EC) key pairs
ScopeBound to a specific ticket ID and operation context
PayloadTicket ID, CIP services URL, theme URL, fail callback URL
LifetimeShort-lived — scoped to a single widget interaction session
Tokens are generated when the agent creates a ticket for an out-of-band operation (CIP verification, card authorization). The widget uses the token to authenticate its requests to Lola Send’s callback endpoints.
Authentication is non-blocking by design. If the identity service is unavailable, the sender is routed to a graceful degradation agent rather than receiving an error. This ensures the messaging channel remains responsive even during backend outages.

Configuration and control

The bank controls several aspects of the authentication pipeline:
MechanismWhat the bank configures
Identity serviceThe backend identity service that PayhubAuthMiddleware queries — the bank owns this service
Middleware orderingThe sequence of authentication middleware in the pipeline
Command authorizationWhether slash commands are enabled and which commands are allowed
Channel allowlistingWhich phone numbers can interact with Lola Send in a given deployment
JWT key pairsEC key pairs used for widget session tokens