ChatLira mobile SDKs
Choose your stack, download the SDK and connect support to your existing widget.
Flutter, Ionic/Capacitor, Swift and Kotlin open the real widget in a secure embedded web screen. React Native uses native UI.
For this SDK, add the /mobile/chat page origin to the widget’s allowed origins and publish. The public widget key is not a password. https://chatlira.com
Use a separate sessionScope without personal data for each account. On logout call resetSession(), then destroy(). This isolates local history; it is not SSO.
Files, external links and push are connected through SDK APIs and callbacks. The app obtains an FCM/APNs token and passes it to ChatLira after a visitor session is established.
A round chat button in your app
Add a compact button over your app screen. Tapping it opens the chat; the close button dismisses the chat and returns to the launcher. A full-screen option is also available.
Place the button inside the screen’s safe area, above your app’s bottom navigation.
Flutter · Android / iOS
Installation: Dart ≥ 3.10 · Flutter · webview_flutter. README + example/
Download SDK ↓# pubspec.yaml
dependencies:
upchat_flutter:
path: ./packages/upchat_flutter
# flutter pub getRound button
import 'package:flutter/material.dart';
import 'package:upchat_flutter/upchat_flutter.dart';
final options = UpchatOptions(
pageUrl: 'https://your-upchat.example/mobile/chat',
siteKey: 'YOUR_WIDGET_SITE_KEY',
sessionScope: 'guest',
locale: 'en',
);
Scaffold(
floatingActionButton: UpchatLauncher(
options: options,
label: 'Open support chat',
),
)Dedicated chat screen
Use this option when chat should be a separate screen in your app.
UpchatChat(
options: options,
onClose: () => Navigator.of(context).pop(),
)Ionic / Capacitor · Android / iOS
Installation: Capacitor · TypeScript · README + examples/
Download SDK ↓npm install ./upchat-capacitor-0.3.1.tgzRound button
import { createUpchatLauncher } from '@upchat/capacitor/native';
const options = {
pageUrl: 'https://your-upchat.example/mobile/chat',
siteKey: 'YOUR_WIDGET_SITE_KEY',
sessionScope: 'guest',
locale: 'en',
};
const launcher = createUpchatLauncher(container, {
...options,
buttonLabel: 'Open support chat',
});
// Call when permanently removing the component:
// launcher.destroy();Dedicated chat screen
Use this option when chat should be a separate screen in your app.
import { createUpchatFrame } from '@upchat/capacitor/native';
const chat = createUpchatFrame(container, {
...options,
onClose: () => chat.destroy(),
});
// container height: 100dvhSwift · iOS 15+
Installation: Xcode → File → Add Package Dependencies → Add Local… → Swift package. README + Examples/
Download SDK ↓Round button
import UpchatMobile
let config = try UpchatConfiguration(
pageURL: "https://your-upchat.example/mobile/chat",
siteKey: "YOUR_WIDGET_SITE_KEY",
sessionScope: "guest",
locale: "en"
)
UpchatLauncher(configuration: config)
.padding(20)In SwiftUI, place the button in an overlay with alignment: .bottomTrailing. UIKit apps can use UpchatLauncherButton.
Dedicated chat screen
Use this option when chat should be a separate screen in your app.
UpchatView(configuration: config, onClose: {
// Dismiss the support screen through your app.
})Kotlin · Android API 24+
Installation: Gradle · JDK 17 · Android SDK 35. README + example/
Download SDK ↓Round button
import android.view.Gravity
import android.widget.FrameLayout
import com.upchat.sdk.*
val config = UpchatConfig(
pageUrl = "https://your-upchat.example/mobile/chat",
siteKey = "YOUR_WIDGET_SITE_KEY",
sessionScope = "guest",
locale = "en"
)
val launcher = UpchatLauncher(this, config)
val size = (60 * resources.displayMetrics.density).toInt()
val position = FrameLayout.LayoutParams(size, size,
Gravity.BOTTOM or Gravity.END)
container.addView(launcher, position)
// onStart: launcher.setActive(true)
// onStop: launcher.setActive(false)
// onDestroy: launcher.destroy()Dedicated chat screen
Use this option when chat should be a separate screen in your app.
val chat = UpchatView(this, config, object : UpchatListener {
override fun onClose() { finish() }
})
setContentView(chat)Connect pause and resume to the app lifecycle. On account logout, wait for session reset to succeed before removing the old chat. File handling and complete examples are included in the archive README.
Files, external links and push are connected through SDK APIs and callbacks. The app obtains an FCM/APNs token and passes it to ChatLira after a visitor session is established.
React Native
What you need
A React Native app, an ChatLira widget and an HTTPS API reachable from the device. Examples use Expo Crypto for UUIDs; Expo SecureStore is optional for secure storage.
Expo is one integration option used in these examples. In bare React Native, provide your own cryptographically secure UUID v4 function and an optional secure-storage adapter; the SDK does not require Expo.
1. Install the package
Download the SDK archive into your app root and install it from the file. This is a locally distributed archive, not a published npm release. Run the Expo commands in an existing Expo project.
npm install ./upchat-react-native-0.3.4.tgz
npx expo install expo-crypto
npx expo install expo-secure-store2. Prepare your widget
In the dashboard, open Sites and widgets → Installation. Copy the selected widget key and API URL. Add https://mobile.example.com to the widget’s allowed origins and publish the settings; replace this address with your own stable app label. The SDK origin must match it exactly.
3. Add a support screen
Create one client instance for the intended user and session namespace. Place the component in a full-screen container. Theme settings load from the selected widget. The example uses one anonymous session.
Add a compact button over your app screen. Tapping it opens the chat; the close button dismisses the chat and returns to the launcher. A full-screen option is also available.
Round button
import { View } from 'react-native';
import * as Crypto from 'expo-crypto';
import { createUpchatClient, UpchatLauncher } from '@upchat/react-native';
const client = createUpchatClient({
apiUrl: 'https://api.your-upchat.example',
siteKey: 'YOUR_WIDGET_SITE_KEY',
origin: 'https://mobile.example.com',
sessionNamespace: 'my-app:guest',
randomUUID: Crypto.randomUUID,
});
export function SupportScreen() {
return (
<View style={{ flex: 1 }}>
<UpchatLauncher client={client} locale="en" />
</View>
);
}Dedicated chat screen
Use this option when chat should be a separate screen in your app.
import { UpchatChat } from '@upchat/react-native';
<UpchatChat client={client} locale="en" />Place the button inside the screen’s safe area, above your app’s bottom navigation.
Storage and account changes
The storage adapter is optional. To restore history across launches, use secure storage with asynchronous getItem, setItem and removeItem methods. Without an adapter, the session stays in memory. Create a separate client and sessionNamespace when accounts change; never share one user’s session with another.
Before account logout, call await client.logout() to remove the stored session, then client.dispose() when replacing the client. Closing the chat screen alone does not clear the session.
import * as SecureStore from 'expo-secure-store';
const storage = {
getItem: (key: string) => SecureStore.getItemAsync(key),
setItem: (key: string, value: string) =>
SecureStore.setItemAsync(key, value),
removeItem: (key: string) => SecureStore.deleteItemAsync(key),
};
// createUpchatClient({ ...options, storage })Attachments and permissions
Your app owns file selection. Pass an attachment-picker callback from your native picker to the component and configure the required Android/iOS permissions. The SDK uploads the selected file into the same conversation; widget settings control attachment availability.
The onPickAttachment callback returns {data, filename, mimeType}, or null on cancellation. Convert the local file URI to a Blob or ArrayBuffer in your app adapter. An optional onOpenAttachment(attachment, data) callback can save or open the downloaded Blob using app facilities.
type PickAttachment = () => Promise<{
data: Blob | ArrayBuffer;
filename: string;
mimeType: string;
} | null>;An operator’s reply, delivered as a notification
Connect FCM for Android or APNs for iOS in widget settings. The SDK registers the device and opens the correct conversation on tap. Push contains no message text. App credentials, user permission and device delivery testing are required.
Included in this version
Native chat, paginated history, network recovery, attachments and operator ratings. FCM/APNs push connects with your app credentials; verified SSO is not included yet.
Test on a device
Open the chat screen on Android and iOS, send a message and reply from the operator dashboard. Check reopening, older history, an attachment and a rating after closing the conversation. Phones need a reachable API: localhost and your computer’s .local domains do not automatically work on the device.
In the standard Android Emulator, 10.0.2.2 points to the development computer; in iOS Simulator, use 127.0.0.1 with the reachable API port. Configure API routing and virtual hosts for that address. Physical phones need a reachable LAN address or HTTPS server. Mac domains such as api.widget.local do not resolve automatically on the device.
For a local HTTP API, add allowInsecureDevelopment: __DEV__ to createUpchatClient options. This permits HTTP only in debug builds; production requires HTTPS. The SDK flag does not change Android/iOS network policy: configure local HTTP access for debug builds only when needed.
allowInsecureDevelopment: __DEV__,