What is Sessions storage

Telegram sessions storage — it's a server which saves keys and other data which are required to access Telegram accounts. On the platform SIP.tg is possible to manage unlimited storages, each of them can store an unlimited amount of accounts. The module of the storage is implemented basing on the official Telegram library with open source — TDLib.

In addition to official storages, every user can create their own sessions storage on the SIP.tg platform. The storage selection is possible only at the moment of creating a new Telegram session, the movement of Telegram sessions between the storages is not provided.

Telegram sessions storage features

The data stored in the storage is used to connect and interact with the Telegram infrastructure. Interaction between the SIP.tg platform and the storage goes through TCP protocol. Manager module connects to the storage and transfers an internal ID. After that all communicating is basing on transferring commands in both directions in JSON format.

In addition, the storage provides additional features:

  • rejects not allowed commands;
  • limits the transfer only of allowed event types (update);
  • supports unlimited TCP connections to one Telegram session;
  • performs automatic user search by username and phone number;
  • caches user search results;
  • has two modes of data storage: in the local SQLite database (using TDLib library) or in the external MySQL database.
System requirements

The environment of the storage is based on Docker platform virtualization, basing on Ubuntu 18.04 image. We do not recommend to use the host operating system except Linux (Mac OS, Windows) to avoid a program emulation of the environment. All another software requirements are included to the distributed image, on the host is required only Docker CE and Docker Compose.

The server must has external IP address and be accessible from the Internet, or you must have ability to map some port to the external IP address.

Sessions storage settings

Certificates obtaining

Encryption certificates allow to establish secure connection between SIP.tg platform and the storage server. In settings of the bot @siptg_bot execute command /storage and push the button New.

As a result bot will sent 2 files: the private key and the certificate, which are required for secure connection. Save them — they will be required to send to the server of the storage.

Server prepare

Most detailed and actual information is located on the page of the project on GitHub. The sequence of actions includes:

  • updating installed software (optional);
  • installing Docker software;
  • obtaining configuration templates;
  • pushing certificate files from the bot to the server;
  • making changes to configuration files (optional);
  • running the storage on the server.
Connecting to the sessions storage

The last step in settings is setting up the connection address through the bot. Push Address button and input the address and the port of the server where the storage is running on. Next push Turn on button to make an attempt to connect to the storage server. If connection parameters are wrong, you will get the message with error and the storage will be switched off automatically.