Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weekly Giveaway Bot

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 Problem

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 Challenge

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.

Workflow

  1. Submit Entry

    • Submit the giveaway registration.
    • Validate the response.
    • Store the submission timestamp.
  2. Verify Registration

    • Search Gmail (IMAP) for the confirmation email.
    • Verify the registration.
    • Update the local state.
  3. 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.
  4. Weekly State Management

    • Track the current giveaway lifecycle.
    • Automatically reset state every ISO week.
    • Prevent duplicate submissions, verification, and notifications.

Tech Stack

  • Node.js
  • got-scraping
  • ImapFlow
  • mailparser
  • Telegram Bot API
  • Browser DevTools (HAR export)
  • cron

State File

{
  "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"
}

Features

  • ✅ 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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages