iOS Configuration
LovinaChatConfig
The LovinaChatConfig struct holds all configuration options for the chat widget.
let config = LovinaChatConfig(
websiteToken: "your-website-token",
baseUrl: "https://chat.lovina.app",
locale: "en",
colorScheme: "auto",
user: nil,
customColor: nil,
displayMode: "fullscreen"
)
Fields
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
websiteToken | String | -- | Yes | Your Lovina website channel token. Obtained from the Lovina dashboard. |
baseUrl | String | -- | Yes | Base URL of your Lovina instance (e.g., https://chat.lovina.app). |
locale | String | "id" | No | Widget locale code. Supported values include "id", "en", "ar". |
colorScheme | String | "auto" | No | Color scheme for the widget. Accepts "light", "dark", or "auto" (follows system theme). |
user | LovinaChatUser? | nil | No | Pre-identified user to associate with the conversation. See below. |
customColor | UIColor? | nil | No | Brand color for header and bubble theming. |
displayMode | String | "fullscreen" | No | Widget display mode. Accepts "popup", "sidebar", or "fullscreen". |
LovinaChatUser
The LovinaChatUser struct represents a pre-identified user.
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | String | Yes | Unique user ID in your system. |
name | String? | No | Display name. |
email | String? | No | Email address. |
phoneNumber | String? | No | Phone number (E.164 format recommended). |
identifierHash | String? | No | HMAC hash for identity verification. Generate server-side. |
customAttributes | [String: Any]? | No | Arbitrary key-value metadata attached to the contact. |
Example: Full Configuration
import LovinaChatSDK
let config = LovinaChatConfig(
websiteToken: "ws-tok-abc123",
baseUrl: "https://chat.lovina.app",
locale: "en",
colorScheme: "dark",
displayMode: "fullscreen",
customColor: UIColor(red: 0.39, green: 0.40, blue: 0.95, alpha: 1.0),
user: LovinaChatUser(
identifier: "user-12345",
name: "Jane Doe",
email: "jane@example.com",
phoneNumber: "+6281234567890",
identifierHash: "hmac-sha256-hash",
customAttributes: [
"plan": "premium",
"signup_date": "2025-01-15"
]
)
)