AI Integration Quick Reference
AI Integration Quick Reference
Prerequisites
| Requirement | Version |
|---|---|
| npm | 8.x or above |
| Node.js | 16 or above |
| React Native | 0.63 or above |
| Android minSdkVersion | 24 |
| iOS | 11.0 |
- App ID
- Region
- Auth Key (for development)
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
async-storage as a peer dependency:
Voice & Video Calling (Optional)
v2.4+ onwards, calling functionality lives in a separate package. Install it only if you need voice/video:- Android
- iOS
Add permissions to your Add the CometChat Maven repository to your project-level Ensure
AndroidManifest.xml:build.gradle:minSdkVersion is set to 24 in the buildscript ext block:Initialization
Theinit() method initializes the SDK and must be called before any other CometChat method. Call it once at app startup, typically in App.tsx.
- TypeScript
- JavaScript
APP_ID and APP_REGION with your credentials from the Dashboard.
Parameters
| Parameter | Type | Description |
|---|---|---|
| appID | string | Your CometChat App ID |
| appSetting | AppSettings | Configuration object built with AppSettingsBuilder |
AppSettings Options
| Method | Description | Default |
|---|---|---|
setRegion(region) | Region where your app was created (us, eu, in) | Required |
subscribePresenceForAllUsers() | Subscribe to presence events for all users | — |
subscribePresenceForRoles(roles) | Subscribe to presence for specific roles | — |
subscribePresenceForFriends() | Subscribe to presence for friends only | — |
autoEstablishSocketConnection(bool) | Let SDK manage WebSocket connections | true |
overrideAdminHost(adminHost) | Custom admin URL (dedicated deployment) | — |
overrideClientHost(clientHost) | Custom client URL (dedicated deployment) | — |
Presence Subscription
Choose how to subscribe to user presence (online/offline status):WebSocket Connection
By default, the SDK manages WebSocket connections automatically. To manage them manually:Next Steps
Authentication
Log in users with Auth Key or Auth Token
Send Messages
Send your first message