Task Manager Bot API Docs

Full REST API, Team/Project/Task management, Telegram integration

📂 Project Structure (Folders/Files)

tg-task-manager-bot/
├── app.js                # Main Express app
├── bot/                  # Telegram bot logic, commands
├── config/               # Config management
├── database/             # Supabase models/tables
├── middleware/           # Express middleware
├── routes/               # API, webhook, project routes
├── public/index.html     # [This doc]
├── tests/                # Automated/test scripts
├── utils/                # Logger, errorHandler, ...

🚀 Quickstart Example

fetch('/api/v1/users/12345/tasks').then(r=>r.json()).then(data => console.log(data.tasks));

🔌 REST API Endpoints

/api/v1/users − User tasks/statistics
GET /api/v1/users/:telegramId/tasks?status=<status>
List tasks by user, optionally by status.
fetch('/api/v1/users/12345/tasks?status=pending')
.then(r=>r.json())
.then(data => data.tasks)
POST /api/v1/users/:telegramId/tasks
Create a new task.
fetch('/api/v1/users/12345/tasks', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: 'New Task', description: 'Details', priority: 'medium', dueDate: 'YYYY-MM-DD' })
})
.then(r=>r.json())
.then(data => data.task)
GET /api/v1/users/:telegramId/stats
Get stats of a user.
/api/v1/tasks − CRUD & Queries
PUT /api/v1/tasks/:taskId
Update an existing task.
fetch('/api/v1/tasks/123', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ status: 'completed' })
})
.then(r=>r.json())
.then(data => data.task)
DELETE /api/v1/tasks/:taskId
Delete a task by id.
fetch('/api/v1/tasks/123', { method: 'DELETE' })
.then(r=>r.json())
/api/project − Project Management
POST /api/project/create - Create project
GET /api/project/:id - Fetch project by id
GET /api/project/team/:team_id - List projects for a team
PUT /api/project/:id - Update project
/api/team − Team Endpoints
GET /api/team/:teamId - Info, users, tasks
PUT /api/team/:teamId - Edit team info
/api/user − User CRUD
GET /api/user/:userIdOrUserName
POST /api/user
PUT /api/user/:userId
DELETE /api/user/:telegramId
/api/webhook − Webhook Endpoints
POST /api/webhook/telegram - Telegram webhook receive
POST /api/webhook/set - Set webhook URL
DELETE /api/webhook - Delete webhook
See more in routes/ and database/tables/
See code for advanced filters, stats endpoints and database join logic.

🗃️ Data Models (Simplified)

UserTaskProjectTeam
id (UUID/int)
user_name
first_name
last_name
language_code
avatar_url
premium
id (int)
title
description
status
priority
due_date
created_by
assigned_to
project_id
id (int/UUID)
name
name_code
description
team_id
id (int/UUID)
name
description
See database/tables/ JS for full structures and more advanced query params.

💡 Tips & Resources