How it works
Every mobile SDK is a thin native wrapper around the same hosted chat page — so you get the full widget experience, updated server-side, with a small footprint.
The SDK loads the hosted chat page (/widget/mobile) inside a platform WebView. Your workspace id, locale, brand color, and visitor details are passed as query parameters, so the widget boots pre-configured and ready.
Widget events are forwarded from the page to your native code over a message channel, and native drives the widget back through an injected JavaScript API called AwnCareMobile. This two-way bridge is what powers identify, unread badges, and open/close control.
The hosted chat URL
This is the page each SDK loads. You normally never build it by hand — the SDK assembles it for you from the configuration you pass. The metadata parameter is base64url-encoded JSON.
iOS · Swift
A Swift package for UIKit and SwiftUI apps, distributed through Swift Package Manager.
Install
Add the package in Xcode from its Git URL, or declare it in Package.swift, then import AwnCareSDK.
Quickstart
Configure once with your workspace id, then present the chat full-screen from any view controller.
Identify the visitor
Attach who the visitor is so agents see a named contact. Update the locale or clear the identity on sign-out.
Events
React to the widget with closures on the shared instance, or by conforming to AwnCareDelegate.
Full-screen vs embedded
For full-screen, call AwnCare.present(from:). To embed the chat inside your own layout, add AwnCareChatViewController as a child view controller.
Android · Kotlin
An Android library for Kotlin and Java apps, distributed through JitPack.
Install
Add the JitPack repository and the dependency to your Gradle files, then import care.awn.sdk.AwnCare.
Quickstart
Configure once with your workspace id, then open the chat full-screen from any Activity or Fragment context.
Identify the visitor
Attach who the visitor is so agents see a named contact. Update the locale or clear the identity on sign-out.
Events
Register an AwnCareListener to receive ready, unread-count, conversation-started, and close callbacks.
Full-screen vs embedded
For full-screen, call AwnCare.open(context). To embed the chat in your own layout, place an AwnCareChatView in your XML and configure it from code.
Flutter
A Flutter plugin built on webview_flutter for iOS and Android from a single Dart codebase.
Install
Add the git dependency and webview_flutter to your pubspec.yaml, then run flutter pub get.
Quickstart
Configure once with your workspace id, then push AwnCareChatScreen as a full-screen route.
Identify the visitor
Attach who the visitor is so agents see a named contact. Update the locale or clear the identity on sign-out.
Events
Pass callbacks to AwnCareChatScreen, or subscribe to the global AwnCareEvents stream for app-wide handling.
Full-screen vs embedded
For full-screen, push AwnCareChatScreen with Navigator. To embed the chat, drop the AwnCareChatView widget anywhere in your widget tree.
React Native
A React Native component built on react-native-webview, installed straight from GitHub.
Install
Install the package and react-native-webview from npm, then install the iOS pods.
Quickstart
Render the AwnCareChat component with your workspace id and let it fill the screen.
Identify the visitor
Pass an identity prop, or drive the chat imperatively through a ref to call identify, setLocale, and logout.
Events
Handle events with the onReady, onUnreadCountChanged, onConversationStarted, onMessageReceived, and onClosed props.
Full-screen vs embedded
AwnCareChat is a plain View — render it full-screen, or inside any sized container to embed it.
Bridge & events
The same event contract underpins every SDK. Under the hood, the hosted page and your native code exchange messages over this bridge.
Events from the widget
The hosted chat page posts these events out to the native layer. Each SDK surfaces them as idiomatic callbacks, delegates, or listeners.
| Event | Payload | Description |
|---|---|---|
ready | — | The chat page has loaded and is ready to use. |
open | — | The chat window opened. |
close | — | The chat window closed — dismiss the screen or clear the badge. |
unread | { count } | The unread message count changed — update your app or icon badge. |
conversation:started | { conversationId } | A new conversation was created. |
message:received | { text, sender } | An agent or bot message arrived; sender is "agent" or "bot". |
The AwnCareMobile API
Native drives the widget by calling this JavaScript API, injected into the WebView. Every SDK wraps these calls in native methods so you rarely touch the bridge directly.
| Field | Type | Description |
|---|---|---|
identify(identity) | → void | Attach or update the visitor's identity (name, email, external id, metadata). |
setLocale(locale) | "ar" | "en" | Switch the widget UI language at runtime. |
logout() | → void | Clear the current visitor identity to start a fresh session. |
open() | → void | Open the chat window programmatically. |
Push notifications
Notify visitors on their phone when an agent or bot replies while the app is closed — using your own Firebase project.
Architecture — bring your own Firebase
AwnCare never bundles Firebase. The app owner brings their own Firebase project and pastes its service-account JSON into Integrations. The mobile SDKs feed device tokens tied to the current visitor, and the AwnCare server sends the push via the FCM HTTP v1 API whenever an agent or bot replies to a visitor who is offline.
Because you own the Firebase project, delivery, quotas, and APNs certificates stay entirely under your control. AwnCare only holds the service-account credential and the device tokens your app hands it.
Workspace setup
In the dashboard, open Integrations → "Push Notifications (FCM)", paste your Firebase service-account JSON, and press Connect. The connection is tested before it is saved, and the derived project id is shown on the card.
Wire device tokens & handle taps
In each app, hand the FCM device token to AwnCare via setPushToken (now and on every refresh), and open the conversation when the user taps a notification. The conversation id arrives in data.conversationId.
iOS · Swift
Fetch the token from FirebaseMessaging and forward it; handle the tap in your UNUserNotificationCenter delegate.
Android · Kotlin
Forward the token from FirebaseMessagingService.onNewToken, and post your own notification whose tap opens the chat.
Flutter
Forward getToken() and onTokenRefresh; open the chat screen from onMessageOpenedApp.
React Native
Forward messaging().getToken() to the chat ref, and navigate from onNotificationOpenedApp.
Payload contract
Every push AwnCare sends follows this shape. All data values are strings.
| Field | Value |
|---|---|
notification.title | Your workspace name. |
notification.body | The reply text — markdown stripped, truncated to 120 characters. |
data.conversationId | The id of the conversation to open when the notification is tapped. |
data.type | Always the literal string "awncare_message" — use it to detect AwnCare pushes. |