/cometchat-skills:cometchat-react-native-v5-sdkfrom cometchat-skills
Adds voice/video calling from scratch to React Native apps using the headless CometChat Calls SDK v5. Covers init, login, token generation, rendering, event listeners, in-call actions, meet-style rooms, and 1:1 ringing.
Ships in cometchat-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Ground truth:
@cometchat/calls-sdk-react-native@5+ catalogrn-calls-v5.json(the closed symbol list — everyCometChatCalls.*below exists in it). Official docs:/calls/react-native/**= v5 · Docs MCP. Fetch exactsessionSettingsfields, event names and action signatures from the docs (references/docs-map.md) — never memory. APPEND to the user's app — additive wiring only (RULES.md). This is the HEADLESS path (no UI Kit); for the prebuilt drop-in call UI usecometchat-react-native-callsinstead.
-core sibling; it is self-contained for meet-style calling.@cometchat/chat-sdk-react-native@4) for call signaling — signatures fetched from docs via references/docs-map.md (§ "1:1 RINGING"). It does NOT depend on the React Native UI Kit.cometchat-react-native-core + cometchat-react-native-calls — not this skill."add calling from scratch / without the UI Kit", "standalone voice/video in React Native", "build my own call screen", "headless calls SDK", "meeting-room join by session id", "one-on-one ringing call". Precondition: the caller chose the from-scratch / standalone path (the "add calling" router asks this). If they want the prebuilt call UI, route to cometchat-react-native-calls.
npm install @cometchat/calls-sdk-react-native@5
# 6 REQUIRED peer deps — versions are pinned by the SDK; do not float them
npm install @react-native-async-storage/async-storage@^2.1.2 react-native-background-timer@^2.4.1 \
react-native-performance@^5.1.2 react-native-svg@^15.12.0 [email protected] \
[email protected]
npm install @cometchat/chat-sdk-react-native@4cd ios && pod install && cd ... Add to ios/<App>/Info.plist:
<key>NSCameraUsageDescription</key><string>Camera access is required for video calls</string>
<key>NSMicrophoneUsageDescription</key><string>Microphone access is required for voice and video calls</string>
Xcode → target → Signing & Capabilities → Background Modes → Audio, AirPlay, and Picture in Picture (+ Voice over IP for ringing — references/ringing-voip.md).android/app/src/main/AndroidManifest.xml as <uses-permission android:name="android.permission.X" />:
INTERNET · CAMERA · RECORD_AUDIO · MODIFY_AUDIO_SETTINGS · ACCESS_NETWORK_STATE · BLUETOOTH (add android:maxSdkVersion="30") · BLUETOOTH_CONNECT.
API 23+ also requires a RUNTIME request (PermissionsAndroid.requestMultiple([CAMERA, RECORD_AUDIO]) or react-native-permissions) BEFORE starting a call. A manifest entry alone is not enough. A call that must survive backgrounding needs the FOREGROUND_SERVICE* family + WAKE_LOCK + POST_NOTIFICATIONS as well — references/ringing-voip.md § Part 2b.newArchEnabled as the app needs it. The SDK ships as a legacy native module and runs through RN's interop layer, so behaviour is identical on both.cometchat_whoami (connected + signed in?), cometchat_list_apps (ask which EXISTING app), cometchat_get_app_credentials. Mint auth tokens server-side for production; never ship the Auth Key. Rebuild the app after installing (npx react-native run-ios / run-android) — this is a native dependency, so Metro-only reload will not pick it up.CometChatCalls.initFromSettings(...) (once, check the result) → CometChatCalls.login(uid, authKey) or loginWithAuthToken(token) → then generateToken / render / listeners. Nothing renders or joins before init+login resolve.
CometChatCalls.initFromSettings(settings) — the ai-agent / telemetry-attributed path (persists integrationSource="ai-agent"), parallel to the chat core (RULES.md §5). It is INTENTIONALLY undocumented (ai-agent-only, @nodoc — DOCS-BACKLOG F4/C1), so the CometChatSettings shape is baked in references/docs-map.md; pass it INLINE (no physical cometchat-settings.json file needed). The publicly-documented CometChatCalls.init({ appId, region }) is the FALLBACK only.{ success: false, error: {...} } | { success: true, error: null }. A bare await CometChatCalls.initFromSettings(s) that ignores .success silently continues on a validation failure and the call fails later with a confusing error. Always branch on .success.generateToken; v5 has its own login/loginWithAuthToken and caches the token internally, so generateToken(sessionId) takes no auth token. Passing one is the v4 pattern.const u = await CometChat.getLoggedinUser(); if (u) await CometChatCalls.loginWithAuthToken(u.getAuthToken());. The token is a User method (getAuthToken()) — there is NO top-level CometChat.getUserAuthToken() on the RN Chat SDK (that name is on the Calls SDK; the migration doc's v4 tab shows it wrongly — DOCS-BACKLOG). Full note: references/docs-map.md § 1:1 RINGING.sessionId lands in the same call: generateToken(sessionId) → render <CometChatCalls.Component>. No ringing.CometChat.initiateCall → peer CallListener.onIncomingCallReceived → acceptCall/rejectCall → CometChatCalls.generateToken(call.getSessionId()) → render the Component. Fetch Chat-SDK signatures via references/docs-map.md § "1:1 RINGING".
⚠️ RINGING ALWAYS INCLUDES VoIP — build both halves, never ask. Signaling alone is a websocket event: it rings the callee only while their app is open, so backgrounded or killed they get nothing and the call times out (45s). Half a feature. Whenever ringing is chosen,
references/ringing-voip.mdis REQUIRED — emit the native VoIP setup in the SAME build and name the steps that are the user's (VoIP cert, Firebase, Xcode capabilities). Meet-style has no ringing and needs none of it.
CometChatCalls.init · CometChatCalls.initFromSettings · CometChatCalls.login · CometChatCalls.loginWithAuthToken · CometChatCalls.logout · CometChatCalls.getLoggedInUser · CometChatCalls.getUserAuthToken · CometChatCalls.isUserLoggedIn · CometChatCalls.addLoginListener / removeLoginListenerCometChatCalls.generateToken · CometChatCalls.Component (the React component you RENDER to join — there is no joinSession on React Native) · CometChatCalls.leaveSession · CometChatCalls.endSessionForAllCometChatCalls.addEventListener(eventName, cb, { signal? }) → unsubscribe() (event names: FETCH the full list from /calls/react-native/events)Component already renders all of these (see the first pitfall). Only reach for them when the user EXPLICITLY asks to replace the built-in controls: muteAudio/unmuteAudio/toggleAudio · pauseVideo/resumeVideo/toggleVideo · switchCamera · setLayout · startRecording/stopRecording/toggleRecording · startStreaming/stopStreaming · startTranscription/stopTranscription · raiseHand/lowerHand/toggleHand · pinParticipant/unpinParticipant · muteParticipant · pauseParticipantVideo · showParticipantList/hideParticipantList/toggleParticipantList · setChatButtonUnreadCountCometChatCalls.setAudioMode · CometChatCalls.AUDIO_MODECometChatCalls.enablePictureInPictureLayout / disablePictureInPictureLayoutCometChatCalls.CallLogRequestBuilder (verified against installed @cometchat/calls-sdk-react-native@5, 2026-09-10) — new CometChatCalls.CallLogRequestBuilder().setLimit(n).setAuthToken(CometChatCalls.getUserAuthToken() ?? "").build() → fetchNext(): Promise<CallLog[]> — every fetchNext() needs .setAuthToken(...) (no auto fallback; it rejects "Auth Token is required"). There is NO CometChat.CallLogRequestBuilder on the Chat SDK (@cometchat/chat-sdk-react-native, any version) — do not emit it. CometChatCalls.CallLog is the log model. For the transcript opt-in add .setHasTranscriptions(true) (filters to transcribed calls and attaches transcripts) — same token. Paginated history is the read — there is no working single-call-detail method (see deprecated note).CometChatCalls.Transcription · CometChatCalls.TranscriptRequestBuilder · TranscriptDeprecated v5 compat surface — do NOT emit:
CallSettingsBuilder,CallAppSettingsBuilder,OngoingCallListener,startSession,endSession,switchToVideoCall,getCallDetails(a@deprecated/unsupportedvoidNO-OP on the v5 class — the functionalPromise<CallLog[]>form is only on the v4-compat class; useCallLogRequestBuilder.fetchNext()). They still run (v5 is a drop-in for v4) but are the OLD API, and v5-only events never reach anOngoingCallListener. Use plain settings +addEventListener+leaveSession. Not on React Native at all (present on web — emitting them is a hallucination):joinSession,startScreenSharing/stopScreenSharing, virtual-background methods, audio/video device enumeration (getAudioInputDevices&c.). A symbol is real iff it's inrn-calls-v5.json— confirm THERE, then fetch its signature fromreferences/docs-map.md.
addEventListener RETURNS an unsubscribe function AND accepts { signal }. Prefer one AbortController per screen: pass signal to every listener and call controller.abort() in the effect cleanup — one teardown, no leaks. Register listeners BEFORE the Component mounts, and call CometChatCalls.leaveSession() on unmount. Never leak.
CometChatCallsis a SINGLETON with ONE active session. Mount exactly oneComponent. Every action (leaveSession,muteAudio,setLayout, ...) takes no session id — it always targets the active session. To move to another call:leaveSession()→ awaitonSessionLeft→generateToken(next)→ re-render with the new token.
// STRICT-TS-CLEAN: RN exports no settings type — narrow with `as const`, or inline the object
// in the JSX prop (as below) where contextual typing narrows it. A hoisted bare literal fails tsc.
import { useEffect, useState } from "react";
import { View } from "react-native";
import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
// 1. once at app start — ai-agent telemetry default; init({appId,region}) is the public-doc fallback
const res = await CometChatCalls.initFromSettings({
appId: APP_ID, region: REGION, credentials: { authKey: AUTH_KEY },
});
if (!res.success) throw new Error(res.error.message); // Result object, NOT a rejection
// 2. after the user authenticates
await CometChatCalls.login(UID, AUTH_KEY); // or loginWithAuthToken(token)
function CallScreen({ sessionId }: { sessionId: string }) {
const [callToken, setCallToken] = useState<string | null>(null);
useEffect(() => { // 3. listeners BEFORE the component mounts
const controller = new AbortController();
const { signal } = controller;
CometChatCalls.addEventListener("onSessionLeft", () => {/* pop the screen */}, { signal });
CometChatCalls.addEventListener("onParticipantJoined", (p) => {/* ... */}, { signal });
return () => { controller.abort(); CometChatCalls.leaveSession(); }; // 6. one teardown
}, []);
useEffect(() => { // 4. token BEFORE render
CometChatCalls.generateToken(sessionId)
.then(({ token }) => setCallToken(token))
.catch((e) => console.error(e.errorCode, e.errorDescription));
}, [sessionId]);
if (!callToken) return null; // or a loader
return (
<View style={{ flex: 1 }}> {/* MUST be sized */}
{/* 5. JOIN = RENDER. No joinSession on React Native. */}
<CometChatCalls.Component
callToken={callToken}
sessionSettings={{ sessionType: "VIDEO", layout: "TILE" }}
/>
{/* NO control buttons here — the Component already renders mute/video/camera/leave/layout. */}
</View>
);
}
Fetch the full sessionSettings field list from /calls/react-native/session-settings. On Android, request runtime CAMERA + RECORD_AUDIO permissions before this screen mounts.
npx expo prebuild, then declare perms in app.json (expo.ios.infoPlist NSCamera/NSMicrophone; expo.android.permissions CAMERA/RECORD_AUDIO/MODIFY_AUDIO_SETTINGS/BLUETOOTH_CONNECT) — NOT by hand-editing Info.plist/AndroidManifest (a prebuild discards manual edits). Build with npx expo run:ios / run:android or EAS.leaveSession(); do not keep a backgrounded Component mounted on a hidden tab.<CometChatCalls.Component> renders a COMPLETE call UI — mute, camera, switch-camera, layout, recording, participant list, raise hand and the red leave button. Do NOT add your own buttons around it; they duplicate the SDK's and drift out of sync. Action methods are for CUSTOM controls ONLY (only when the user EXPLICITLY asks) — hide the built-ins first via sessionSettings hide* flags.joinSession — does not exist on RN; joining IS rendering the Component. startSession is the deprecated v4 path.View with no flex: 1 or explicit height it renders invisibly. The RN analogue of web's zero-dimension container.initFromSettings/init resolve { success, error } rather than rejecting. await alone hides a validation failure.generateToken — the v4 pattern. In v5 you login() first and the SDK holds the token.getUserMedia prompt to fall back on.onSessionLeft, then join.leaveSession — every listener must be unsubscribed (or its AbortController aborted) and leaveSession() called on unmount.OngoingCallListener for v5 events — onSessionJoined, onConnectionLost, onLeaveSessionButtonClicked, onCallLayoutChanged and the onParticipant* family arrive ONLY via addEventListener; a v4 listener silently never fires for them.show* builder methods became v5 hide* props (showEndCallButton(true) → hideLeaveSessionButton: false; copying a v4 snippet inverts intent); and muteAudio(true|false) split into muteAudio()/unmuteAudio(), pauseVideo()/resumeVideo().^, no latest. The trap: react-native-performance 6.x is published but the SDK peer is ^5.1.2, and a floated ^6 makes every later npm install fail with ERESOLVE (surfacing long after). Mismatched react-native-webrtc fails at native link. Verify: npm ls react-native-performance react-native-webrtc.sessionSettings without narrowing (strict TS — the docs' own examples fail this). sessionType/layout/audioMode are string-literal unions, so a hoisted object literal widens them to string and fails tsc (TS2322). React Native exports NO settings type — CometChatCalls is the package's ONLY named export (verified against installed @cometchat/[email protected] .d.ts/.d.mts; there is no importable Transcript/CallLog/settings type), so web's "annotate as SessionSettings" trick is impossible. sessionType is "VOICE" | "VIDEO" — there is NO "AUDIO" value (a voice call is sessionType: "VOICE"). Narrow with as const, or keep the object inline in the JSX prop. When you DO need a model type, DERIVE it from the class: type CallLog = InstanceType<typeof CometChatCalls.CallLog>, and for the audio mode use (typeof CometChatCalls.AUDIO_MODE)[keyof typeof CometChatCalls.AUDIO_MODE]:
const sessionSettings = { sessionType: "VIDEO", layout: "TILE" } as const; // ✅
<CometChatCalls.Component callToken={token} sessionSettings={{ sessionType: "VIDEO" }} /> // ✅ inline
const bad = { sessionType: "VIDEO", layout: "TILE" }; // ❌ widens to string
The join-session/ringing Component-mount fences now narrow with as const (C15 fixed there), but /calls/react-native/session-settings still has illustrative fences that hoist a bare literal (TS2322 on copy). Narrow every hoisted sessionSettings.references/ringing-voip.md.sessionSettings fields and action params are FETCHED from docs, never guessed.CometChatCalls.* symbol emitted appears in rn-calls-v5.json (node test-suite/scripts/verify-catalog.mjs --family rn-calls-v5).@cometchat/calls-sdk-react-native@5 .d.ts (test-suite/typecheck/rn-v5).node test-suite/scripts/sdk-smoke.mjs --family rn-calls-v5 [--live|--dry] covers init→login→generateToken→listener-teardown. The media render is NOT covered — Component needs a real device/simulator with native WebRTC, so the node smoke proves wiring only. Verify the actual call surface on a simulator/device, and 1:1 ringing needs TWO logged-in clients (one client proves the outgoing half only). Flag "dry-mock only, not live-certified" honestly where true.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub cometchat/cometchat-skills --plugin cometchat-skills98 skills in this plugin
/cometchatEntry point for any CometChat task on any platform. Detects the framework + UI Kit version (React, Angular, iOS, Android, React Native, Flutter), then routes to that family's skills — for a NEW integration or a change to an existing one. Triggers: 'add chat', 'add cometchat', 'add chat to my app', 'add calling', 'change something in my chat', 'my chat is already set up', 'add a feature to the chat', 'add chat to my android app', 'integrate cometchat android', 'add chat to my ios app', 'integrate cometchat ios', 'add chat to my swift app', 'migrate my app to cometchat', 'migrate from sendbird', 'migrate from getstream / stream', 'replace sendbird / stream chat with cometchat', 'build a <app> clone', 'make a chat app like <app>', 'make it look and work like <app>'./cometchat-a11yKeep a CometChat integration accessible — the UI Kit is designed targeting WCAG 2.1 AA with keyboard navigation (verify per component in its docs; full conformance still needs manual testing), and this skill makes sure the HOST app doesn't break that, covering contrast, focus, screen-reader context, reduced motion, RTL, and calls accessibility. Cross-family. Triggers: 'is cometchat accessible', 'WCAG / 508 / ADA compliance', 'screen reader support', 'keyboard navigation', 'a11y audit', 'accessible chat', 'contrast/focus issues in chat'.Other plugins' skills for the same job