A Telegram bot designed to help teams stay synchronized with daily plans. The bot automatically reminds team members to share their daily plans and tracks responses.
- Initial Reminder: 6:00 AM GMT on working days (Monday-Friday)
- Follow-up Reminders: 9:00 AM, 12:00 PM, and 3:00 PM GMT (up to 4 total reminders per day)
- Smart Tracking: Only sends follow-up reminders if not everyone has responded
- Database-driven: User tracking managed through PostgreSQL
- Per-chat Configuration: Users tracked separately for each chat
- Username Required: All tracked users must have Telegram usernames
- Admin Configuration: Users managed directly in the database
/status- Check who has replied today and reminder count/help- Show command help
- Tracks any message from configured users as a daily plan response
- Automatically updates usernames when users send messages
- Confirms when all team members have responded
- Note: Only users with usernames can be tracked
- Node.js (version 16 or higher)
- PostgreSQL database
- Telegram Bot Token (from @BotFather)
Create a .env file in the project root:
Option 1: Using DATABASE_URL (Heroku Postgres)
TELEGRAM_BOT_TOKEN=your_bot_token_here
DATABASE_URL=postgres://username:password@hostname:port/databaseNote: SSL is automatically enabled when using DATABASE_URL
Option 2: Using individual database variables
TELEGRAM_BOT_TOKEN=your_bot_token_here
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=mdpNote: SSL is disabled for local development
-
Install Dependencies:
npm install
-
Create Database:
npm run db:create
-
For Development (with sample user data):
npm run db:create -- --with-stubs
-
Build and Start:
npm run build npm start
For development with auto-reload:
npm run dev
- Add the Bot to your group chat
- Configure Users: Add users to the database (see User Management section)
- Verify Setup: Use
/statuscommand in the chat
The bot will automatically send daily reminders and track responses from configured team members.
CREATE TABLE users (
telegram_id BIGINT PRIMARY KEY,
chat_id BIGINT NOT NULL,
username VARCHAR(255) NOT NULL,
is_active BOOLEAN DEFAULT TRUE
);- telegram_id: User's Telegram ID (stored as number)
- chat_id: Chat where the user should be tracked (stored as number)
- username: User's Telegram username (required)
- is_active: Whether the user is currently being tracked
Add users directly to the database:
-- Add a user
INSERT INTO users (telegram_id, chat_id, username, is_active)
VALUES (123456789, -1001234567890, 'username', true);
-- Remove a user (soft delete)
UPDATE users SET is_active = false
WHERE telegram_id = 123456789 AND chat_id = -1001234567890;
-- List active users
SELECT * FROM users WHERE is_active = true;- User IDs: Add @userinfobot to your group temporarily
- Chat IDs: Check bot logs when adding it to a group, or use the
/statuscommand
Important: Only users with Telegram usernames can be tracked by the bot.
In development mode, manually trigger reminders:
remind # Follow-up reminder
remind 6 # Initial reminder (6 AM type)- Reset Database:
npm run db:create -- --force - With Sample Data:
npm run db:create -- --force --with-stubs - Schema Only:
npm run db:seed
npm test
npm run test:watch
npm run test:coverage- Use
/helpcommand in Telegram for bot usage - Use
/statusto check current tracking status - Manage users through database administration tools
- Ensure all tracked users have Telegram usernames