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 native method
on LoopsAIChatViewController. Call them after the chat is presented (and ideally
after loopsAIChatDidBecomeReady).
let vc = LoopsAIChat.present(from: self, config: config, delegate: self)Methods
| Method | What it does |
|---|---|
startVirtualTryOn(product:) | Start virtual try-on for a specific product. |
startTryOnFromQuote() | Try on the product currently quoted in the conversation. |
quoteProduct(product:) | Quote a product — show its card above the input so the user can ask about it (no message is sent). |
suggestSize() | Prompt the size-suggestion flow. |
openWithSearch(_:productsOnly:) | Open in AI search / escalation with a prefilled query. |
sendMessage(_:) | Send a message on the user's behalf (e.g. a suggestion chip). |
syncCustomerDetails(customerId:) | Enrich the session with a known customer (e.g. after login). |
setWebsiteFont(_:) | Match the chat typography to your app (CSS font-family). |
vc.startVirtualTryOn(product: ["code": "SKU123"])
vc.suggestSize()
vc.openWithSearch("linen shirts under 50", productsOnly: false)
// "Ask about this product" — quote it, then let the user type their question.
vc.quoteProduct(product: ["productCode": "SKU123"])quoteProduct(product:) shows the product as a card above the input (the same
"quoted product" UI used inside the conversation) without sending a message —
ideal for an "Ask about this product" button on a PDP. Pair it with
startTryOnFromQuote() and clearProductQuote(). The web embed exposes the same
capability as window.LoopsAI.quoteProduct({ productCode }).
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:
func loopsAIChat(_ vc: LoopsAIChatViewController,
didChangeProductQuote quote: LoopsProductQuote?) {
// quote == nil means the quote was cleared
guard let quote else { return }
// quote.code, quote.name, quote.image, quote.vtoEnabled
}Next: Links & routing.