Skip to main content

React Native SDK

The Orbit React Native SDK (@devotel-orbit/react-native) embeds Orbit’s end-user-facing surfaces into iOS and Android apps: in-app chat (the same omnichannel conversation/inbox the web widget uses), owned in-app messages and content cards, and video rooms. It ships a headless OrbitChatClient plus a useOrbitChat hook, an OrbitInAppClient for the in-app feed, and an engine-injected OrbitVideoRoomClient for video rooms. This is a client SDK: it authenticates only with a publishable key (dv_live_pk_…), because it ships inside a distributed app binary. It intentionally does not wrap the server-side management resources (messaging, voice, contacts, campaigns, verify) — those require a secret key and belong in your backend, via the Node SDK or the REST API. See Client / mobile SDKs (different scope, by design) on the SDK index.
Pre-publish — source-only. The React Native SDK is not yet on npm — the install line below fails today. Until first publish, vendor the source from the monorepo (packages/sdk-react-native/) or build against the same conversations API the web widget uses.

Installation

The package is TypeScript-first with published type declarations. react and react-native are optional peer dependencies — needed only if you use the hook.

The useOrbitChat hook

The hook subscribes a screen to an Orbit conversation: it connects on mount, tears down on unmount, and returns the live message list, connection status, typing indicator, and send methods.

Headless chat client (OrbitChatClient)

Prefer the hook for screens; use the headless client directly for non-React code paths. Pass a storage adapter (for example @react-native-async-storage/async-storage satisfies the shape unmodified) to keep the conversation across app launches.
chat.on(...) returns an unsubscribe function; call chat.disconnect() to stop the real-time stream and retain the conversation id.

In-app messages and content cards (OrbitInAppClient)

Owned in-app surfaces — assembled server-side into a per-visitor feed with assembleInAppFeed ordering rules kept in lockstep with the server, rendered locally, with impression / click / dismiss reported back. Dismissals persist across launches through the storage adapter.

Video rooms (OrbitVideoRoomClient)

Headless and engine-injected: your backend mints the room token server-side (POST /api/v1/video/rooms/:id/join) and hands the token plus server URL to the app. Wire a VideoRoomEngine over your native WebRTC stack (for example @livekit/react-native) — the package carries no hard WebRTC dependency. Inbound WebRTC video only.

Error handling

API failures surface as a typed OrbitApiError carrying the HTTP status and responseExcerpt; when the server sends a Retry-After hint it is parsed onto retryAfterSeconds (check "retryAfterSeconds" in err), so a 429 can be throttled instead of retried in a hot loop. Construction misuse — an empty key or a server-side secret key (dv_live_sk_… / dv_test_sk_…) — throws Error at the constructor.
Only the publishable key (dv_live_pk_… / dv_test_pk_…) may be embedded in the app — the client refuses a secret key at construction, because anything bundled in a distributed binary is extractable by any user. Real-time updates use header-authenticated polling, so the key never lands in a URL log.