How to use Telegram's TDlib with Node.js

9.7k Views Asked by At

There is TDlib which allows to work with Telegram Client API.

Documentation says that it's possible to use it with almost any language.

I can't imagine myself how I can use it with Node.js

Could you tell me where to start from or provide me with a sample code?

3

There are 3 best solutions below

0
On BEST ANSWER

You can probably port one of the examples on their GitHub repos (Python can be an easy one). You needs to learn how to use binary modules with node.

Or you can check one of the 3rd party libraries (eg. https://github.com/k-egor-smirnov/node-tg-native)

0
On

There are 2 active TDLib wrappers in Node.js:

Both require you to build the TDLib binary yourself before using these wrapper: https://tdlib.github.io/td/build.html

0
On

You can make requests and get updates using td_json_client and node-ffi interfaces. Official repository provides a simple example.

If you don't want to create API client from zero, you may use one of exists. For example, check out Airgram. This is a strong typed tdlib client for NodeJS.