Skip to main content

iOS Configuration

LovinaChatConfig

The LovinaChatConfig struct holds all configuration options for the chat widget.

let config = LovinaChatConfig(
websiteToken: "your-website-token",
baseUrl: "https://chat-prod.ailovina.com",
locale: "en",
colorScheme: "auto",
user: nil,
displayMode: "fullscreen",
theme: nil,
branding: nil,
texts: nil,
features: nil
)

Fields

ParameterTypeDefaultRequiredDescription
websiteTokenString--YesYour Lovina website token for this agent. Obtained from the Lovina dashboard -- each agent has its own token.
baseUrlString--YesBase URL of your Lovina instance (e.g., https://chat-prod.ailovina.com).
localeString"id"NoWidget locale code. Supported values include "id", "en", "ar".
colorSchemeString"auto"NoDark mode preference for the widget. Accepts "light", "dark", or "auto" (follows system theme).
userLovinaChatUser?nilNoPre-identified user to associate with the conversation. See below.
themeLovinaThemeConfig?nilNoTheme color and layout overrides. Only primaryColor is required in practice -- see Theming. Colors are hex Strings, not UIColor.
brandingLovinaBrandingConfig?nilNoWhite-label branding overrides (logo, brand name, "powered by" footer).
texts[String: Any]?nilNoUI string overrides, keyed by translation key.
featuresLovinaFeatureFlags?nilNoFeature-flag overrides.
displayModeString"fullscreen"NoWidget display mode. Accepts "popup", "sidebar", or "fullscreen".
hideKeyboardAccessoryBarBooltrueNoSuppress WebKit's keyboard form-assistant bar while the chat widget's WebView is focused. Scoped to this widget's WKWebView instance only.

Theming

Only LovinaThemeConfig.primaryColor is required in practice -- every other color is auto-generated by the widget to meet WCAG AA contrast. Colors are hex strings (e.g. "#6366F1"), not UIColor:

LovinaChatConfig(
websiteToken: "your-website-token",
baseUrl: "https://chat-prod.ailovina.com",
theme: LovinaThemeConfig(
primaryColor: "#6366F1",
fontFamily: "Inter, sans-serif",
bubbleRadius: 16
),
branding: LovinaBrandingConfig(
brandName: "Acme Support",
poweredBy: false
)
)

LovinaChatUser

The LovinaChatUser struct represents a pre-identified user.

ParameterTypeRequiredDescription
identifierStringYesUnique user ID in your system.
nameString?NoDisplay name.
emailString?NoEmail address.
phoneNumberString?NoPhone number (E.164 format recommended).
identifierHashString?NoHMAC hash for identity verification. Generate server-side.
customAttributes[String: Any]?NoArbitrary key-value metadata attached to the contact.

Example: Full Configuration

import LovinaChatSDK

let config = LovinaChatConfig(
websiteToken: "ws-tok-abc123",
baseUrl: "https://chat-prod.ailovina.com",
locale: "en",
colorScheme: "dark",
user: LovinaChatUser(
identifier: "user-12345",
name: "Jane Doe",
email: "jane@example.com",
identifierHash: "hmac-sha256-hash",
phoneNumber: "+6281234567890",
customAttributes: [
"plan": "premium",
"signup_date": "2025-01-15"
]
),
displayMode: "fullscreen",
theme: LovinaThemeConfig(
primaryColor: "#6366F1"
),
branding: LovinaBrandingConfig(
brandName: "Acme Support"
)
)