A Telegram bot connected to a REST API built with Django. Features include:
- Viewing posts
- Adding, editing, and deleting posts
- Authentication via login/password
git clone https://github.com/your-username/blogbot_project.git
cd blogbot_projectpython -m venv venv
source venv/bin/activate # on Windows: venv\Scripts\activate
pip install -r requirements.txtRename .env.example to .env:
mv .env.example .env # or rename manually in ExplorerThen insert your Telegram token from @BotFather into the BOT_TOKEN field.
python manage.py migrate
python manage.py createsuperuser
python manage.py runserverIn a separate terminal:
python bot/main.py
⚠️ Important: The Django server and the bot must be running simultaneously in different terminal windows.
| Command | Description |
|---|---|
/start |
Welcome message |
/login |
Authentication (username + password) |
/posts |
List all posts |
/add |
Add a post (after authentication) |
/edit <id> |
Edit a post |
/delete <id> |
Delete a post |
All routes are prefixed with /api/.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/login |
Obtain an authentication token |
GET |
/api/posts |
Get all posts |
GET |
/api/posts/<id> |
Get a single post by ID |
POST |
/api/posts |
Create a post (requires token) |
PUT |
/api/posts/<id> |
Update a post (requires token) |
DELETE |
/api/posts/<id> |
Delete a post (requires token) |
📘 Documentation available at: /api/docs