cometchat-migrate-from-sendbird

v2026.09.25

Migrate an app from Sendbird to CometChat end-to-end in ONE prompt, on any platform in this pack (React, Angular, React Native/Expo, iOS, Android, Flutter). Inventories every Sendbird usage (Chat SDK v3/v4, UIKit, Calls, Desk, push, server Platform API, webhooks), swaps each supported feature for its CometChat equivalent, REMOVES features CometChat has no equivalent for (code, UI, deps), writes a data-migration script for users/groups/history, uninstalls Sendbird, verifies the build, and ends with a report listing what was migrated, what was removed and what you still need to do. Triggers: 'migrate my app from Sendbird to CometChat', 'migrate my app to CometChat' (Sendbird detected), 'replace Sendbird with CometChat', 'switch from Sendbird', 'move off Sendbird', 'sendbird to cometchat', 'port my Sendbird chat to CometChat'.

GitHub
安装命令
npx skhub add cometchat/cometchat-migrate-from-sendbird
Markdown
SKILL.md

Ground truth: the SENDBIRD side (what to look for) is baked in references/inventory.md + references/feature-map.md — confirm each hit by reading the user's code. The COMETCHAT side is never from memory: symbols come from the target family's skills + catalog, feature existence from that family's features.json, signatures from the docs via the family's -core/references/docs-map.md (Docs MCP first — RULES.md → Fetch discipline). REST pages live under DOCS_BASE = https://www.cometchat.com/docs.

Companion skills (read first)

  • cometchat-<family>-core — the init → login → render the migrated app lands on. <family> is resolved in step 1; this skill ASSUMES that core and never restates its code.
  • cometchat-<family>-components / -features / -calls / -push / -customization — pulled in only for the Sendbird features the inventory finds.

Use this skill when

The user asks to move an app off Sendbird: "migrate my app from Sendbird to CometChat", "replace Sendbird", "switch to CometChat", or "migrate my app to CometChat" when npx @cometchat/skills detect --json reports migrate_from with vendor sendbird. Stream/GetStream apps → cometchat-migrate-from-getstream. An app with BOTH vendors: run both skills, one after the other, into one report.

The single-prompt contract (read before step 1)

The migration request IS the approval (RULES.md → Competitor migration). Run every step below to the end in this one turn:

  • Do not stop to ask. No onboarding plan/approve gate, no clarification questions. Where a companion skill would ask, take the default written here, and record it under Defaults taken in the report.
  • Safety net instead of questions: in a git repo, first git switch -c cometchat-migration (carries any uncommitted work along; mention that in the report). Never commit, push, or rewrite history. No git → proceed and say so in the report.
  • Removing Sendbird is the requested outcome — RULES.md's append-never-replace does not protect Sendbird code. It still protects everything else: touch non-chat code only to rewire it.
  • Credentials: never ask, never provision. Reuse .cometchat/config.json or existing CometChat env values if present; otherwise write the family's env/settings file with clearly-named placeholders so the build still compiles, and make "add your CometChat credentials" action item #1. Never write a real key into a git-tracked file: check git ls-files <file> first. If the file is tracked, put real values in the untracked local variant the framework reads (Vite/Next .env.local, Android local.properties, …) and keep placeholders in the tracked file. Adding a tracked file to .gitignore does NOT untrack it. The server's REST API key only ever goes into an untracked file or the hosting env.
  • Only three STOPs: (1) no Sendbird usage found → say so and hand to cometchat; (2) the app's platform has no family in this pack (Vue, Unity, .NET, …) → deliver the inventory + feature map as the report, change nothing; (3) the build was already failing before you started → record the pre-existing errors, migrate anyway, and label them as pre-existing.

Migration workflow (BAKED — do every step, in order)

Every step applies to every app, however small: a 3-file sample still has vendor users and history, so steps 4 (toCometChatId) and 8 (data script) are ALWAYS delivered. Only a step whose subject truly doesn't exist (no server → step 7) may be skipped, and it's listed under Defaults taken as skipped: <why>. A silent skip is a failed migration.

  1. Detect. npx @cometchat/skills detect --json → framework, android_variant, existing_cometchat, migrate_from. Resolve <family> exactly like the router (peers.yaml dir_prefix; per-platform targets in references/inventory.md §Target family). Monorepo: migrate every package that uses Sendbird, including the server. existing_cometchat: true + Sendbird still present = a half-finished migration: resume it, don't redo it. Read .cometchat/config.json if it exists: its appId/region/authKey are THE credentials. Write them into the family's untracked env/settings file (single-prompt contract), never ask. Before editing anything, run the app's build once and record whether it passed.
  2. Inventory — the usage ledger. Grep per references/inventory.md (packages, imports, init/connect, UIKit components, handlers, collections, push registration, Calls, Desk, env vars, server Platform API calls, webhooks, tests/mocks). Record every hit as file:line → what it does. Classify the app: UIKit mode (Sendbird UIKit renders the chat) → the family's CometChat UI Kit replaces it; SDK mode (own UI on the Sendbird Chat SDK) → KEEP the app's UI and port its data layer to the family's CometChat Chat SDK; mixed → both.
  3. Feature map. For every Sendbird feature the ledger shows, look up its row in references/feature-map.md, then check the listed CometChat id in the TARGET family's features.json. Present → migrate. Absent → check BOTH levels — UI Kit (search_cometchat_docs "<feature> <platform> ui kit") AND Chat SDK/REST (… SDK); documented at either → migrate (no UI Kit drop-in is NOT unsupported), built with the SDK method in the app's own UI (RULES.md → UI Kit first, SDK fallback). Mark UNSUPPORTED only when NEITHER has it — and an empty MCP search is NOT proof: follow the verification ladder (re-query with CometChat vocabulary → live-fetch the likely docs page → cross-check the family CATALOG) in references/feature-map.md §Deciding unsupported, before any REMOVE. Never call a feature unsupported from memory or invent an API; if it truly can't be verified, KEEP it as needs-verification. Every UNSUPPORTED row needs evidence in the report — the features.json result + the exact UI Kit AND SDK queries you ran.
  4. Install CometChat and wire the core per cometchat-<family>-core (its install, initFromSettings, login gate, render order, env file). Identity: the CometChat UID is the app's existing Sendbird user ID passed through ONE shared toCometChatId() (references/concept-map.md §IDs) — used by the client login, the server token endpoint, AND the data script, so all three agree. Login: the app minted Sendbird session/access tokens on a server → migrate that endpoint (step 7) and use the auth-token login; the app connected with only a user ID → Auth Key login (dev only) + an action item to switch to tokens before production. Keep every identity source, in the same order: whatever decides the current user today (URL params, env vars like VITE_USER_ID, the auth provider, a stored ID, a demo fallback) still decides it after the migration. Only the Sendbird-token-derived path becomes the CometChat auth token. Dropping one silently logs a configured deployment in as someone else. NEVER replace a seeded identity with a placeholder. If the app ships a concrete default user (default_user_id/USER_ID/a demo fallback in strings, env or constants), that exact value STAYS — pass it through toCometChatId(), do not overwrite it with cometchat-uid-1, Cometchat User 1 or any YOUR_* stand-in. The core skill's placeholder UID is for an app that has NO identity yet; an app being migrated always has one. Getting this wrong is silent: the build passes, the app launches, and every migrated user signs in as a stranger with an empty inbox while the data script imported their history under their real id. Before you finish, diff every identity default you touched against its pre-migration value and confirm it is unchanged. Returning users: the app already persists who is signed in (localStorage, keychain, prefs, a cookie) from the vendor era. Gate the chat on CometChat's logged-in user, NOT that cached ID. On start, a stored ID with no CometChat session → run the same login path before rendering any CometChat component; if that fails → the sign-in screen. Otherwise every user who was signed in before the upgrade lands on a broken chat. No UI Kit family for this app? A headless / vanilla-JS app that draws its own UI on SendbirdChat / sendbird (no framework the pack ships a UI Kit for) has no -core to wire — do NOT stop. Install the CometChat Chat SDK for the platform (web → @cometchat/chat-sdk-javascript) and migrate the data layer straight onto it, taking every method from the SDK docs (/sdk/<platform>/*). Keep the app's own UI; there is no UI Kit to install. This is client/SDK mode with no framework core — the concept map's SDK/client-mode section still applies.
  5. Replace usage, file by file, using references/concept-map.md: Sendbird init/connect → CometChat init/login; channel list → conversations; group channel / 1:1 distinct channel → group / user conversation; handlers → listeners (remove them on unmount); message send/receive/edit/delete/threads → the core + -features skill; UIKit screens → the family's components (-components/-placement); theme/string sets → -customization; Calls → -calls (or the headless calls peer); push → -push. Remove each Sendbird import as you replace its last use. Both modes fetch from docs only: UI Kit component props AND SDK method signatures come from the live docs (the family core's docs-map.md), verified against the catalog — never written from memory or ported from the vendor's API shape.
  6. Remove unsupported features FULLY. For each UNSUPPORTED row: delete the feature's code path, its UI entry points (buttons, menu items, routes, screens, settings toggles), state/stores, types, hooks, assets, tests, env vars, server endpoints and dependencies — no dead buttons, no commented-out blocks, no feature flags left on. Keep the surrounding screen working. Log each one for the report: feature · what it did · files changed · what users lose · the closest CometChat alternative (if any).
  7. Server side. Replace Sendbird session/access-token minting with a CometChat auth-token endpoint (REST: create the user if missing, then create an auth token — /rest-api/auth-tokens, REST API key from server env only). Map Sendbird webhooks to CometChat webhooks (/rest-api/management-apis/webhooks/overview); drop or list any event with no equivalent. Replace other Platform API calls with CometChat REST, or remove + list them (step 6).
  8. Data migration script — write it, then run the import for the user. Generate scripts/cometchat-migration/ per references/data-migration.md: export users, channels, members and messages from the Sendbird Platform API → transform with the same toCometChatId() → import through the CometChat Data Import API. When the code migration is done, tell the user the data-import script is ready and ask for the credentials it needs — the source keys (SENDBIRD_APP_ID, SENDBIRD_API_TOKEN) and the CometChat App ID, Region and full-access REST API key. (Asking for these is the ONE question the single-prompt contract allows; everything else still takes the documented default.) As soon as the user provides them, RUN the import yourself from env vars — never write the secrets into a repo file: a --dry-run first (show the users / groups / members / messages counts), then the real import, then report what landed and what failed. Only messages within CometChat's 6-month retention window import — tell the user to reach out to CometChat to import messages older than 6 months. If the user does not share credentials, leave running the script as an action item.
  9. Uninstall Sendbird. Remove every Sendbird dependency (package.json + regenerate the lockfile, Podfile/SPM, Gradle dependency AND the Sendbird Maven repo, pubspec), CSS imports, fonts/icons, env vars, native config, and CI secrets references. Re-run the package manager install. On iOS/SPM the ROOT manifest counts too: a vendored-SDK repo declares the vendor in its own Package.swift/*.podspec at the repo root, not just in the app's .xcodeproj — remove the dependency there AND delete any vendored Framework/*.xcframework, or the vendor package is still declared after every call site is gone. Update the app's OWN docs (README, setup/deploy guides, .env.example): setup steps, env var names and screenshots captions that describe Sendbird now describe CometChat. Rename Sendbird-named identifiers (sendbirdUserId → userId).
  10. Verify (§Verify it works). Fix every build error you introduced. Don't run live tests unless asked (RULES.md → Verification scope).
  11. Report. Write COMETCHAT_MIGRATION.md at the repo root from references/report-template.md, then END your reply with its two lists pasted in full: Removed — not available in CometChat and Your action items. This final list is the deliverable the user asked for; never skip it, even if nothing was removed (say "none").

Common pitfalls

  • Accessibility is never a "missing feature". Sendbird-provided skip links, focus management, live regions and keyboard shortcuts are plain HTML/ARIA/host code. Re-create them in the app against the new CometChat layout, and never list them as Removed. Losing them is a regression, not an honest removal.
  • The provider swap moves wrapper elements. CometChatProvider (and, on web, CometChatErrorBoundary) render wrapper elements exactly where the vendor's provider sat. If they now wrap the app's own shell/header, each wrapper needs a height in the chain, or the chat renders at 0px while the build passes. Follow the core's layout reference, and check the chain from the root element down to the conversation list.
  • IDs that CometChat rejects or merges. UIDs/GUIDs are alpha-dash (a-z 0-9 - _), max 100 characters, and lowercased. Sendbird IDs can contain @, ., spaces or uppercase. Sanitize with one deterministic function and use it everywhere, or users log in to empty inboxes.
  • 1:1 chats are not groups. A distinct Sendbird group channel with exactly two members becomes a CometChat user conversation (receiverType: user), not a two-person group.
  • Large channels. CometChat sends receipts and typing indicators only in groups up to 300 members (100,000 without them). Supergroups over 300 keep chatting but lose receipts: list that as a behavior change.
  • Leftover handlers. Every Sendbird ChannelHandler/GroupChannelHandler/ConnectionHandler needs a CometChat listener that is also removed on unmount/dispose. Missing removals cause duplicate messages.
  • Half-removed features. Deleting the API call but leaving the button (or the route) is a dead end (RULES.md → Default-on affordances). Remove the entry point too.
  • Collections/local cache. Sendbird GroupChannelCollection/MessageCollection gave offline cache and auto-sync. Port them to the CometChat request builders + listeners and note the behavior change. Don't re-invent a cache.
  • Never delete non-Sendbird code that just shares a file with Sendbird code. Rewire it.

Native platforms (Android · iOS) — NOT done until the platform build passes

Native builds (Android/iOS/Flutter) have extra REQUIRED steps beyond editing code — bump the sample toolchain to the -core build floors, add the kit dep AND wire initFromSettings in the app entry, port toCometChatId to the client language, edit .pbxproj/.xcscheme as structured build graphs (never a text scrub), and RUN the platform build. A native migration is NOT done until you have followed references/native-build.md in full — open it and work through every step; it is mandatory, not optional.

Verify it works

  • The app builds/type-checks with the family's normal command (the core skill's "Verify it works"). On native, this means actually running the platform build above — not just visual inspection.
  • RUN it and read the logs — a compile is NOT a working app (do this; don't skip). When you're done implementing, START the app and confirm it LOADS with the chat surface rendered and NO errors: web → the dev server (or build + preview), open it, watch the browser console + the dev-server terminal; native → the platform run + logcat / Xcode console / flutter logs. Fix EVERY runtime error you introduced before declaring done — a Cannot read properties of undefined from a half-migrated reference, or an SDK enum/class read at module-load before the SDK is ready, is a migration bug, not the user's problem (hand off to cometchat-<family>-troubleshooting for symptom → fix). If the app genuinely can't be started here (no dev env / needs a device), SAY SO and give the user the exact run command + what to watch for — never silently skip this.
  • Zero Sendbird residue — run exactly this, over ALL file types (docs included): grep -rIilE 'sendbird' . --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist --exclude-dir=build --exclude-dir=.claude --exclude-dir=Pods --exclude-dir=.dart_tool --exclude-dir=.gradle | grep -vE 'COMETCHAT_MIGRATION.md|scripts/cometchat-migration' → must print nothing (repeated --exclude-dir= flags on purpose: a {a,b} brace list is rejected by the coding agent's command-permission parser, so the check silently never runs). The ONE allowed mention is a single provenance comment above toCometChatId(); code identifiers, README lines and env names are residue, not "expected". This includes a "migrated from <vendor>" line in the README or any doc you write — a provenance note reads as helpful and is still residue; the migration report is where that belongs, and it is already exempt. Rewrite the app's own README so it describes CometChat, naming the vendor nowhere. The same goes for every other doc the repo ships — CHANGELOG.md, docs/, changelogs/, a vendored SDK's own release notes: if a file is not the migration report, it must not name the vendor. Delete the ones that document the vendor's product rather than your app. Clearing residue out of project.pbxproj / *.xcscheme is a structured edit, never a text scrub — remove the vendor's SPM package reference and its build-phase entries as whole blocks, and keep the project's own product and target structure (see the native block above).
  • scripts/cometchat-migration/migrate.mjs + README.md exist — even for a demo/sample app with no data of its own (the script is a deliverable for the user's real data, not for this checkout; step 8 is never skipped).
  • Every CometChat symbol you emitted exists in the family catalog. Every migrated feature is in features.json or the docs. Every UNSUPPORTED item is in the report's Removed list with its files.
  • The server token endpoint, the client login and the data script all call the same toCometChatId().
  • Runtime shape, statically checked: every element from the root to the conversation list has a height (wrappers included). A user who was signed in before the migration is logged in to CometChat again before the chat renders. No real secret sits in a git-tracked file (git ls-files each file you wrote credentials to).
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.25

发布时间

2026年9月25日

分类

未分类

许可证

MIT

源路径

skills/cometchat-migrate-from-sendbird

默认分支

main

最新提交

f92ff9e

Tree SHA

f40470f