🔍 Overview
Link Switcher includes a simple Telegram bot used to register Telegram users.
The bot validates a shared secret (TELEGRAM_BOT_AUTH_KEY) and stores the Telegram profile in the database as a TelegramUser.
Note: this bot does not automatically link a Telegram user to a Django User. The association is done via TelegramUserMapping (usually in the admin panel).
🤖 Bots
🛠 How to Run
Run from the Link Switcher project root:
poetry run python apps/telegram/bot.pyThe bot requires Django settings + database access.
Relevant settings:
TELEGRAM_BOT_TOKENTELEGRAM_BOT_AUTH_KEY
⚙️ How It Works
- User sends
/start. - Bot asks for the authorization key.
- If the key matches
TELEGRAM_BOT_AUTH_KEY, the bot upsertsTelegramUserbyuser_external_id. - The bot replies with success (or asks to retry).
✅ Example Session
User: /start
Bot: 💡 For authorization, please enter the authorization key:
User: my-secret-key
Bot: ✅ Successfully authorized.
🚀 Welcome, John!
💡 Notes
- Notification delivery is handled by Celery tasks and can use multiple bot tokens (base/offers/tracking-domain). See Send Messages Task.