This page covers the agent-driven migration. For how CometChat imports users, groups and
messages, the historical and live migration approaches, and the import APIs, see
Data Import and Migration.
Two ways to migrate
- Migrate your app and your data. Open your project in your coding agent and say “Migrate my app to CometChat.”
- Migrate only your data. Say “Migrate only my data to CometChat. Don’t change my app code.”, naming the chat provider you’re moving from. The agent writes and runs the same data-import script described below, without touching your app.
What a full migration does
The agent detects the provider you’re on and migrates your app end to end in one run: it swaps the data layer (or your UI components) over to CometChat, wiresinit → login, maps every feature that has a CometChat equivalent, removes the ones
that don’t (and lists them for you), and verifies the build. Your own UI is
preserved when you built on the provider’s SDK; the CometChat UI Kit takes over
where you used the provider’s UI Kit.
Before you start
- Create your CometChat app first, and put its credentials in place. Sign up at
app.cometchat.com and create an app — the migration never
creates one for you. It also won’t ask you for your app credentials: it reads them
from
.cometchat/config.jsonor your environment, and writes placeholders (with an “add your credentials” action item) if it finds neither. So set them up first — see Connect your credentials — or you’ll get a build full of placeholders to fill in later. - Create a full-access REST API key for the history import. Unlike the app credentials, the agent does ask you for this one (and your current provider’s key) when it runs the import.
- Node.js 18 or newer, for
npxand the data-import script. - Your app should build today on your current provider — migrating an app that doesn’t build first only hides which errors were yours.
- Start from a clean git branch. The agent works on a new
cometchat-migrationbranch and never commits, so the diff stays easy to review.
Safe to run on a real repo: it works on its own branch and never commits, and it never
deletes your own app code — where your code shares a file with the provider’s, it’s
rewired, not removed. To leave no trace of the old provider it does go beyond deleting
SDK calls, though: it updates your README, setup/deploy guides and
.env.example to
describe CometChat, renames provider-named identifiers (e.g. providerUserId → userId),
and removes docs that describe the old provider’s product (its changelog or docs pages).
Review the branch diff before you merge.Bringing your history across
The migration also prepares a data-import script for your users, groups and messages. When the app migration is done, the agent tells you the script is ready for data import and asks for your API keys (or the relevant credentials) — for both your current provider and your CometChat app. Once you provide them, the agent runs the import for you — a dry run first, showing the users, groups, members and messages it will import, then the real import. You don’t run anything by hand.CometChat retains messages for the last 6 months by default, so the import
brings over history from that window. To import messages older than 6 months,
reach out to CometChat and we’ll help you import the older history.
Choosing a cut-over strategy
- Hard switch (default). Export from your current provider, import into CometChat, then deploy the migrated app. Simplest — do it in a maintenance window so no messages are sent mid-copy. The generated script does exactly this.
- Zero-downtime live migration. Keep both systems in sync while users move onto the new build gradually. This one is set up with CometChat’s team — contact sales. Choose it if you can’t take a maintenance window.
Before you go live
Switch login from the development Auth Key to server-minted auth tokens. The Auth Key is for development only; in production your server mints a per-user auth token and the client logs in withloginWithAuthToken().
The agent leaves this as an action item and, where your app already has a token server,
wires it for you.
Learn more
Data Import and Migration
How CometChat imports users, groups and messages, and the historical vs live migration approaches
Agent Skills
Install the skills and connect your credentials before you migrate