Loops AI Docs

Flow modes

Native entry points for virtual try-on, AI search, and size suggestion.

Beyond plain chat, the assistant exposes each flow as a first-class method on LoopsAIChatFragment. Call them after the chat is open (and ideally after onReady).

val fragment = LoopsAIChat.newFragment(config, listener = myListener)

Methods

MethodWhat it does
startVirtualTryOn(product: Map<String, String>)Start virtual try-on for a specific product.
startTryOnFromQuote()Try on the product currently quoted in the conversation.
suggestSize()Prompt the size-suggestion flow.
openWithSearch(query: String, productsOnly: Boolean = false)Open in AI search / escalation with a prefilled query.
sendMessage(text: String)Send a message on the user's behalf (e.g. a suggestion chip).
quoteProduct(product: Map<String, String>)Quote a product as a card above the input (no message sent); pairs with clearProductQuote() and startTryOnFromQuote().
clearProductQuote()Clear the active product quote.
syncCustomerDetails(customerId: String)Sync a known customer (e.g. after login) to personalize chat/size/recommendations.
setWebsiteFont(fontFamily: String)Apply a CSS font-family so chat typography matches your app.
startNewConversation()Discard the resume pointer and reload a brand-new conversation.
closeOverlays()Close any open web overlay without unloading the WebView (wire to a back gesture).
fragment.startVirtualTryOn(mapOf("productCode" to "SKU123"))
fragment.suggestSize()
fragment.openWithSearch("linen shirts under 50", productsOnly = false)

This is the same typed bridge and action set as the iOS SDK, so both platforms drive identical flows.

Gating

Each flow is gated by the agent's configuration and the matching feature flag. If a flow is disabled for the agent (or by a flag), the call is safely ignored by the runtime — so it's good practice to only surface a native button when the flow is enabled.

Reacting to product quotes

When the conversation surfaces a product, the host is notified:

override fun onProductQuoteChanged(
  fragment: LoopsAIChatFragment,
  quote: LoopsProductQuote?
) {
  // quote == null means the quote was cleared
  val q = quote ?: return
  // q.code, q.name, q.image, q.vtoEnabled
}

Next: Links & routing.

On this page