Effortless session generation for Pyrogram & Telethon
Securely generate session strings for use in Telegram bots or user automation scripts.
⚠️ WARNING: Treat session strings like your password. If someone gets access to your session string, they have full control of your Telegram account. Keep it safe and private.
- Generate session strings for Telethon and Pyrogram.
- Automatically handles login, 2FA, and session saving.
- Saves the session string to a
.txtfile for future use. But I heavily suggest you to delete that file after use. - Compatible with both libraries for maximum flexibility.
Clone this repository:
git clone https://github.com/ChocoJaYY/SessiGrammY.git
cd SessiGrammYCreate a virtual environment (Optional, but recommended):
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`Install the dependencies:
pip install -r requirements.txt- Visit https://my.telegram.org.
- Log in with your Telegram phone number.
- Click on API Development Tools.
- Fill in the required fields:
- App title: Choose any name.
- Short name: Choose a short identifier.
- Click Create application.
- You will now see your API ID and API Hash. Save them securely.
⚠️ If the app creation fails and a popup appears, try using a mobile device. Telegram sometimes blocks API creation from desktops for unknown reasons. I really dont know why :-( .
Run the script:
python SessiGrammY.pyYou'll see:
Choose session type to generate:
1. Telethon
2. Pyrogram
- Select your preferred client.
- Enter your:
- API ID
- API Hash
- Phone number (with country code)
- Enter the verification code you receive.
- If you have 2FA enabled, enter your Telegram password.
- Your session string will be printed and saved to a text file.
Your session string is as powerful as your password. It allows full access to your account, including:
- Sending messages
- Reading messages
- Accessing all your groups, channels, and private chats
If you share your session string, you are giving away your full account access.
- Never share your session string publicly.
- Do not upload it to GitHub or any cloud storage.
- Regenerate a session string if you suspect it was leaked.
Pyrogram("TelegramPlayground" since original project abandoned)
Created by ChocoJaYY
Inspired by the need for secure, easy, and multi-library session management.
This project is open-source and free to use under the MIT License.
