Skip to content

vladlenskiy/react-native-tdlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

148 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

react-native-tdlib

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

CI npm downloads stars used by license platforms website

Example app demo β€” login, chat list, messaging, reactions, typing

↑ The example app shipped in example/. npm install, run, log in.


Why

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.ts covers every method, event and result.
  • πŸ“¦ Zero native setup β€” no cmake, no brew install. pod install and go.
  • 🎬 Ships with a Telegram-like example app β€” auth wizard, chat list, message view, reactions, reply, typing.

Install

npm install react-native-tdlib
cd ios && pod install

Requires React Native β‰₯ 0.60 (autolinking), iOS β‰₯ 11, Android minSdk β‰₯ 21.

Hello, Telegram

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!');

Example app

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-android

Used by

Apps 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.

Documentation

Contributing

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.

Community & support

Sponsor this project

Open source takes time. If this library saves you a week of wrestling with cmake and TDLib internals, consider supporting development:

Sponsor on GitHub

Sponsors are listed in the CHANGELOG and on the repository homepage.

Star History

Star History Chart

License

MIT Β© Vladlen Kaveev and contributors. TDLib itself is licensed under the Boost Software License.

About

The fastest way to build a real Telegram client in React Native

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors