Skip to content

Native SDK

Lane.Chat ships native SDKs for iOS (Swift) and Android (Kotlin). Each presents the Lane.Chat conversation inside your app, collects a privacy-aware device fingerprint, forwards push tokens, and shares one visitor identity across native and web.

Lane.Chat is SaaS-only; every SDK request targets the official Lane.Chat cloud.

What the SDK does

  • Presents the Lane.Chat conversation UI inside your app — open a link, share, and close, handled for you.
  • Collects a device fingerprint (IDFV/ANDROID_ID, model, OS, locale) — no ad IDs, no contacts, no location.
  • Forwards APNs/FCM tokens so Lane.Chat's servers send pushes; the client never holds your signing key.
  • Binds identify() traits and an external_user_id so one device maps to one visitor across native and web chat.

iOS

Install (Swift Package Manager)

In Xcode: File -> Add Package Dependencies... and add the LaneChat iOS SDK package, then select the LaneChatSDK product. Requires iOS 15+, Swift 5.9, Xcode 15.

Bootstrap

swift
import LaneChatSDK

// At launch:
LaneChat.initialize(appId: "YOUR_APP_KEY")

// Forward APNs tokens from your AppDelegate:
func application(_ application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    LaneChat.setDeviceToken(deviceToken)
}

Identify and open chat

swift
LaneChat.identify(userId: currentUser.id, traits: [
    "plan": currentUser.plan,
    "email": currentUser.email,
    "order_id": "X-42"
])

LaneChat.showChat(from: self)   // agents see the traits alongside the chat

Events and logout

swift
LaneChat.track("checkout_started", properties: ["cart_total": 42.0])
LaneChat.reset()   // wipe identity on logout

iOS public API

MethodPurpose
LaneChat.initialize(appId:endpoint:)Bootstrap. Call once at launch.
LaneChat.identify(userId:traits:)Bind an end-user.
LaneChat.showChat(from:)Present the widget modally.
LaneChat.chatViewController()Get a UIViewController for custom embedding.
LaneChat.setDeviceToken(_:)Forward an APNs token.
LaneChat.track(_:properties:)Custom events.
LaneChat.reset()Wipe identity on logout.

UI methods must be called on the main thread; the rest are thread-safe.

Android

Install

Add the LaneChat Android library to your Gradle build (chat.lane:sdk). Requires minSdk 24, Kotlin 1.9+, Java 17.

Bootstrap

kotlin
class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        LaneChat.initialize(this, appId = "YOUR_APP_KEY")
    }
}

Register the bundled FCM service in AndroidManifest.xml:

xml
<service
    android:name="chat.lane.sdk.LaneChatMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Identify and open chat

kotlin
LaneChat.identify(
    userId = "alice_123",
    traits = mapOf("plan" to "pro", "email" to "[email protected]", "order_id" to "X-42")
)

LaneChat.showChat(context)   // agents see plan / email / order_id alongside the chat

Prefer embedding? Use LaneChat.chatFragment() inside your own nav host.

Android public API

MethodPurpose
LaneChat.initialize(context, appId, endpoint?)Bootstrap.
LaneChat.identify(userId, traits?)Attach a logged-in user.
LaneChat.showChat(context)Launch chat full-screen.
LaneChat.chatFragment()Embed chat as a Fragment.
LaneChat.setDeviceToken(token)Forward an FCM token.
LaneChat.track(event, properties?)Custom event.
LaneChat.reset()Clear identity.

Push notifications

You never ship signing keys in the app. Upload your credentials once on the dashboard, and Lane.Chat's servers dispatch pushes to the tokens the SDK registers.

  • iOS — enable Push Notifications for your App ID, generate an APNs Auth Key (.p8, preferred) or certificate (.p12), and upload it in the dashboard.
  • Android — in Firebase, generate a service-account private key (JSON) and upload it in the dashboard. Register the bundled FCM service (above).

Shared identity across native and web

The SDK carries its device fingerprint and identity into the chat session, so the server reuses the same visitor record the SDK created — one device, one visitor identity across native and web. Call identify() before opening chat and the same user is recognized on both.

Server endpoints

The SDKs talk to these endpoints (documented for reference — the SDK calls them for you). All responses use the standard { "code": 0, "message": "...", "data": { } } envelope.

EndpointAuthBody
POST /api/v1/sdk/sessionspublic{ app_id, fingerprint_hash, fingerprint, platform, sdk_version, app_version, os_version, device_id }{ session_token, expires_at, client_id, device_id }
POST /api/v1/sdk/identifyBearer session token{ user_id, traits }
POST /api/v1/sdk/push/registerBearer session token{ device_token, platform } (ios or android)
POST /api/v1/sdk/eventsBearer session token{ event_name, properties }

POST /sdk/sessions is public and returns a short-lived (7-day) JWT session_token. The SDK caches it and sends it as Authorization: Bearer <session_token> on the other three calls.

Rate limits (per app, fixed hourly window): sessions 10,000/hour and events 100,000/hour, each on its own bucket. Identify and push-register are not separately rate-limited.

Privacy

The SDKs collect only the fingerprint fields (device id, OS, model, locale, timezone, screen, network type, carrier, app/SDK version). No advertising IDs, IMEI/OAID, location, or contacts. A stable SHA-256 fingerprint hash (64 hex chars) is derived from the identity-bearing fields, using the same material list on both platforms.

Lane.Chat — AI customer support, multichannel CRM, and roleplay AI.