The fastest way to build a real Telegram client in React Native.
TDLib under the hood, prebuilt binaries, one API on iOS and Android. Listed in the official TDLib documentation under JavaScript wrappers.
Website β Β· Docs Β· Example app Β· npm
β The example app shipped in example/. npm install, run, log in.
Building a Telegram client should not start with an hour-long TDLib compile. This library ships prebuilt TDLib binaries for iOS (xcframework, device + simulator) and Android (arm64-v8a, armeabi-v7a, x86_64), wraps the whole API in a single RN module, and streams every update to JS through NativeEventEmitter.
- π 53 first-class methods β auth, chats, messages, reactions, files, options, users.
- π Real-time updates β new messages, typing, read receipts, download progress, reactions.
- π§© Cross-platform parity β iOS and Android emit the same TDLib JSON shape. Write once.
- π¦ Fully typed β
.d.tscovers every method, event and result. - π¦ Zero native setup β no
cmake, nobrew install.pod installand go. - π¬ Ships with a Telegram-like example app β auth wizard, chat list, message view, reactions, reply, typing.
npm install react-native-tdlib
cd ios && pod installRequires React Native β₯ 0.60 (autolinking), iOS β₯ 11, Android minSdk β₯ 21.
import TdLib from 'react-native-tdlib';
import {NativeEventEmitter, NativeModules} from 'react-native';
const emitter = new NativeEventEmitter(NativeModules.TdLibModule);
// 1) Start TDLib
await TdLib.startTdLib({api_id: 12345, api_hash: 'your_hash'});
// 2) Listen for everything
emitter.addListener('tdlib-update', e => {
if (e.type === 'updateNewMessage') {
console.log('π¨', JSON.parse(e.raw).message);
}
});
// 3) Log in (drive via updateAuthorizationState β see docs)
await TdLib.login({countrycode: '+1', phoneNumber: '5551234567'});
await TdLib.verifyPhoneNumber('12345');
// 4) Load chats, send a message
await TdLib.loadChats(25);
const chats = JSON.parse(await TdLib.getChats(25));
await TdLib.sendMessage(chats[0].id, 'Hello from React Native!');A full Telegram-like reference client ships under example/: login wizard, chat list with live updates, chat view with reactions, reply, typing indicator, photo previews, pagination.
git clone https://github.com/vladlenskiy/react-native-tdlib.git
cd react-native-tdlib/example && npm install
cd ios && pod install && cd ..
# Provide your TDLib api_id / api_hash from https://my.telegram.org/apps:
cp .env.example .env
$EDITOR .env
npx react-native run-ios # or run-androidApps and projects shipping react-native-tdlib:
Using react-native-tdlib in production? Open a PR adding your project here, or list yours via the GitHub dependents view.
- Getting Started β β install, auth flow, first chat.
- API Reference β β all 53 methods, grouped.
- Cookbook β β practical recipes (messages, reactions, files, options, typing).
- Events β β
tdlib-updatestream, update types cheatsheet. - Platform Parity β β how iOS and Android stay in sync.
Pull requests welcome. See CONTRIBUTING.md for the local workflow.
Before submitting: npm test must pass and the example app must build on both platforms.
- π Bugs / feature requests β GitHub Issues
- π¬ Questions / discussion β GitHub Discussions
- π¦ Updates β @vladlensk1y on Twitter/X
- βοΈ Private β vkaveev@outlook.com
Open source takes time. If this library saves you a week of wrestling with cmake and TDLib internals, consider supporting development:
Sponsors are listed in the CHANGELOG and on the repository homepage.
MIT Β© Vladlen Kaveev and contributors. TDLib itself is licensed under the Boost Software License.