Appearance
Props reference
AWChatProps is the same shape on web and React Native unless noted.
Required (for live mode)
These four are required to talk to a backend. In demo mode they're optional.
| Prop | Type | Description |
|---|---|---|
userId | string | Your user id. Maps to Intercom external_id. |
sessionToken | string | JWT signed by your server (see Auth). |
serverUrl | string | AW Chat backend base URL on your infrastructure. |
telemetry | Telemetry | Device/app metadata (below). |
Telemetry:
| Field | Example |
|---|---|
appVersion | "6.1.4" |
hardwareId | "iPhone15,2", "web", "tma" |
osVersion | "iOS 17.4", "Android 14" |
deviceLang | "ru", "en" |
Optional
| Prop | Type | Default | Description |
|---|---|---|---|
user | { name?, email? } | — | Sets the Intercom contact's name/email (operator view). |
userDisplayName | string | — | Name on the user's own channel comments. See Comments. |
userAvatarUrl | string | — | Avatar on the user's own comments. Falls back to initials. |
theme | "light" | "dark" | "light" | Color scheme. |
locale | "ru" | "en" | "ru" | UI language. |
brandColor | string (hex) | glacial blue | Accent override. |
backgroundColor | { light?, dark? } | — | Optional screen background per theme. |
onClose | () => void | — | User backed out of hub/welcome — host should dismiss Support. |
initialRoute | "hub" | "chat" | "ticket" | "hub" | Deep-link target. |
targetId | string | — | Ticket id for initialRoute: "ticket". |
skipWelcome | boolean | false | Skip the welcome gate; open the hub. |
demo | boolean | false | Mock data, no network. |
fcmToken | string | — | FCM device token → mobile push. |
telegramChatId | string | — | Telegram user id → TMA push. |
pollingInterval | number (ms) | 4000 | Base poll cadence. |
onSessionExpired | () => void | — | Fired on 401 — host should refresh the JWT. |
onError | (error) => void | — | Global error callback ({ code, message }). |
Account switch
When userId / sessionToken change (logout → another user), remount <AWChat /> or ensure the live store re-inits. Otherwise channel/comment state from the previous user can linger for the session.
Web-only
| Prop | Type | Default | Description |
|---|---|---|---|
fill | boolean | true | Fill the host container vs fixed size. |
React Native-only
| Prop | Type | Description |
|---|---|---|
onPickFiles | () => Promise<PickedFile[]> | Required for attachments. Host native picker. Return { uri, name, type, size }[]. Without it, the attach control is hidden. |
tsx
onPickFiles={async () => {
const r = await ImagePicker.launchImageLibraryAsync();
return r.canceled
? []
: r.assets.map((a) => ({
uri: a.uri,
name: a.fileName!,
type: a.mimeType!,
size: a.fileSize,
}));
}}Deep linking
tsx
<AWChat initialRoute="ticket" targetId="t_12345" skipWelcome /* … */ />Push payloads include type (chat / ticket) and an id — map to initialRoute + targetId.