A comprehensive role-based Telegram bot for managing hotel staff tasks, maintenance, and housekeeping workflows. All operations live in Telegram with real-time Google Sheets synchronization.
All requirements met. All issues fixed. Ready for production.
| Component | Status | Details |
|---|---|---|
| Report Generation | β WORKING | Today's & weekly reports pull real data |
| Data Syncing | β WORKING | Cleaning, maintenance, and tasks all sync |
| Admin Alerts | β WORKING | Real-time notifications on all actions |
| Staff Management | β WORKING | Add/remove/list staff with roles |
| Role-Based Access | β WORKING | Staff vs Admin commands properly segregated |
cd /home/soarer/Documents/projects/freelance/Hotel-Workflow-Bot
source bot_env/bin/activate
pip install -r requirements.txtCreate .env file:
TELEGRAM_BOT_TOKEN=your_token_here
ADMIN_USER_IDS=your_telegram_id
GOOGLE_CREDENTIALS_FILE=credentials.json
SPREADSHEET_NAME=Hotel Workflow Data
python3 hotel_bot.pypython3 test_sheets.py/clean- Mark room cleaning progress/maintenance- Report maintenance issue/task- Mark task as completed/mystats- View your activity statistics/start- Show available commands/getid- Get your Telegram User ID
/admin- Open control panel with buttons/today- View today's activity report/weekly- View weekly summary and top performers/addstaff- Register new staff member/removestaff- Remove staff member/liststaff- View all registered staff/staffguide- Admin management guide
- Real-time notifications to all admins on staff actions
- Automatic data sync to Google Sheets
- Role-based help messages for non-command input
- Admin alerts for every cleaning, maintenance, and task entry
All data syncs automatically to Google Sheets:
- Room number
- Status (Not Started, In Progress, Done, Pending Review)
- Staff name and ID
- Timestamp
- Room number
- Issue description
- Priority (Low, Medium, High, Critical)
- Staff name and ID
- Timestamp
- Task name
- Staff name and ID
- Completion status
- Timestamp
- Telegram User ID
- Name
- Role (Staff or Admin)
- Date registered
π Today's Report (2026-01-14)
π§Ή Cleaning: 2 rooms processed
Recent updates:
β’ Room 101 β Done (John)
β’ Room 102 β In Progress (Mary)
π§ Maintenance: 1 issues reported
Recent reports:
β’ Room 103: Faucet leaking (HIGH)
β
Tasks: 2 completed
Recent tasks:
β’ Clean lobby (John)
π Weekly Summary
(2026-01-07 to 2026-01-14)
π§Ή Cleaning: 15 rooms cleaned
π§ Maintenance: 8 issues reported
β
Tasks: 20 completed
π Top Performers:
π₯ John: 18 activities
π₯ Mary: 15 activities
π₯ Bob: 12 activities
Admin: /addstaff
Bot: "Enter staff's User ID"
Admin: Types user ID from /getid command
Bot: "Enter staff name"
Admin: Types name
Bot: Shows role selection (Staff or Admin)
Admin: Selects role
Bot: Confirms and registers
Staff: Gets access to bot
Admin: /removestaff
Bot: Shows list of all staff
Admin: Clicks staff member to remove
Bot: Confirms removal
Staff: Loses access
Admins automatically receive alerts:
On Cleaning Update
π Admin Alert
π§Ή Cleaning Update
Room: 101
Status: Done
Staff: John
On Maintenance Report
π Admin Alert
β οΈ Maintenance Report
Room: 102
Issue: Faucet leaking
Priority: HIGH
By: Mary
On Task Completion
π Admin Alert
π Task Completed
Task: Clean lobby
By: John
| Document | Purpose |
|---|---|
| README.md (this file) | Overview and quick start |
| SETUP_AND_TESTING.md | Complete setup guide and testing procedures |
| DEPLOYMENT.md | Production deployment and operations |
| TECHNICAL_DOCUMENTATION.md | Architecture, code details, and extension points |
| CHANGES.md | Detailed change log and what was fixed |
- Send
/cleancommand - Enter room number (e.g., 101)
- Select status
- Check Google Sheets - entry appears instantly
- Admin receives notification
- Admin sends
/today - Should show entries logged today
- Should show counts and recent entries
- Send
/getidto get your Telegram ID - Admin sends
/addstaff - Admin enters ID, name, role
- You can now use
/start
source bot_env/bin/activate
python3 test_sheets.pyExpected output:
β
Successfully authenticated with Google Sheets
β
Found spreadsheet: Hotel Workflow Data
β
Cleaning Log: X records
β
Maintenance Log: X records
β
Task Completion Log: X records
β
Staff Registry: X records
β
Successfully logged test data
β
Report generation works
- Credentials: Keep
.envandcredentials.jsonsecure - Access Control: Only registered users can access bot
- Role-Based: Staff and admin have different permissions
- Data: All data encrypted in transit and at rest (Google Sheets)
- Audit Trail: Every action timestamped with staff member info
python3 hotel_bot.pysudo systemctl start hotel-bot
sudo systemctl enable hotel-botSee DEPLOYMENT.md for full production setup.
# Use commands to log test data first
/clean β enter room β select status
/maintenance β enter room β describe issue β select priority
/task β enter task name
# Then check reports
/today# Verify virtual environment
source bot_env/bin/activate
# Check dependencies
pip install -r requirements.txt
# Run bot with output
python3 hotel_bot.py# Run diagnostic
python3 test_sheets.py
# Verify credentials
cat credentials.json | head -5
# Check .env
cat .env- Ensure
ADMIN_USER_IDSis set in.env - Admin should send
/startfirst - Check bot logs for errors
See SETUP_AND_TESTING.md for more troubleshooting.
- Python 3.8+
- Telegram account with bot token
- Google account with Sheets API access
- Linux/Mac/Windows with internet connection
All included in requirements.txt:
- python-telegram-bot==20.7
- gspread==5.12.0
- google-auth-oauthlib==1.1.0
- python-dotenv==1.2.1
- (plus other supporting libraries)
β Staff can log cleaning progress β Staff can report maintenance issues β Staff can mark tasks complete β All data syncs to Google Sheets β Admins get real-time notifications β Reports show real data from sheets β No fake or dummy data β Role-based access control β Staff management (add/remove) β Activity statistics tracking β Help messages with role-specific commands
Phase 2: Task assignment, room status tracking, scheduling Phase 3: Web dashboard, analytics, email reports Phase 4: Mobile app, multi-location support
- Check documentation files (README, SETUP_AND_TESTING.md)
- Run diagnostic:
python3 test_sheets.py - Review TECHNICAL_DOCUMENTATION.md for architecture
- Check bot logs for error messages
Version: 1.0.0 | Status: β Production Ready | Last Updated: 2026-01-14
- β³ Pending Review - Cleaning done, waiting for inspection
/maintenance
- Click "Report Issue"
- Enter the room number
- Describe the issue (e.g., "Broken AC", "Leaking faucet")
- Select priority:
- π’ Low - Can wait
- π‘ Medium - Should be fixed soon
- π High - Urgent
- π΄ Critical - Emergency
/task
- Click "Mark Task Complete"
- Enter the task name (e.g., "Pool cleaning", "Lobby inspection")
- Task is automatically logged
/mystats
See how many rooms you've cleaned, maintenance reports submitted, and tasks completed today and all-time.
Step-by-step process:
-
Ask staff member to run
/getid- They'll get their User ID from the bot
- They share it with you
-
Run
/addstaffcommand- Enter the staff member's User ID
- Enter their full name
- Select their role:
- π Staff - Can log cleaning, maintenance, and tasks
- π¨βπΌ Admin - Can manage staff and view reports
-
System automatically notifies the staff member
- They receive a welcome message
- They can start using
/startto see available commands
/liststaff
Shows all staff members organized by role with their join dates.
/removestaff
Click on a staff member to remove them from the system.
/today
Shows:
- Number of rooms cleaned with recent examples
- Maintenance issues reported with priority levels
- Tasks completed
/weekly
Shows:
- Total cleaning, maintenance, and tasks for the week
- Top 5 performing staff members with medals (π₯π₯π₯)
/admin
Central hub with buttons for:
- π Today's Reports
- π Weekly Summary
- π₯ Staff List
- β Add Staff
- π Reset Tasks
- π Full Reports (Google Sheets)
/staffguide
Detailed guide explaining the complete staff management workflow.
- Telegram Bot Token (from @BotFather)
- Google Cloud Service Account credentials
- Python 3.8+
- Open Telegram and message @BotFather
- Send
/newbot - Follow the prompts to create your bot
- Save the API token
- Go to Google Cloud Console
- Create a new project
- Enable these APIs:
- Google Sheets API
- Google Drive API
- Create a Service Account:
- Credentials β Create Credentials β Service Account
- Go to the service account β Keys β Add Key β Create new key
- Download as JSON and save as
credentials.json
- Create a Google Sheet named "Hotel Workflow Data"
- Share the sheet with the service account email (from credentials.json)
pip install -r requirements.txtCreate a .env file:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
GOOGLE_CREDENTIALS_FILE=credentials.json
SPREADSHEET_NAME=Hotel Workflow Data
ADMIN_USER_IDS=123456789,987654321
Note: Get admin User IDs by running /getid
python3 hotel_bot.pyThe bot will automatically create all necessary Google Sheets worksheets on first run.
The bot automatically creates and manages these Google Sheets:
| Timestamp | Room Number | Staff Name | Staff ID | Status | Notes |
|---|---|---|---|---|---|
| 2024-01-13 10:30:45 | 101 | John | 123456 | Done | - |
| Timestamp | Room Number | Issue | Staff Name | Staff ID | Priority | Status |
|---|---|---|---|---|---|---|
| 2024-01-13 11:15:30 | 205 | Broken AC | Jane | 789012 | High | Open |
| Timestamp | Task Name | Staff Name | Staff ID | Status |
|---|---|---|---|---|
| 2024-01-13 14:00:00 | Pool Cleaning | Mike | 456789 | Completed |
| User ID | Name | Role | Date Added | Status |
|---|---|---|---|---|
| 123456 | John Smith | staff | 2024-01-10 09:30:00 | active |
β Core Functionality
- Interactive button-based interface
- Conversation handling for multi-step processes
- Real-time admin notifications
- Google Sheets integration
β Staff Management
- Complete staff registration system
- Role-based access control (Staff/Admin)
- Staff removal with database cleanup
- User ID retrieval for easy onboarding
β Reporting Features
- Daily activity summaries
- Weekly performance metrics
- Top performer rankings
- Individual staff statistics
β Status & Priority Examples
- Cleaning statuses with clear examples
- Maintenance priorities with color indicators
- Safe data access (fixed "list out of range" error)
β Admin Guide
- Comprehensive staff management guide
- Step-by-step workflow instructions
- Role explanations
- Best practices
- Only authorized users (admins + registered staff) can use the bot
- Admin-only commands are protected
- All activities logged with timestamp and user information
- Safe error handling prevents system crashes
- Check that
TELEGRAM_BOT_TOKENis correct in.env - Ensure bot has internet connection
- Verify
credentials.jsonexists and is valid - Check that service account has access to the sheet
- Ensure sheet name matches
SPREADSHEET_NAMEin.env
- Ask staff to run
/getidto get their User ID - Use
/addstaffto register them properly - Verify User ID is entered correctly (no spaces)
- This error is now fixed with safe indexing
- Reports gracefully handle empty data
| Command | User | Purpose |
|---|---|---|
/start |
All | Show welcome message and available commands |
/getid |
All | Get your Telegram User ID |
/clean |
Staff | Log room cleaning |
/maintenance |
Staff | Report maintenance issue |
/task |
Staff | Log task completion |
/mystats |
Staff | View personal activity statistics |
/admin |
Admin | Open admin control panel |
/addstaff |
Admin | Register new staff member |
/liststaff |
Admin | View all staff members |
/removestaff |
Admin | Remove staff member |
/today |
Admin | View today's activity report |
/weekly |
Admin | View weekly performance summary |
/reset |
Admin | Reset daily tasks |
/staffguide |
Admin | View staff management guide |
- Create Telegram bot with @BotFather
- Set up Google Cloud service account
- Download credentials.json
- Create
.envfile with your tokens - Run
pip install -r requirements.txt - Start bot with
python3 hotel_bot.py - Add yourself as admin using your User ID
- Test with
/startand/getid - Add first staff member using
/addstaff - Train staff on commands
Private project for hotel operations.
For issues or feature requests, contact the development team.