A standalone Telegram bot for the SplitLLM application, enforcing Service-to-Service authentication.
- Personal Expenses: Send text like "Lunch 20" to add personal expenses.
- Group Expenses:
- Use
/g_expense <group_name> <amount> <description> - Or upload a receipt and select a group.
- Use
- View Data: Check
/dues,/stats,/groups, and/friends.
-
Create Virtual Environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Environment Variables: Copy
.env.exampleto.envand fill in:TELEGRAM_BOT_TOKEN: From @BotFather.BOT_SERVICE_SECRET: A secure random string shared with the Backend.BACKEND_URL: URL of your running backend.
This bot does not handle user login directly.
- User Linking:
- User logs into the SplitLLM Web/App.
- User requests to "Link Telegram".
- Backend generates a unique linking code.
- User enters this code in the Web/App.
- Backend validates and stores the
telegram_idagainst the user's account.
- Bot Requests:
- The Bot sends
X-Telegram-User-IDandX-Bot-Secreton every request. - The Backend verifies the Secret and uses the ID to identify the user.
- The Bot sends
python bot.py