An automated Node.js pipeline that monitors Gmail for hackathon and competition emails, classifies them using an LLM via Groq, and sends real-time Telegram notifications.
Although it uses a Large Language Model for classification, this project is not an autonomous AI agent. It follows a deterministic ETL (Extract → Transform → Load) workflow where the LLM serves as an intelligent filter instead of relying on brittle keyword matching or regex patterns.
Gmail API → Groq LLM Classifier → Telegram Bot
↑ ↓
└────────── node-cron ────────────┘
↕
MongoDB Atlas
(Deduplication Layer)
- Extract – Retrieve unread emails from Gmail.
- Deduplicate – Check MongoDB to ensure the email has not already been processed.
- Classify – Send the email content to Groq's LLaMA model to determine whether it is a hackathon or competition invitation.
- Notify – Forward relevant opportunities to Telegram.
- Persist – Store the email ID in MongoDB to prevent duplicate alerts.
- Gmail inbox monitoring
- LLM-powered email classification
- Telegram push notifications
- MongoDB-based deduplication
- Automated scheduling with cron jobs
- Modular architecture for easy maintenance and testing
| Layer | Technology | Purpose |
|---|---|---|
| Runtime | Node.js (ES Modules) | Core application runtime |
| Email Source | Gmail API | Fetch unread emails |
| Classification | Groq API (LLaMA 3.x) | Detect hackathon-related emails |
| Notifications | Telegram Bot API | Send alerts |
| Database | MongoDB Atlas | Store processed email IDs |
| Scheduler | node-cron | Run periodic jobs |
hackathon-agent/
├── auth/
│ ├── authenticate.js
│ ├── credentials.json
│ └── token.json
│
├── models/
│ └── ProcessedEmail.js
│
├── src/
│ ├── emailFetcher.js
│ ├── classifier.js
│ ├── notifier.js
│ ├── storage.js
│ └── agent.js
│
├── test/
│ ├── testClassifier.js
│ ├── testNotifier.js
│ └── testStorage.js
│
├── cron.js
├── .env
└── package.json
Before running the project, ensure you have:
- Node.js v18 or later
- MongoDB Atlas account
- Groq API key
- Google Cloud project with Gmail API enabled
- Telegram bot token
git clone https://github.com/yourusername/hackathon-agent.git
cd hackathon-agent
npm install- Open Google Cloud Console.
- Create a new project.
- Enable the Gmail API.
- Navigate to OAuth Consent Screen.
- Select External application type.
- Add your email as a test user.
- Go to Credentials.
- Create an OAuth Client ID.
- Choose Desktop Application.
- Download the generated JSON file.
- Rename it to:
credentials.json
- Place it inside the
auth/directory.
Run:
node auth/authenticate.jsThis generates the OAuth access and refresh tokens required for Gmail access.
- Open Telegram.
- Message
@BotFather. - Run:
/newbot
- Copy the generated bot token.
Message:
@userinfobot
Copy your numeric Chat ID.
Send:
/ start
to your newly created bot before running the project.
Create a .env file in the project root:
# Gmail
GMAIL_CLIENT_ID=
GMAIL_CLIENT_SECRET=
GMAIL_REDIRECT_URI=
GMAIL_REFRESH_TOKEN=
# Telegram
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
# MongoDB
MONGODB_URI=
# Groq
GROQ_API_KEY=Process current unread emails once:
node src/agent.jsRun continuously using cron:
node cron.jsDefault schedule:
9:00 AM daily
6:00 PM daily
Example schedule for every 2 hours:
"0 */2 * * *"node test/testClassifier.jsnode test/testNotifier.jsnode test/testStorage.jsTraditional keyword-based filters often fail when:
- Wording changes
- Opportunities use unconventional language
- Relevant emails don't contain expected keywords
Using an LLM allows semantic understanding of email content, resulting in significantly better classification accuracy with minimal maintenance.
- Email summarization
- Opportunity scoring and ranking
- Discord notifications
- Web dashboard
- Multi-user support
- Vector search for historical opportunities
MIT License
Feel free to fork, modify, and extend the project for your own automation workflows.