# ⚙️ UserBot Authorization - Final Guide ## Current Status ✅ ✅ Bot is running ✅ UserBot service is running ✅ Containers are healthy ⏳ UserBot needs **ONE-TIME** authorization --- ## 📲 Authorization (2 Methods) ### Method 1: Simple Authorization (Recommended) ```bash cd /home/trevor/dev/TG_autoposter ./authorize_userbot_simple.sh ``` Then: 1. **Wait for SMS** - You'll receive a code to `+821056936103` 2. **Enter the code** when prompted 3. **Done!** ✅ ### Method 2: Original Script ```bash ./init_telethon_session.sh ``` Same process, slightly more verbose output. --- ## 🔍 What's Happening When you run the authorization script: ``` 📱 Phone: +821056936103 🔗 Connecting to Telegram... ✅ Connected! 🔐 Sending SMS code request... 📲 SMS sent! Check your messages. 📝 Enter the SMS code: [YOU TYPE HERE] ``` **Then:** - ✅ Session is saved - ✅ UserBot restarts - ✅ You'll see: "✅ UserBot инициализирован" --- ## ⏱️ Timeline | Step | Time | Action | |------|------|--------| | 1 | <1 min | Run script | | 2 | 0-2 min | Receive SMS | | 3 | <1 min | Enter code | | 4 | <1 min | Save session | | **Total** | **3-5 min** | Done! ✅ | --- ## ❓ FAQ ### Q: I don't see the SMS code prompt **A:** Make sure you're running WITHOUT `sudo`: ```bash ./authorize_userbot_simple.sh # ✅ Correct sudo ./authorize_userbot_simple.sh # ❌ Wrong ``` ### Q: SMS didn't arrive **A:** 1. Wait 30 seconds more 2. Check spam folder 3. Make sure `TELETHON_PHONE` in `.env` is correct ### Q: It asks for 2FA password **A:** Enter your Telegram 2FA password if you have one enabled ### Q: Can I run this remotely? **A:** Yes! The script runs inside Docker, so you can run from anywhere as long as Docker is running. --- ## ✅ Success Indicators After running the script, you should see: ``` ✅ Authorization Complete! Restarting UserBot container... ``` Then in logs: ``` ✅ UserBot инициализирован: Your Name (@username) 🔄 UserBot готов к обработке задач ``` --- ## 🚀 Next Steps After Authorization 1. ✅ Send `/start` to bot 2. ✅ Click "🤖 UserBot" button 3. ✅ Try "📥 Собрать группы" (Collect Groups) 4. ✅ Check database for results --- ## 📊 Session Files After authorization, these files will be created: ``` app/sessions/ ├── userbot_session.session (main session - encrypted) └── telethon_string_session.txt (backup) ``` **Important:** Never commit these to git (they're in `.gitignore`) --- ## 🔧 Troubleshooting ### Error: "No suitable method of authorization" - Phone number is incorrect in `.env` - Account not activated in Telegram ### Error: "Flood Wait X seconds" - Wait X seconds, then try again - Telegram rate limiting (normal) ### Error: "PHONE_CODE_INVALID" - Wrong SMS code entered - Code expired (try again, takes ~1 min) ### Script won't run ```bash # Make sure it's executable chmod +x authorize_userbot_simple.sh # Run it ./authorize_userbot_simple.sh ``` --- ## 📞 Support Check these files for more info: - `README_COMPLETE.md` - Full documentation - `TELETHON_AUTHORIZATION_GUIDE.md` - Detailed guide - `COMPLETION_CHECKLIST.md` - What to do next --- ## ✨ That's It! Everything is ready. Just run: ```bash ./authorize_userbot_simple.sh ``` And follow the prompts. You'll be done in 3-5 minutes! 🎉