A free, fully-automated Telegram bot that helps users plan their daily study schedule with interactive prompts and automatic 7 AM reminders.
Live Features:
- β
Manual
/startcommand for testing anytime - β Interactive 4-slot subject selection via buttons
- β Auto-generated personalized timetables
- β Daily 7 AM automatic reminders (when configured)
- Open Telegram and search for "BotFather"
- Type
/newbot - Copy your API Token
# Create .env.local
TELEGRAM_BOT_TOKEN=your_token_here
CRON_SECRET=any-secret-key
# Install and run
npm install
npm run dev- Search for your bot on Telegram
- Click Start or type
start - Select subjects for each time slot
- See your timetable appear!
- QUICK_START.md - 5-minute setup guide
- TELEGRAM_BOT_SETUP.md - Complete guide with all details
- CRON_SETUP.md - Setting up daily 7 AM reminders
Telegram User
β
Telegram Bot API
β
Your Bot (Next.js)
βββ /api/telegram β Receives messages & button clicks
βββ /api/cron/schedule β Sends daily 7 AM reminders
βββ lib/telegram-bot.ts β API wrapper
βββ lib/schedule.ts β Data management
βββ lib/handlers.ts β Message logic
- Slot 1: 8:30 AM - 11:00 AM
- Slot 2: 12:10 PM - 2:00 PM
- Slot 3: 2:40 PM - 5:40 PM
- Slot 4: 7:30 PM - 10:00 PM
- Aerodynamics
- Space Dynamics
- Propulsion
- Structures
- Flight Mechanics
- Mathematics
- Aptitude
- Gas Dynamics
- Fluid Mechanics
Required:
TELEGRAM_BOT_TOKEN=your_bot_token_from_botfather
CRON_SECRET=your-secret-key-for-cron-endpoint
See .env.example for reference.
lib/
βββ telegram-bot.ts # Telegram API client
βββ schedule.ts # Schedule data & logic
βββ handlers.ts # Message & button handlers
app/
βββ page.tsx # Setup dashboard
βββ api/
βββ telegram/route.ts # Webhook endpoint
βββ cron/schedule.ts # Daily 7 AM trigger
QUICK_START.md # 5-minute setup
TELEGRAM_BOT_SETUP.md # Full guide
CRON_SETUP.md # Cron configuration
.env.example # Environment template
/start β Select Slot 1 β Select Slot 2 β Select Slot 3 β Select Slot 4 β β
Timetable
7:00 AM (Cron) β "Good morning!" β Slot selection prompt β Same flow as above
- Push to GitHub
- Import to Vercel
- Add environment variables
- Bot is live!
Any platform supporting Node.js (Heroku, Railway, AWS Lambda, etc.)
Choose one of these free services:
- Sign up at cron-job.org
- Create cronjob pointing to
/api/cron/schedule - Set time to 7:00 AM daily
- Add header:
x-cron-secret: your-secret-key
- Sign up at upstash.com
- Create QStash schedule
- Cron:
0 7 * * * - Add same header as above
- Never commit
.env.local(use.env.example) - Use
x-cron-secretheader to protect cron endpoint - Only webhook endpoint accepts Telegram messages
- In production, use a database instead of in-memory storage
Edit lib/schedule.ts:
const SLOTS = [
{ name: 'Slot 1', time: 'Your time here' },
// ...
];Edit lib/schedule.ts:
const SUBJECTS = ['Your', 'Subjects', 'Here'];Replace userSelections object in lib/schedule.ts with database queries.
- Check webhook is set (BotFather β
/mybots) - Ensure URL is HTTPS (not HTTP)
- Check Vercel logs for errors
- Verify cron job is enabled in your service
- Check
x-cron-secretheader matches - Test with "Force Execution"
- User needs to type
/startto reset and try again
Free to use and modify.
Questions? Check the detailed guides or Telegram Bot API documentation.