Skip to main content
Prerequisites: npm 8+, the Node.js version your React Native release requires (22.13+ or 24.3+ for 0.88), React Native 0.65+ (async-storage 2.x needs it), credentials from CometChat Dashboard

Prerequisites

Get your credentials from the CometChat Dashboard:
  • App ID
  • Region
  • Auth Key (for development)
Auth Key is for development/testing only. In production, generate Auth Tokens on your server using the REST API. Never expose Auth Keys in production client code.
Migrating from v3 to v4? Your existing v3 app can be migrated directly — no need to create a new app. Follow the installation steps below to upgrade to the latest version of v4.

Installation

The React Native SDK needs async-storage at runtime but doesn’t declare it, so install it yourself:
No extra Gradle repository is needed. Async-storage 2.x autolinks like any native module, so the old local_repo Maven entry in android/build.gradle is not required. The ^2.1.2 range is also what the Calls SDK declares, so the same install works if you add calling later.

Voice & Video Calling (Optional)

v2.4+ onwards, calling functionality lives in a separate package. Install it only if you need voice/video:
These are the Calls SDK’s peer dependencies at the ranges it declares (@react-native-async-storage/async-storage ^2.1.2 is the sixth, already installed above); unpinned latest majors fail with ERESOLVE. See Calls SDK setup for the full calling setup.
Add permissions to your AndroidManifest.xml:
Add the CometChat Maven repository to your project-level build.gradle:
Ensure minSdkVersion is at least 24 in the buildscript ext block. Keep the compileSdkVersion, targetSdkVersion and buildToolsVersion your React Native template sets; don’t lower them:

Initialization

The init() method initializes the SDK and must be called before any other CometChat method. Call it once at app startup, typically in App.tsx.
Replace APP_ID and APP_REGION with your credentials from the Dashboard.
CometChat.init() must be called before any other SDK method. Calling login(), sendMessage(), or registering listeners before init() will fail.

Parameters

AppSettings Options

Presence Subscription

Choose how to subscribe to user presence (online/offline status):
See User Presence for more details.

WebSocket Connection

By default, the SDK manages WebSocket connections automatically. To manage them manually:
See Managing WebSocket Connections for manual control.

Next Steps

Authentication

Log in users with Auth Key or Auth Token

Send Messages

Send your first message