Skip to content

String Session Generator

prototype74 edited this page Dec 26, 2021 · 10 revisions

The String-Session-Generator allows the user to obtain a new String Session in combination with the user's App api_id (API Key) and App api_hash (API Hash) to allow HyperUBot to login into the user's account to interact as 'user'bot.

What are String Sessions?

Besides String Sessions there are Memory Sessions and SQLite Sessions supported by Telethon. HyperUBot, however uses String Sessions as it contains necessary data only to authentificate the user account while establishing a connection to Telegram's server. By this, you don't need to re-login each time when starting the userbot.

Read more information about (String) Sessions here

Obtain your App api_id and App api_hash

In order to get a new String Session, you need to create a new Application or use an existing Application at My Telegram to obtain the App api_id and App api_hash:

  1. Login to My Telegram: https://my.telegram.org
  2. Go to API development tools and fill out the form
  3. Get your App api_id and App api_hash like you see in the picture below

Note: These values are unique and you shouldn't share these with anyone else, as these values allow the person to login into your account

Get a new String Session

To get a new String Session, start the String-Session-Generator by locating to HyperUBot's directory and running the following command in terminal:

  • Docker: Run docker image/container then select String-Session-Generator
  • POSIX systems: python3 generate_session.py (if it fails, try it by python version e.g. python3.8 generate_session.py)
  • Windows: python generate_session.py


The String-Session-Generator will prompt you for the following information:

  1. Your App api_id and App api_hash
  2. Your phone number to interact as userbot
  3. Your account's password, if the Two-factor authentication (2FA) is enabled
  4. Your verification code

If everything went fine, you should see a long string in your terminal (may be green colored). The String-Session-Generator will suggest you to store the generated string into a secured configuration to keep it safe from unauthorized access.

Warning: do not share the String Session with anyone else, as it grants the person who has it, full access to your account! If your string session got leaked, straight terminate that session!