Package 

Class EmilyChatOptions


  • 
    public final class EmilyChatOptions
    
                        

    Configuration passed to EmilyChat.configure. Mirrors the JS EmilyInitOptions shape — the bridge serializes this straight into the INIT.payload object the web SDK consumes.

    EmilyChat.configure(
        EmilyChatOptions(
            serviceSid = "LV3-...",
            locale = "zh-Hans",
            metadata = mapOf("plan" to "pro", "tenantId" to 42),
        )
    )

    Note: there is no visual/branding option here. The widget's appearance (brand color, theme, header title, logos…) comes from the tenant's chat configuration on the Level3AI server, fetched by the web bundle at boot — nothing for the host app to pass.

    Note: metadata and attributes must contain only JSON-compatible values (String, Boolean, numeric types, null, or Map / List / org.json.JSONObject / org.json.JSONArray of the same). Non-JSON values surface as an EmilyChatEvent.BridgeError at open-time rather than crashing.

    • Method Detail

      • getServiceSid

         final String getServiceSid()

        The Emily service identifier issued to your tenant. Required.

      • getUserToken

         final String getUserToken()

        Opaque end-user token used by the backend to identify / authenticate the conversation owner. Optional for anonymous chats.

      • getLocale

         final String getLocale()

        BCP-47 language tag (e.g. "en", "zh-Hans"). null → auto-detect.

      • getMetadata

         final Map<String, Object> getMetadata()

        Free-form key/value bag forwarded to the backend on every message. Must be JSON-safe.

      • getAttributes

         final Map<String, Object> getAttributes()

        User-attribute map (name, email, avatarUrl, customFields…). Merged flat into the conversation's attributes — the same shape the web SDK's Emily.setAttributes() takes, so App and browser integrations land identical data on the backend. Keys that collide with Emily's own init options (serviceSid, userToken, locale, metadata, style, showLauncher, fullscreen) are dropped and reported as an EmilyChatEvent.BridgeError with stage "init.attributes". Must be JSON-safe.

      • getContainerUrl

         final String getContainerUrl()

        Overrides the container page the WebView loads. Default (null) is the sid-routed CDN — https://sdk.lv3.ai/native/mobile.html?sid=<serviceSid> — where the sid query drives the CloudFront edge router: it picks the tenant's environment and any server-side version pin, the exact same contract as the web embed's sdk.lv3.ai/emily.js?sid=… script URL. So there is nothing to configure per environment; the sid decides.

        Set this only for local development (e.g. "http://10.0.2.2:5174/mobile.html" against yarn preview:mobile, which additionally needs a cleartext opt-in — see the README) or an on-prem deployment. A custom URL is loaded verbatim — no sid is appended. If you append your own ?sid=, it only routes the bundle; the widget's configuration sid still comes from this class via the bridge INIT payload.