esdnevnik-tracker is a Windows-first Node.js script that logs in to esDnevnik with Playwright, collects graded tasks, upcoming tasks, and recent dashboard grades, writes a local Markdown report, and sends a Telegram summary.
The project was built and tested in a Windows workflow and runs with plain Node.js, Playwright, and node-fetch@2; OpenClaw was part of the build and debugging workflow, not a runtime dependency.
- Login automation for
https://moj.esdnevnik.rs. - Graded task scraping with grade and grading date extraction.
- Upcoming task scraping with date, type, subject, and note extraction.
- Recent grade scraping from dashboard timeline items.
- Markdown report generation for local storage.
- Telegram delivery with automatic split when the message becomes too long for a single Telegram message.
- Weekday-only sending plus a once-per-day guard using
last_sent.txt.
- Node.js
- Playwright
node-fetch@2- Telegram Bot API
node-fetch@2 is used because the script relies on the CommonJS require('node-fetch') pattern, which matches v2 and can conflict with newer ESM-only versions.
Typical repository contents:
extractGrades.js— main scriptpackage.json— project metadata and dependenciespackage-lock.json— dependency lockfileREADME.md— project documentationLICENSE— project licenseScreenshot_Telegram.jpg— example Telegram output
Install dependencies:
npm install playwright node-fetch@2
npx playwright install chromiumThe script uses Windows user-level configuration stored in the registry-backed user environment.
The current public-safe script expects these runtime values:
ESDNEVNIK_USERESDNEVNIK_PASSTELEGRAM_BOT_TOKENTELEGRAM_CHAT_ID
Store the values in HKCU\Environment with reg.exe:
reg add HKCU\Environment /v ESDNEVNIK_USER /t REG_SZ /d "your_esdnevnik_username" /f
reg add HKCU\Environment /v ESDNEVNIK_PASS /t REG_SZ /d "your_esdnevnik_password" /f
reg add HKCU\Environment /v TELEGRAM_BOT_TOKEN /t REG_SZ /d "your_telegram_bot_token" /f
reg add HKCU\Environment /v TELEGRAM_CHAT_ID /t REG_SZ /d "your_telegram_chat_id" /fOpen a new PowerShell window after writing the values so new processes can read them.
[Environment]::GetEnvironmentVariable("ESDNEVNIK_USER", "User")
[Environment]::GetEnvironmentVariable("ESDNEVNIK_PASS", "User")
[Environment]::GetEnvironmentVariable("TELEGRAM_BOT_TOKEN", "User")
[Environment]::GetEnvironmentVariable("TELEGRAM_CHAT_ID", "User")This project sends notifications through the Telegram Bot API.
Open Telegram, search for @BotFather, start a chat, and run:
/newbot
Follow the prompts to choose:
- a bot name
- a bot username ending with
bot
BotFather will return a bot token. Save that value and use it as TELEGRAM_BOT_TOKEN.
Open the newly created bot in Telegram and send it at least one message, for example:
/start
This step is important because the bot needs a chat history before getUpdates can return the chat ID.
Open this URL in a browser and replace YOUR_BOT_TOKEN with the real token:
https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates
In the JSON response, find:
"chat": {
"id": 123456789
}That number is the value for TELEGRAM_CHAT_ID.
Save both values with the registry commands shown in the Configuration section:
TELEGRAM_BOT_TOKENTELEGRAM_CHAT_ID
Browser test:
PowerShell test:
Invoke-RestMethod -Uri "https://api.telegram.org/botYOUR_BOT_TOKEN/sendMessage" `
-Method POST `
-ContentType "application/json" `
-Body '{"chat_id":"YOUR_CHAT_ID","text":"Telegram bot test"}'node extractGrades.jsExpected behavior:
- launches Chromium through Playwright,
- logs in to esDnevnik,
- scrapes graded tasks, upcoming tasks, and recent grades,
- writes a Markdown report to the configured local output path,
- sends a Telegram report on school days,
- updates
last_sent.txtto prevent duplicate sends on the same day.
The script can send a daily summary including average grade, upcoming tasks, and recent grades. If the message becomes too long, it is automatically split into multiple Telegram messages.
This project is designed to keep credentials and messaging secrets outside the codebase by using environment variables for authentication and bot configuration.
Do not commit real esDnevnik usernames, passwords, Telegram bot tokens, chat IDs, generated personal reports, or local runtime files to the repository.
Before publishing changes, review staged files carefully and confirm that no personal data, screenshots with sensitive information, or locally generated output has been included unintentionally.
If you use this project with a public repository, treat all student data, school account data, and Telegram bot credentials as sensitive information and store them only in secure local environment settings.
The Windows Task Scheduler flow used in the project history registers the script to run at logon with a 5-minute delay, then relies on the once-per-day guard in last_sent.txt plus the school-day check inside the script to avoid duplicate or weekend sends.
$action = New-ScheduledTaskAction -Execute node -Argument "C:\projects\extractGrades.js" -WorkingDirectory "C:\projects"
$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
$trigger.Delay = 'PT5M'
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit (New-TimeSpan -Minutes 5) -StartWhenAvailable
Register-ScheduledTask -TaskName "esDnevnikOnStartup" -Action $action -Trigger $trigger -Settings $settings -ForceGet-ScheduledTask -TaskName "esDnevnikOnStartup" | Select-Object TaskName, StateStart-ScheduledTask -TaskName "esDnevnikOnStartup"
Get-ScheduledTaskInfo -TaskName "esDnevnikOnStartup" | Select-Object LastRunTime, LastTaskResult, NextRunTimeA LastTaskResult value of 0 indicates a successful run.
The current setup writes a Markdown report to a local workspace.
Typical report content includes:
- fetched timestamp,
- upcoming tasks,
- graded tasks,
- recent dashboard grades.