The project is composed by the following modules:



This structure helps keeping a modular implementation, leaving you the choice of the what you want do use or implement yourself. It's strongly recommended to use the api module that is the highest level of abstraction for the Telegram API.
But for advance usage or people who would want to implement their own client, the documentation will still detail all modules.

tl-builder: Type Language compiler

Converts json-representation of TL Schema to Java classes with generated classes for serializing and deserializing api messages and methods to their binary representation (see Binary Data Serialization).
This module is using JavaPoet to generate the classes.


  1. Run the main class in tl-builder module with the layer value

The classes will be generated in the tl module in the package


Can I generate classes for an older layer?


  • Place the json tl-schema in the resources folder, name it tl-schema-X.json where X is the layer version
  • Edit Main.kt and change the value of TL_SCHEMA_LEVEL with the layer level
  • Run the class as explained previously :)


Where can I get the json tl-schema?

Sadly, Telegram library is outdated, and despite they claim having a public API, the public support clearly stopped a very long time ago. Clearly they must have a private doc, I doubt that the official developers are developing without any kind of documentation.
I hope they'll update it one day (because the very little we have is very messy...). So to find the new layers schema, you'll have to look into the official apps repo.

tl: Type Language library

Contains the base type of the Type Language (int, long, Vecor, ...) and the classes generated by the tl-builder. This module is the lowest level in the library, it supplies all the necessary classes to serialize/deserialize objects describe in the TL Schema.

About TL Language

"TL Language (Type Language or Time Limit) serves to describe the used system of types, constructors, and existing functions. In fact, the combinator description format presented in Binary Data Serialization is used."

mtproto: MTProto Mobile Protocol library

Contains all the necessary stuff to make RPC (Remote Procedure Call) and handle all the low-level stuff (like handling salt, etc.)

About MTProto..

MTProto is the Telegram Messenger protocol
"designed for access to a server API from applications running on mobile devices".

The Mobile Protocol is subdivided into three components (from the official site):

  • High-level component (API query language): defines the method whereby API
    queries and responses are converted to binary messages.

  • Cryptographic (authorization) layer: defines the method by which messages
    are encrypted prior to being transmitted through the transport protocol.

  • Transport component: defines the method for the client and the server to transmit
    messages over some other existing network protocol (such as, http, https, tcp, udp).


High-level API to easily use Telegram's api methods without having to understand the first thing about MTProto or TL Language :)
An old fashioned Java API (like using RestFB or a any Rest API binding).

Did this page help you?