A Node.js automation that submits a weekly giveaway entry, verifies the registration via Gmail, monitors the results, and instantly sends a Telegram notification when the giveaway is won.
The giveaway resets every week, and I kept forgetting to register. Rather than relying on reminders, I automated the entire workflow from submission to winner notification.
The initial implementation received 200 OK but returned HTML instead of JSON. By comparing browser requests using Chrome DevTools (HAR export), I found the website relied on TLS fingerprinting for bot detection. Switching to got-scraping reproduced a real browser fingerprint and solved the problem.
-
Submit Entry
- Submit the giveaway registration.
- Validate the response.
- Store the submission timestamp.
-
Verify Registration
- Search Gmail (IMAP) for the confirmation email.
- Verify the registration.
- Update the local state.
-
Check Giveaway Results
- Search only emails for the current giveaway period.
- Detect whether the giveaway was won or lost.
- Send a Telegram notification only when won.
- Mark the result as processed.
-
Weekly State Management
- Track the current giveaway lifecycle.
- Automatically reset state every ISO week.
- Prevent duplicate submissions, verification, and notifications.
- Node.js
- got-scraping
- ImapFlow
- mailparser
- Telegram Bot API
- Browser DevTools (HAR export)
- cron
{
"week": "2026-W32",
"submitted": true,
"submittedAt": "2026-08-03T07:15:04.102Z",
"verified": true,
"verifiedAt": "2026-08-03T07:18:31.514Z",
"resultProcessed": true,
"resultProcessedAt": "2026-08-03T17:26:48.201Z",
"result": "won"
}- ✅ Automatic weekly giveaway entry
- ✅ Gmail verification via IMAP
- ✅ Automatic giveaway result detection
- ✅ Telegram winner notifications
- ✅ Automatic weekly state reset
- ✅ Idempotent cron-friendly execution
- ✅ Local logging and error reporting
- ✅ Fully unattended operation