1. Introduction
Sanal AI
  • Introduction
    • ๐Ÿ’ฌ Sanal AI Integration
    • ๐Ÿค Overview
    • ๐Ÿš€ Getting Started
    • ๐Ÿ› ๏ธ Integration Flow
    • โœ… Checklist
    • ๐Ÿ”Œ Bridge Protocol
  • Data Sync
    • ๐Ÿ› ๏ธ Data Sync
    • ๐Ÿ“ Data Layout
    • ๐Ÿช Merchants
    • ๐Ÿ“‚ Categories
    • ๐Ÿท๏ธ Items
    • ๐Ÿ›’ Products
    • ๐Ÿ“ฆ Inventory
    • ๐Ÿ‘ค Customers
    • ๐Ÿงพ Orders
    • ๐Ÿงพ Variants & Combinations
  • API Requirements
    • ๐Ÿ”Œ API Requirements
    • API: `syncMerchants`
    • API: `syncCategories`
    • API: `syncItems`
    • API: `syncProducts`
    • API: `syncInventory`
    • API: `syncCustomers`
    • API: `syncOrders`
  1. Introduction

๐Ÿ› ๏ธ Integration Flow

๐Ÿ”„ App and Widget Workflow#

The host app (your app) and widget (Sanal AI's widget) follow this order every time the widget opens inside your host app:

Loading:
StepWhoAction
1HostLoad widget URL in WebView or iframe
2WidgetSend SANAL_READY when widget is loaded

Initializing:
StepWhoAction
3HostSend SANAL_INIT (user ID, auth token, language)
4HostSend SANAL_CART_SYNC (full cart + merchant ID)

During AI Chat:
StepWhoAction
5UserChats with the AI
6WidgetMay send SANAL_CART_ADD SANAL_CART_REMOVE or SANAL_CART_CHANGE
7HostUpdate your cart, then send SANAL_CART_SYNC again
SANAL_CART_ADD includes only uuid, quantity, modifiers, variant_groups, and variant_combinations. Your app resolves product details from your catalog.

Navigation / Exit:
StepWhoAction
8UserCan ask for 'Checkout', 'View Product' options in chat
9WidgetMay send SANAL_NAVIGATE_* (checkout, product, etc.)
10HostOpen the matching user screen in your app

๐Ÿ”„ Flow Diagram#

Previous
๐Ÿš€ Getting Started
Next
โœ… Checklist
Built with