npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-tdlib

v1.3.1

Published

React Native wrapper for TDLib

Readme

React Native TDLib

NPM Version License npm Downloads

⚠️ Note: This library is currently under development, and contributions are welcome! If you'd like to help improve the library, feel free to submit issues or pull requests.

react-native-tdlib is a React Native bridge for the TDLib (Telegram Database Library) that allows developers to interact with Telegram's API seamlessly in their React Native applications.

Installation

npm install react-native-tdlib
# or
yarn add react-native-tdlib

Available Methods

The library provides the following methods for interacting with Telegram's TDLib. These are grouped into Base API and High-Level API for easier understanding.


High-Level API

These methods simplify common tasks and abstract away low-level details.

| Method | Description | |------------------------|------------------------------------------------------------| | startTdLib | Starts the TDLib service with required parameters. | | login | Initiates login with a phone number. | | verifyPhoneNumber | Verifies a phone number using an OTP code. | | verifyPassword | Verifies the account password for two-factor authentication. | | getAuthorizationState | Fetches the current authorization state. | | getProfile | Retrieves the profile information of the logged-in user. | | logout | Logs out of the current session. |


Base API (Not recommended)

These methods offer low-level access to TDLib's functionalities.

| Method | Description | |------------------------|------------------------------------------------------------| | td_json_client_create | Creates a new TDLib client instance. | | td_json_client_execute | Synchronously executes a TDLib request. | | td_json_client_send | Sends a TDLib request asynchronously. | | td_json_client_receive | Receives a TDLib response with a timeout. |


Example Usage

High-Level API Example

// Start TDLib
await TdLib.startTdLib({
  api_id: 123456,
  api_hash: 'your_api_hash'
});

// Login with phone number
await TdLib.login({
  countrycode: '+1',
  phoneNumber: '1234567890'
});

// Verify phone number
await TdLib.verifyPhoneNumber('12345'); // Replace with the OTP you received

// Verify password (Optional)
await TdLib.verifyPassword('password');

// Get current profile
const profile = await TdLib.getProfile();
console.log(profile);

Base API Example

const tdLibParameters = {
    '@type': 'setTdlibParameters',
    parameters: {
        database_directory: 'tdlib',
        use_message_database: true,
        use_secret_chats: true,
        api_id: 123456, // Replace with your API ID
        api_hash: 'your_api_hash', // Replace with your API Hash
        system_language_code: 'en',
        device_model: 'React Native',
        system_version: '1.0',
        application_version: '1.0',
        enable_storage_optimizer: true,
    },
};

// Send TDLib parameters
TdLib.td_json_client_send(tdLibParameters);

Features

  • Direct communication with TDLib for Telegram API interactions.
  • Cross-platform support for iOS and Android.
  • Easy-to-use methods for common TDLib operations, such as setting parameters, sending requests, and receiving updates.

📝 TODO

  • [ ] Move Prebuilt Library out of Repository
  • [ ] Complete Android Method Implementations
  • [ ] Improve Documentation
  • [ ] Make a list of methods to implement

Example Project

This repository includes an example directory with a fully functional React Native project that demonstrates how to use the library. You can explore the example project to see how the library is integrated and used.

Running the Example

  1. Clone the repository:
git clone https://github.com/vladlenskiy/react-native-tdlib.git
cd react-native-tdlib/example
  1. Install dependencies:
npm install
# or
yarn install
  1. Run the app:
npx react-native run-android   # For Android
npx react-native run-ios       # For iOS