Installation
Requirements#
- Node.js version >= 12 or above (which can be checked by running
node -v). You can use nvm for managing multiple Node versions on a single machine installed
Install#
Select environment#
Depending on your environment, you need to use different import paths. Currently, two environments are supported:
nodeโ if you run the code in the Node.jsbrowserโ if you run the code in a browser environment
Import for node environment#
Import for browser environment#
Configure default storage#
We have default storages. The storage is used to store the session (authentication keys, server salts and time offset). Depending on the environment, you need to pass different parameters for the storage. But you can also use custom storage
For node environment#
In the storageOptions.path, pass the absolute path to the json file through the constructor
For browser environment#
The window.localStorage is used for storage. You don't need to pass storageOptions
Getting api_id and api_hash#
About abuse
If you use the Telegram API for flooding, spamming, faking subscriber and view counters of channels, you will be banned forever
- Login into https://my.telegram.org/
- Go to https://my.telegram.org/apps and fill out the form
- Take the
api_idandapi_hashfrom the "app configuration" section
Final check#
Create simple file#
example.js