
TL;DR: Best Free Chat SDK and Chat API Options
- A chat SDK gives your app ready-made messaging features such as login, conversations, message sending, group chat, read receipts, push notifications, and media messages. A chat API exposes those capabilities through programmatic endpoints and SDK methods so you do not need to build the whole messaging stack from scratch.
- The best free chat SDK depends on your platform, scale target, compliance needs, and whether you need only text chat or a broader realtime communication stack with voice, video, livestreaming, and AI.
- Tencent RTC is a strong choice when you want free in-app chat plus a path to calls, live streaming, conference, game voice, and conversational AI in one ecosystem.
- If you mention chat in a product plan, include authentication, moderation, retention, offline push, read receipts, and abuse prevention early. These are not add-ons; they are core chat application requirements.
- For developers, the fastest path is to start with the TRTC Chat SDK documentation, download the SDK from TRTC SDK downloads, and use the MCP server
@tencent-rtc/mcpto generate integration code.
Free Chat API — free forever: 1,000 MAU, no concurrency limits, push notifications included.
What Is a Chat SDK or Chat API?
A chat SDK is a software development kit that helps you add in-app messaging to a web, mobile, desktop, or cross-platform application. Instead of writing your own WebSocket infrastructure, message routing, unread count logic, push notification pipeline, and media upload flow, you integrate a vendor SDK and call its APIs from your application code.
A chat API is the programmatic interface behind the messaging product. It may include client-side SDK methods, server-side REST APIs, webhook events, admin APIs, moderation APIs, and push notification APIs. In practical product planning, teams often use the terms “chat SDK,” “chat API,” “messaging API,” and “chat messaging SDK” together because a production chat feature usually needs both client SDKs and backend APIs.
A chat SDK is not just a text box. A serious in app chat SDK usually includes:
| Capability | What it means in a real app |
|---|---|
| Realtime messaging | Messages appear instantly without manual refresh |
| Conversation list | One-to-one, group, channel, or room-based chat list |
| Message history | Users can reopen conversations and see previous messages |
| Read receipts | Sender can know whether a message has been read |
| Typing indicators | Participants see when another user is typing |
| Offline push | Mobile users receive notifications when inactive |
| Media messages | Images, videos, files, voice notes, and custom payloads |
| Moderation | Profanity filtering, user reports, mute, ban, audit tools |
| Presence | Online, offline, away, or custom user states |
| Webhooks | Server receives events for automation and compliance |
| Multi-device sync | Same account works across web, Android, iOS, and desktop |
| Security controls | Token authentication, permissions, encryption options |
The communication transport behind a chat API can vary. Many realtime chat systems use persistent connections such as WebSocket. The WebSocket protocol is standardized in RFC 6455 by the IETF. Some products also use HTTP polling fallback, MQTT-like message routing, or proprietary realtime delivery networks. If your app also needs voice chat API or video calling, it may use WebRTC, whose browser API is standardized by the W3C WebRTC specification.
For product teams, the important question is not “Can we send a message?” The real question is: can the chat API remain reliable when users send messages from multiple devices, go offline, switch networks, join groups, report abuse, request data deletion, and expect push notifications to work everywhere?
That is why the best chat API is usually the one that reduces operational risk. A vendor-managed realtime chat API gives you a tested messaging layer, documentation, SDK updates, push integration, and a roadmap beyond basic text chat.
For developers building with Tencent RTC for the first time, start with TRTC Chat SDK documentation. If your product also needs voice or video calling, see TRTC Call documentation for realtime audio and video call flows.
How to Choose the Best Free Chat SDK for Your App
A free chat SDK should be evaluated like an infrastructure choice, not like a UI widget. The free tier matters, but so do user experience, platform coverage, compliance, and migration risk. Here is a practical framework for choosing the best chat API for your app.
1. Match the chat model to your product
Start by defining your conversation model:
- One-to-one chat for marketplaces, telehealth, dating, tutoring, customer support, and private social messaging
- Group chat for communities, team collaboration, education, gaming parties, and creator fan groups
- Chat rooms for livestreaming, events, webinars, voice rooms, and public discussion spaces
- Channel chat for broadcast-style updates, announcements, or topic-based discussion
- Support chat for agent routing, queues, escalation, and customer service workflows
- Game voice and team chat for multiplayer games, where low latency voice and text need to work together
A chat room API optimized for massive live events is different from a support chat API optimized for CRM workflows. A react native chat API for a consumer app also has different priorities than a messaging platform API for an internal enterprise tool.
If your product will eventually include audio rooms, livestreaming, or voice calls, choose a provider that can grow beyond text chat. TRTC, for example, provides chat alongside calling, live streaming, conferencing, GVoice for game voice, and conversational AI, which reduces the need to stitch multiple realtime vendors together later.
2. Verify platform support before building UI
A good chat sdk web integration is only one part of the app. Most teams need several platforms:
- JavaScript chat SDK for web apps
- Android SDK for native Kotlin or Java apps
- Chat SDK Swift for iOS apps
- Flutter chat SDK for cross-platform mobile apps
- React Native chat API for JavaScript-based mobile apps
- Server APIs for user management, moderation, and automation
Ask whether the SDK supports your exact framework and whether the vendor provides maintained sample projects. A free chat SDK that only works well on one platform can become expensive when your mobile roadmap expands.
For TRTC, developers can start from TRTC SDK downloads and follow platform-specific guides in the documentation.
3. Check the free plan boundary
“Free” can mean several different things:
| Free model | Good for | Watch out for |
|---|---|---|
| Free forever | Long-term early-stage apps | Feature or MAU limits |
| Free trial | Testing vendor quality | Production cost after trial ends |
| Open source | Full control and self-hosting | DevOps, scaling, moderation, maintenance |
| Free cloud quota | Prototypes and small apps | Usage caps, overage cost, limited support |
| Community edition | Internal or small communities | Advanced features may require paid plan |
For TRTC Chat, the free plan is explicit:
Free Chat API — free forever: 1,000 MAU, no concurrency limits, push notifications included.
For other vendors, always check the current official pricing page before launch because quotas, included features, and plan names change.
4. Evaluate security and compliance requirements
Security should influence your chat API choice from day one. At minimum, look for:
- Token-based authentication instead of exposing secrets in clients
- Server-side user identity verification
- Permission controls for groups, channels, and rooms
- Moderation and abuse reporting
- Transport security
- Data deletion and retention controls
- Audit logs for sensitive applications
- Regional data considerations if your product has compliance obligations
For security design, align your application with recognized guidance such as the OWASP Application Security Verification Standard and the NIST Cybersecurity Framework. If your app serves users in the European Union, review obligations under the official GDPR portal.
5. Test developer experience
Before committing to a chat messaging SDK, run a one-day prototype:
- Can a new developer create an app, log in, and send a message quickly?
- Are SDK errors understandable?
- Does the SDK handle reconnection when the network changes?
- Are sample apps current?
- Does the SDK support TypeScript or platform-native types?
- Can your backend generate secure user tokens?
- Is documentation searchable and versioned?
- Does the vendor provide migration help if usage grows?
The best chat API is not only the one with the most features. It is the one your team can ship, debug, operate, and evolve.
Best Free Chat SDKs and Chat APIs Compared
The following comparison focuses on free or free-to-start chat SDK and messaging API options commonly considered by web and mobile developers. Pricing and feature packaging can change, so treat this as a product selection guide and verify each official pricing page before making a final procurement decision.
Comparison table
| Provider | Best fit | Platforms | Free option type | Strengths | Considerations |
|---|---|---|---|---|---|
| Tencent RTC Chat | Apps that need chat plus realtime audio/video growth | Web, Android, iOS, Flutter, React Native, server APIs | Free forever plan | Chat, push, calling, live, conference, GVoice, AI roadmap | Best for teams that want managed realtime infrastructure |
| Firebase / Firestore | Simple app data sync and prototypes | Web, Android, iOS, Flutter, Unity, server SDKs | Free quota on Spark plan | Easy Google ecosystem integration | You design chat-specific logic yourself |
| Supabase Realtime | Open-source backend projects | Web, mobile via community SDKs | Free cloud plan and self-hosting | PostgreSQL-based app backend | Chat features require custom modeling |
| Matrix | Open protocol communities and federated chat | Web, mobile, self-hosted servers | Open source | Federation and interoperability | Requires operational expertise |
| Rocket.Chat | Team/community chat with self-hosting | Web, desktop, mobile | Community/self-managed options | Workplace-style chat product | Less suited as a lightweight embedded SDK |
| Appwrite Realtime | App backend with realtime events | Web, Flutter, Android, iOS, server SDKs | Free cloud plan and self-hosting | Backend-as-a-service developer flow | You build chat product features |
| PubNub | Realtime messaging infrastructure | Web, mobile, IoT | Free-to-start plan | Pub/sub and realtime events | Chat UI and product logic may need extra work |
| Stream Chat | Feature-rich chat UI components | Web, mobile, Flutter, React Native | Trial/free development options | Polished components and moderation tools | Verify current production pricing |
| Sendbird Chat | Mature in-app messaging | Web, mobile, Flutter, React Native | Trial/free development options | Strong chat product feature set | Verify current usage limits and plan fit |
| CometChat | Fast UI kit-based chat integration | Web, mobile, Flutter, React Native | Trial/free development options | UI kits and extensions | Verify free plan limits before launch |
1. Tencent RTC Chat
Tencent RTC is a strong option if you want a free chat SDK that can expand into a full realtime communication stack. The Chat product supports in-app messaging scenarios such as one-to-one chat, group conversations, message history, unread counts, read receipts, offline push, and rich message types. It is especially useful when your roadmap includes more than text chat, because the same ecosystem also includes Call, Conference, Live, Beauty AR, GVoice, and Conversational AI.
For a startup or product team, the biggest advantage is architectural continuity. You can start with chat, then add voice calls with TRTC Call documentation, livestream chat with TRTC Live documentation, meetings with TRTC Conference documentation, or game voice using Tencent RTC GVoice.
TRTC is also a good fit for teams that want a JavaScript chat SDK, Flutter chat SDK, chat API for mobile app use cases, and server-side integration without managing realtime infrastructure.
Start here:
2. Firebase and Firestore
Firebase is popular for prototypes and mobile-first apps because it provides authentication, database, cloud functions, hosting, analytics, and push notification tooling in one Google ecosystem. Developers can build chat by modeling conversations and messages in Cloud Firestore or Realtime Database.
The strength of Firebase is flexibility. You can create a simple chat app quickly, especially if your team already uses Firebase Authentication and Firebase Cloud Messaging. The tradeoff is that Firebase is not primarily a full chat product. You need to design your own conversation schema, unread counts, typing indicators, moderation flows, read receipts, message retention, and admin tools.
This makes Firebase a practical choice for early prototypes or apps with simple messaging needs. It may require more custom work when you need production-grade chat features across multiple platforms.
Official reference: Firebase documentation.
3. Supabase Realtime
Supabase is an open-source backend platform built around PostgreSQL. Its Realtime features let clients subscribe to database changes and broadcast events. For developers who want SQL, open-source tooling, and a modern backend-as-a-service workflow, Supabase can be attractive.
For chat, Supabase works best if your team is comfortable designing the messaging model. You can create tables for users, conversations, members, messages, reactions, and read states, then subscribe to relevant changes. The upside is control. The downside is that chat-specific product features are your responsibility.
Official reference: Supabase Realtime documentation.
4. Matrix
Matrix is an open standard for decentralized communication. It is a strong option for teams that care about federation, interoperability, and self-hosting. The Matrix ecosystem includes homeservers, clients, bridges, encryption features, and open-source community tooling.
Matrix is powerful, but it is not usually the fastest route to embedded chat inside a consumer app. Running and scaling homeservers requires operational expertise. Product teams also need to decide how much of the Matrix client experience they want to expose versus customize.
Official reference: Matrix specification.
5. Rocket.Chat
Rocket.Chat is a workplace and community messaging platform with self-managed deployment options. It is a good fit when you want a full chat application or internal collaboration environment rather than a lightweight embedded chat API.
If your requirement is “give my organization a chat system,” Rocket.Chat may be appropriate. If your requirement is “embed chat into my app with native UX and product-specific workflows,” a dedicated in-app chat SDK may be easier.
Official reference: Rocket.Chat documentation.
6. Appwrite Realtime
Appwrite is an open-source backend platform with authentication, databases, storage, functions, and realtime events. Like Supabase, it can support chat if you design your own message model and subscribe to events.
Appwrite is appealing for developers who want a general backend for web and mobile apps. For production chat, plan extra work around unread counts, moderation, read receipts, message ordering, push, and scaling.
Official reference: Appwrite Realtime documentation.
7. PubNub
PubNub provides realtime messaging infrastructure based on publish/subscribe patterns. It is used for apps that need low-latency event delivery, presence, and realtime data synchronization. It can power chat, collaboration, dashboards, and device messaging.
The core strength is realtime transport. Depending on your product requirements, you may still need to build or integrate chat UI, message storage, moderation, and conversation management.
Official reference: PubNub documentation.
8. Stream Chat
Stream Chat is a chat API and UI component platform with SDKs for web and mobile frameworks. It is often considered by teams that want prebuilt UI kits and rich chat features. It can be a strong developer experience for product teams that want polished chat components quickly.
Before selecting it as a free chat API, verify the current pricing and plan limits on the official site, especially if your app will move from development to production.
Official reference: Stream Chat documentation.
9. Sendbird Chat
Sendbird is a mature in-app messaging provider with features for one-to-one chat, group channels, moderation, and enterprise chat use cases. It is commonly evaluated by teams that need a dedicated chat solution.
As with other commercial providers, confirm current free trial or free plan terms, feature access, and production pricing before launch.
Official reference: Sendbird documentation.
10. CometChat
CometChat provides chat SDKs and UI kits for web and mobile frameworks. It is often chosen for fast integration when teams want ready-made UI components and common messaging features.
It is best evaluated through a prototype: integrate the SDK, test the UI kit against your product design, and confirm the plan limits that apply to your expected usage.
Official reference: CometChat documentation.
Best Chat SDKs by Platform: Web, Android, iOS, Flutter, React Native, and JavaScript
The best chat sdk decision often starts with platform compatibility. A vendor may look good on a pricing page but become difficult if its SDK is weak on your primary platform. Use the following platform guidance to narrow your shortlist.
Best chat SDK web and JavaScript chat SDK
For web apps, a javascript chat sdk should support:
- ES modules or modern bundlers such as Vite, Webpack, and Next.js
- TypeScript-friendly APIs
- Browser reconnection handling
- Message pagination and local state integration
- File upload from browser inputs
- Cross-tab login behavior
- Secure token-based login
- Cleanup methods for logout and component unmounting
TRTC works well for web chat because you can use the JavaScript SDK directly in modern frontend apps. The following example shows a minimal browser integration using @tencentcloud/chat.
Runnable JavaScript example: initialize TRTC Chat and send a message
Install dependencies:
npm create vite@latest trtc-chat-web -- --template vanilla
cd trtc-chat-web
npm install @tencentcloud/chat tim-upload-plugin
npm run devCreate src/main.js:
import TencentCloudChat from '@tencentcloud/chat';
import TIMUploadPlugin from 'tim-upload-plugin';
const SDKAppID = Number(import.meta.env.VITE_TRTC_SDKAPPID);
const userID = import.meta.env.VITE_TRTC_USER_ID;
const userSig = import.meta.env.VITE_TRTC_USER_SIG;
const peerUserID = import.meta.env.VITE_TRTC_PEER_USER_ID;
const chat = TencentCloudChat.create({ SDKAppID });
chat.setLogLevel(1);
chat.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin });
const app = document.querySelector('#app');
app.innerHTML = `
<main style="font-family: system-ui; max-width: 720px; margin: 40px auto;">
<h2>TRTC Web Chat Demo</h2>
<p id='status'>Connecting...</p>
<div id='messages' style="border:1px solid #ddd; min-height:160px; padding:12px; margin-bottom:12px;"></div>
<input id='text' placeholder="Type a message" style="width:70%; padding:8px;" />
<button id='send' style="padding:8px 14px;">Send</button>
<button id='logout' style="padding:8px 14px;">Logout</button>
</main>
`;
const statusEl = document.querySelector('#status');
const messagesEl = document.querySelector('#messages');
const textEl = document.querySelector('#text');
function addLine(text) {
const div = document.createElement('div');
div.textContent = text;
messagesEl.appendChild(div);
}
chat.on(TencentCloudChat.EVENT.SDK_READY, () => {
statusEl.textContent = `Logged in as ${userID}`;
});
chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, event => {
event.data.forEach(message => {
if (message.type === TencentCloudChat.TYPES.MSG_TEXT) {
addLine(`${message.from}: ${message.payload.text}`);
}
});
});
chat.on(TencentCloudChat.EVENT.SDK_NOT_READY, () => {
statusEl.textContent = 'SDK not ready';
});
async function main() {
await chat.login({ userID, userSig });
}
document.querySelector('#send').addEventListener('click', async () => {
const text = textEl.value.trim();
if (!text) return;
const message = chat.createTextMessage({
to: peerUserID,
conversationType: TencentCloudChat.TYPES.CONV_C2C,
payload: { text }
});
await chat.sendMessage(message);
addLine(`Me: ${text}`);
textEl.value = '';
});
document.querySelector('#logout').addEventListener('click', async () => {
await chat.logout();
statusEl.textContent = 'Logged out';
});
window.addEventListener('beforeunload', async () => {
try {
await chat.logout();
} catch (error) {
console.warn('Logout skipped:', error);
}
});
main().catch(error => {
console.error(error);
statusEl.textContent = `Login failed: ${error.message || error}`;
});Create .env.local:
VITE_TRTC_SDKAPPID=YOUR_SDKAPPID
VITE_TRTC_USER_ID=alice
VITE_TRTC_USER_SIG=USER_SIG_FROM_YOUR_SERVER
VITE_TRTC_PEER_USER_ID=bobThis example is intentionally small. In production, never generate userSig in the browser. Generate it on your backend and return it only after your own app authentication succeeds.
Best chat API for Android
For Android, the best chat api for android should support:
- Kotlin and Java compatibility
- Offline push through Firebase Cloud Messaging
- Lifecycle-aware reconnection
- Background and foreground notification handling
- Efficient message list rendering
- Media picker and upload workflows
- ProGuard or R8 guidance
- Clear threading model for callbacks
If your Android app also needs voice chat API functionality, do not force voice into a text chat SDK. Use a communication stack that supports both chat and audio. TRTC Call can cover realtime voice and video calling, while Tencent RTC GVoice is designed for game voice scenarios.
Best chat SDK Swift for iOS
For iOS, look for:
- Swift and Objective-C support
- APNs push notification integration
- Background behavior guidance
- Media permissions and privacy strings
- Message list performance for large histories
- Secure storage recommendations for tokens
- Support for iOS app lifecycle transitions
Apple push notifications must follow Apple’s platform requirements. See the official Apple Push Notification service documentation when designing iOS chat notifications.
Best Flutter chat SDK
A flutter chat sdk should give you:
- Dart-native APIs
- Android and iOS parity
- Clear setup for push notifications
- Support for hot reload during development
- Example widgets or sample apps
- Platform channel stability
- Message pagination patterns for mobile lists
Flutter teams should test UI performance early. Chat screens are scroll-heavy and state-heavy. Message list virtualization, image loading, keyboard behavior, and input focus can make or break the user experience.
Best React Native chat API
A react native chat api should provide:
- JavaScript or TypeScript APIs
- Native module compatibility with current React Native versions
- iOS and Android push setup
- Hermes compatibility if your app uses Hermes
- Clean logout and token refresh flows
- Sample projects for bare React Native and Expo where applicable
React Native chat apps often suffer from edge cases around app foreground/background transitions. Test network switching, push tap behavior, and multiple-device login during the prototype stage.
Best chat API JavaScript for backend integration
A serious api for chat application also needs backend support. Your server typically handles:
- User authentication
- Chat user creation or synchronization
- UserSig or token generation
- Webhook processing
- Moderation actions
- Audit logging
- Message export or deletion workflows
- Role and permission logic
Runnable Node.js example: generate a secure UserSig endpoint
Install dependencies:
mkdir trtc-chat-token-server
cd trtc-chat-token-server
npm init -y
npm install express cors dotenv tls-sig-api-v2Create .env:
PORT=3001
TRTC_SDKAPPID=YOUR_SDKAPPID
TRTC_SECRETKEY=YOUR_SECRET_KEYCreate server.js:
import express from 'express';
import cors from 'cors';
import dotenv from 'dotenv';
import TLSSigAPIv2 from 'tls-sig-api-v2';
dotenv.config();
const app = express();
app.use(cors());
app.use(express.json());
const sdkAppId = Number(process.env.TRTC_SDKAPPID);
const secretKey = process.env.TRTC_SECRETKEY;
const expireSeconds = 60 * 60 * 24;
if (!sdkAppId || !secretKey) {
throw new Error('Missing TRTC_SDKAPPID or TRTC_SECRETKEY in .env');
}
const sigApi = new TLSSigAPIv2.Api(sdkAppId, secretKey);
function requireAppAuth(req, res, next) {
const demoUser = req.header('x-demo-user');
if (!demoUser) {
return res.status(401).json({ error: 'Missing x-demo-user header' });
}
req.user = { id: demoUser };
return next();
}
app.post('/api/chat/user-sig', requireAppAuth, (req, res) => {
const userID = req.user.id;
const userSig = sigApi.genUserSig(userID, expireSeconds);
res.json({
SDKAppID: sdkAppId,
userID,
userSig,
expireAt: Math.floor(Date.now() / 1000) + expireSeconds
});
});
app.listen(process.env.PORT || 3001, () => {
console.log(`TRTC token server running on port ${process.env.PORT || 3001}`);
});Update package.json:
{
"type": "module",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"cors": "latest",
"dotenv": "latest",
"express": "latest",
"tls-sig-api-v2": "latest"
}
}Run:
npm start
curl -X POST http://localhost:3001/api/chat/user-sig -H "x-demo-user: alice"This endpoint is intentionally simple. Replace requireAppAuth with your real authentication middleware, such as session cookies, OAuth, JWT validation, or your existing user service.
Essential Chat Features to Look For: Realtime Messaging, Chat Rooms, Voice Chat, and Read Receipts
A feature checklist helps you compare vendors beyond pricing. The best free chat SDK for a prototype should not block the features your production app will need later.
Realtime messaging
Realtime messaging is the foundation. Users expect messages to arrive quickly, in order, and across devices. Look for these behaviors:
- Automatic reconnection after network loss
- Message delivery callbacks
- Message IDs for deduplication
- Pagination for history
- Offline handling
- Multi-device synchronization
- Server timestamps
- Local optimistic UI support
A realtime chat API should let your UI show a message immediately while still handling send failures gracefully. If the SDK does not provide clear success and failure events, your app may show inconsistent chat state.
Chat rooms and group chat
A chat room api supports many users in the same conversation space. It is common in livestreaming, virtual events, education, gaming, and community apps.
Important room features include:
- Join and leave events
- Member roles such as owner, admin, moderator, and member
- Mute and ban controls
- Room announcement messages
- Message rate limiting
- Pinned messages
- Custom message payloads
- Server-side moderation hooks
If you plan to add live streaming, connect chat room design with your streaming architecture. TRTC Live can support realtime interactive live scenarios, and chat can provide the audience engagement layer through messages, gifts, reactions, and moderation workflows. See TRTC Live documentation for live streaming architecture.
Voice chat API and audio communication
A voice chat api is not the same thing as a text chat API. Text chat handles messages. Voice chat handles audio capture, encoding, transmission, jitter, packet loss, echo cancellation, device routing, and permissions.
Use voice chat when you need:
- One-to-one voice calls
- Group voice rooms
- Game team voice
- Audio support for tutoring, consulting, or telehealth
- Push-to-talk or open-mic game communication
- Voice interactions with AI agents
For app calls, use TRTC Call documentation. For game voice, evaluate Tencent RTC GVoice. For AI-powered voice agents, see TRTC Conversational AI documentation.
Pro tip: If you're building AI-powered voice interactions, Tencent RTC's Conversational AI supports natural AI voice experiences for customer service, education, gaming companions, and productivity apps.
Read receipts
Read receipts tell a sender that a recipient has read a message. They sound simple, but the implementation can become complex.
A good read receipts design answers:
- Is a receipt per message or per conversation?
- Does the app show “delivered” separately from “read”?
- Are read receipts optional for privacy?
- How do receipts work in group chat?
- Does the server store the last-read message ID?
- Can users read messages from notifications without sending receipts?
- How are receipts synchronized across devices?
For one-to-one chat, a common model is to store the recipient’s last read timestamp or last read message ID. For group chat, avoid writing one row per user per message at high scale unless the vendor handles it efficiently. Instead, many systems store per-member read pointers.
Runnable React example: display incoming messages and read state
Install in a Vite React app:
npm create vite@latest trtc-chat-react -- --template react
cd trtc-chat-react
npm install @tencentcloud/chat tim-upload-plugin
npm run devCreate src/App.jsx:
import { useEffect, useMemo, useState } from 'react';
import TencentCloudChat from '@tencentcloud/chat';
import TIMUploadPlugin from 'tim-upload-plugin';
import './App.css';
const SDKAppID = Number(import.meta.env.VITE_TRTC_SDKAPPID);
const userID = import.meta.env.VITE_TRTC_USER_ID;
const userSig = import.meta.env.VITE_TRTC_USER_SIG;
const peerUserID = import.meta.env.VITE_TRTC_PEER_USER_ID;
export default function App() {
const [ready, setReady] = useState(false);
const [lines, setLines] = useState([]);
const [text, setText] = useState('');
const chat = useMemo(() => {
const instance = TencentCloudChat.create({ SDKAppID });
instance.setLogLevel(1);
instance.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin });
return instance;
}, []);
useEffect(() => {
function onReady() {
setReady(true);
}
function onMessageReceived(event) {
const incoming = event.data
.filter(message => message.type === TencentCloudChat.TYPES.MSG_TEXT)
.map(message => ({
id: message.ID,
from: message.from,
text: message.payload.text,
readLabel: 'received'
}));
setLines(previous => [...previous, ...incoming]);
}
chat.on(TencentCloudChat.EVENT.SDK_READY, onReady);
chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
chat.login({ userID, userSig }).catch(console.error);
return () => {
chat.off(TencentCloudChat.EVENT.SDK_READY, onReady);
chat.off(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
chat.logout().catch(() => {});
};
}, [chat]);
async function sendMessage() {
const value = text.trim();
if (!value || !ready) return;
const message = chat.createTextMessage({
to: peerUserID,
conversationType: TencentCloudChat.TYPES.CONV_C2C,
payload: { text: value }
});
setLines(previous => [
...previous,
{
id: `local-${Date.now()}`,
from: 'me',
text: value,
readLabel: 'sending'
}
]);
await chat.sendMessage(message);
setLines(previous =>
previous.map(line =>
line.text === value && line.readLabel === 'sending'
? { ...line, readLabel: 'sent' }
: line
)
);
setText('');
}
return (
<main className="card">
<h1>TRTC React Chat</h1>
<p>Status: {ready ? 'ready' : 'connecting'}</p>
<section className="messages">
{lines.map(line => (
<div key={line.id} className={line.from === 'me' ? 'mine' : 'theirs'}>
<strong>{line.from}</strong>: {line.text}
<small> {line.readLabel}</small>
</div>
))}
</section>
<div className="composer">
<input
value={text}
onChange={event => setText(event.target.value)}
onKeyDown={event => {
if (event.key === 'Enter') sendMessage();
}}
placeholder="Type a message"
/>
<button onClick={sendMessage} disabled={!ready}>
Send
</button>
</div>
</main>
);
}Create src/App.css:
.card {
max-width: 720px;
margin: 40px auto;
font-family: system-ui, sans-serif;
}
.messages {
min-height: 240px;
border: 1px solid #ddd;
padding: 12px;
margin: 16px 0;
}
.mine {
text-align: right;
margin: 8px 0;
}
.theirs {
text-align: left;
margin: 8px 0;
}
.composer {
display: flex;
gap: 8px;
}
.composer input {
flex: 1;
padding: 10px;
}
.composer button {
padding: 10px 16px;
}This example shows a basic “sending” and “sent” UI label. In a production implementation, connect your UI to the SDK’s supported receipt and conversation APIs rather than relying only on local labels.
Push notifications
For mobile apps, push is essential. A chat API for mobile app use cases must integrate with Firebase Cloud Messaging on Android and APNs on iOS. Push behavior should be tested in these states:
- App foreground
- App background
- App killed
- Device locked
- User logged out
- Token refreshed
- Multiple devices for the same user
- Muted conversation
- Mention-only notification mode
Push is also a trust issue. Sending too many notifications causes opt-outs. Sending too few makes chat feel broken.
Moderation and safety
If users can send messages, some users will send harmful messages. A production messaging API should support moderation patterns such as:
- Keyword filtering
- User reports
- Mute, kick, and ban actions
- Admin review queues
- Rate limits
- Spam detection
- Image and file restrictions
- Audit trails
- Role-based permissions
Moderation requirements are stronger for social apps, marketplaces, games, education, and apps with minors. Build the moderation workflow before launch, not after the first abuse incident.
Build vs Buy: When to Use a Messaging API Instead of Building Chat From Scratch
Building chat from scratch is possible. It is also easy to underestimate. A basic demo can be created with WebSocket in a day. A reliable production chat system may require months of work across frontend, backend, mobile, infrastructure, security, and support.
What you build if you do it yourself
A custom chat system usually needs:
- Realtime connection servers
- Message persistence
- Message ordering and deduplication
- User authentication and authorization
- Conversation membership
- Online presence
- Typing indicators
- Unread counts
- Read receipts
- Push notification delivery
- File upload and media scanning
- Message search
- Moderation tooling
- Admin dashboards
- Rate limiting and spam prevention
- Data retention and deletion
- Multi-region deployment
- Monitoring and alerting
- SDKs for web, Android, iOS, Flutter, and React Native
That is a large surface area. The hidden cost is not only engineering time; it is the operational burden after launch.
When building from scratch makes sense
Build your own chat stack when:
- Chat is your core infrastructure differentiator
- You have strict custom protocol requirements
- You need full self-hosting for regulatory reasons
- You have a dedicated realtime infrastructure team
- You can maintain SDKs across all client platforms
- You accept longer time to market
Open-source protocols and self-hosted platforms can work well for these cases.
When buying or integrating a chat API is better
Use a messaging API when:
- Chat is important but not your core infrastructure business
- You need to launch quickly
- Your team supports multiple platforms
- You need push, moderation, read receipts, and media messages now
- You want vendor-maintained SDKs
- Your product may expand into voice, video, live, or AI
- You need predictable integration documentation
For many teams, the best approach is hybrid: use a managed chat API for realtime messaging and keep product-specific business logic in your own backend.
Cost and ROI model
When comparing build versus buy, include these cost categories:
| Cost area | Build yourself | Use chat SDK or API |
|---|---|---|
| Initial development | High | Lower |
| Multi-platform SDK work | High | Lower |
| Infrastructure operations | High | Vendor-managed |
| Customization | Maximum | Depends on SDK and APIs |
| Time to market | Slower | Faster |
| Security maintenance | Internal responsibility | Shared with vendor |
| Moderation tooling | Must build | Often included or easier |
| Scaling risk | Internal responsibility | Vendor-supported |
| Vendor lock-in | Lower if self-built | Needs migration planning |
A free chat API can be especially valuable during the first product phase. You can validate engagement, retention, and community behavior before committing to major infrastructure investment.
Implementation Considerations: Scalability, Security, Moderation, and Compliance
Choosing the best chat api is only the first step. Implementation quality determines whether users experience chat as instant, safe, and dependable.
Scalability
Scalability is not just about total users. Chat load is shaped by conversation patterns:
- One-to-one chat produces many small private conversations.
- Group chat creates fan-out where one message is delivered to many members.
- Live chat rooms may create bursts during events.
- Gaming chat can be latency-sensitive and session-heavy.
- Customer support chat can spike during incidents or campaigns.
Design for:
- Message rate limits
- Backpressure when clients reconnect
- Pagination instead of loading all history
- Media upload limits
- Push notification throttling
- Monitoring for send failures and connection errors
- Graceful degradation when optional features fail
If you use a vendor SDK, understand its recommended limits and architecture patterns. If you build yourself, load test connection count, message fan-out, storage writes, and push queues separately.
Security
A secure chat implementation should never trust the client. Common mistakes include generating secrets in frontend code, allowing users to join any room by ID, and skipping server-side permission checks.
Use these controls:
- Generate chat login tokens on your backend
- Bind chat user IDs to your application user IDs
- Validate group membership before allowing privileged actions
- Keep secret keys out of mobile and browser apps
- Rotate credentials when needed
- Apply least privilege for admin tools
- Log moderation and administrative actions
- Rate-limit message sending and account creation
- Validate files before exposing them to other users
The OWASP ASVS is a practical reference for authentication, session, access control, and API security requirements.
Compliance and privacy
Compliance requirements depend on your app category and regions. Common areas include:
- User data export
- Data deletion
- Data retention periods
- Consent for notifications
- Minor safety rules
- Regional data handling
- Audit logs for regulated workflows
- Lawful request processes
If your app serves EU users, review the official GDPR information portal. If your app operates in healthcare, finance, education, or children’s products, involve legal and compliance experts early.
Moderation workflow
Moderation is both a product and operations function. A practical workflow includes:
- User sends a message.
- Automated checks evaluate spam, rate, keywords, attachments, and links.
- Message is delivered, blocked, or placed into review depending on policy.
- Users can report harmful content.
- Moderators can inspect context, mute users, delete messages, or ban accounts.
- Serious cases are logged for compliance or safety follow-up.
Do not rely only on keyword filters. Abuse evolves quickly. Combine technical controls, user reporting, and human review where necessary.
Observability
Chat failures are visible to users immediately. Add observability to answer:
- Are users connecting successfully?
- Are messages being sent but not delivered?
- Are push notifications delayed?
- Which SDK versions have the highest error rate?
- Which regions or networks show connection problems?
- Are users seeing duplicate messages?
- Are file uploads failing?
Track both technical metrics and product metrics. Technical health tells you whether chat works. Product behavior tells you whether chat is useful.
Migration planning
Even if you start with a free chat SDK, plan for the future:
- Keep your internal user ID stable.
- Store a mapping between app users and chat users.
- Avoid scattering vendor-specific code throughout the app.
- Wrap SDK calls in a messaging service layer.
- Keep message custom payloads documented.
- Export critical data where your vendor supports it.
- Document token generation and webhook behavior.
This architecture makes future upgrades, vendor changes, or multi-provider strategies easier.
Why Tencent RTC Is a Strong Choice for Free In-App Chat and Realtime Communication
Tencent RTC is a strong choice for teams that want free in-app chat today and a broader realtime communication roadmap tomorrow. Many apps start with text messaging, then discover that users also want voice calls, video calls, live rooms, group events, AI assistants, or game voice. Choosing a communication platform that supports these adjacent needs can reduce integration complexity.
Why TRTC fits modern app roadmaps
TRTC is a good fit when your product needs:
- In-app chat for web and mobile
- One-to-one and group messaging
- Read receipts and unread counts
- Push notifications
- Chat rooms for social and live scenarios
- Voice and video calls
- Livestream engagement
- Online events and meetings
- Game voice through GVoice
- AI voice interactions through Conversational AI
- Cross-platform SDK coverage
Useful internal resources include:
- TRTC Chat product page
- TRTC Chat SDK documentation
- TRTC Call documentation
- TRTC Conference documentation
- TRTC Live documentation
- TRTC SDK downloads
- TRTC Web3 solution for communities, token-gated experiences, and realtime engagement patterns
Tencent RTC free chat plan
If you are comparing free chat SDK options, the free plan is one of the clearest reasons to evaluate TRTC:
Free Chat API — free forever: 1,000 MAU, no concurrency limits, push notifications included.
This is especially useful for early-stage products that need production-quality chat while they validate retention, community behavior, marketplace liquidity, or user support workflows.
Where TRTC is especially strong
TRTC is particularly strong for apps where chat is part of a larger realtime experience:
| App type | Chat need | TRTC expansion path |
|---|---|---|
| Social app | DMs, groups, read receipts | Add voice/video calls and live rooms |
| Marketplace | Buyer-seller messaging | Add calls for consultations or support |
| Education | Class chat and tutor messages | Add live classes and video sessions |
| Gaming | Team chat and community rooms | Add GVoice for in-game voice |
| Creator platform | Fan chat and livestream comments | Add Live and Beauty AR |
| Events app | Attendee chat and Q&A | Add Conference or Live |
| AI app | Text chat with AI assistant | Add Conversational AI voice interactions |
| Web3 community | Token-gated group chat | Add realtime social engagement |
For example, a marketplace may start with buyer-seller messages. Later, it may need voice calls for negotiation, live selling events, or AI customer support. A gaming app may start with lobby chat and later need low-latency team voice. A creator platform may start with fan chat and later add livestreaming and AR effects.
Accelerate Integration with MCP
Instead of reading documentation page by page, use Tencent RTC's MCP server to let your AI coding assistant generate integration code directly:
Setup (Cursor / VS Code / Claude Code):
{
"mcpServers": {
"tencent-rtc": {
"command": "npx",
"args": ["-y", "@tencent-rtc/mcp@latest"],
"env": {
"SDKAPPID": "YOUR_SDKAPPID",
"SECRETKEY": "YOUR_SECRET_KEY"
}
}
}
}Example prompts you can use:
- "Create a video calling app using TRTC Web SDK with Vue 3"
- "Integrate real-time chat into my React app with message history"
- "Add live streaming to my existing Express backend"
- "Build a Flutter chat screen with read receipts and push notification setup"
- "Generate a secure Node.js UserSig service for TRTC Chat"
The MCP server has access to TRTC SDK documentation and can generate working integration code with your credentials pre-filled. For the full MCP setup guide, see the official TRTC MCP documentation.
Pro tip for AI-assisted development: If you use Cursor or CodeBuddy, the TRTC MCP server (
@tencent-rtc/mcp) can scaffold your real-time communication layer in minutes, from project setup to credential generation to working chat and calls.
Recommended implementation path with TRTC
A practical TRTC rollout looks like this:
- Create your TRTC account and obtain SDKAppID and SecretKey.
- Build a backend endpoint that generates UserSig securely.
- Integrate the web, Android, iOS, Flutter, or React Native SDK.
- Implement login, conversation list, message sending, and message receiving.
- Add unread counts and read receipts.
- Configure push notifications for Android and iOS.
- Add moderation controls such as mute, ban, and reporting.
- Test reconnects, app background behavior, token expiry, and logout.
- Add voice, video, live, or AI features only after the core chat loop is stable.
- Use MCP to accelerate platform-specific code generation and reduce boilerplate.
Start with TRTC Chat SDK documentation and the Free Chat API plan if you want the fastest path to production-ready in-app chat.
FAQ: Free Chat SDKs and Chat APIs
What is the difference between a chat SDK and a chat API?
A chat SDK is a platform-specific development kit you integrate into your app, such as a JavaScript, Android, iOS, Flutter, or React Native SDK. A chat API is the programmatic interface for messaging features, including client methods, server APIs, webhooks, and admin operations. Most production apps use both.
What is the best free chat SDK for a mobile app?
The best free chat SDK for a mobile app depends on your requirements. If you need in-app chat plus a path to voice, video, live streaming, game voice, and AI interactions, Tencent RTC is a strong choice. If you only need a simple prototype and already use a backend platform such as Firebase or Supabase, those can also work with more custom development.
Is Tencent RTC Chat really free?
TRTC provides a Free Chat API that is free forever for 1,000 MAU, with no concurrency limits and push notifications included. Always review the current official page before launch to confirm plan details for your app.
Can I build chat with Firebase instead of a chat SDK?
Yes. Firebase can be used to build chat by storing conversations and messages in Firestore or Realtime Database and using Firebase Cloud Messaging for push. However, you must design chat-specific features yourself, including read receipts, unread counts, moderation, message ordering, and admin workflows.
What features should a production chat API include?
A production chat API should include realtime messaging, message history, conversation lists, unread counts, read receipts, typing indicators, media messages, push notifications, moderation, user roles, secure authentication, webhooks, and multi-device synchronization.
Do I need a voice chat API if I already have a text chat SDK?
Yes, if your app needs realtime audio. Text chat and voice chat solve different technical problems. For voice or video calls, use a dedicated realtime communication product such as TRTC Call. For game voice, evaluate Tencent RTC GVoice.
What is the best chat SDK for web and JavaScript?
For web and JavaScript, choose a chat SDK that supports modern bundlers, token-based login, reconnection, message history, media messages, TypeScript-friendly APIs, and clean logout. TRTC Chat is a strong option for web apps that may later add calls, live streaming, or AI communication.
How should I implement read receipts?
For one-to-one chat, store or use the SDK’s last-read message state for each participant. For group chat, use per-member read pointers rather than writing a separate receipt for every user and every message unless the provider handles that complexity. Also decide whether read receipts are mandatory or privacy-controlled.
Is an open-source chat API better than a managed chat SDK?
Open-source chat can be better when you need self-hosting, protocol control, or deep customization. A managed chat SDK is usually better when you want faster launch, maintained client SDKs, push notification support, moderation features, and less infrastructure work.
How can I integrate a chat SDK faster?
Use the official SDK documentation, start with a minimal login-and-send-message prototype, and generate boilerplate with TRTC MCP. The @tencent-rtc/mcp server can help AI coding assistants create chat, call, live, and backend integration code based on current TRTC documentation.
About the author: Maya Chen is a developer-focused content strategist specializing in realtime communication APIs, chat architecture, and cross-platform SDK integration for web and mobile applications.


