Skip to main content

Prerequisites

Before you begin, make sure you have the following:
  • Node.js >= 20 — the bot uses native structuredClone and other modern APIs.
  • A Telegram bot token — create a bot via @BotFather and copy the token.
  • An OpenAI API key — required for GPT-4o-mini curation. Get one at platform.openai.com.

Setup

1

Clone the repository

git clone https://github.com/sebasgc0399/steam-deals-ai.git
cd steam-deals-ai
2

Install dependencies

npm install
3

Create your .env file

Copy the provided template:
cp .env.example .env
4

Edit .env with your credentials

Open .env and set the two required variables at minimum:
BOT_TOKEN=123456789:AbCdefGhIJKlmNoPQRsTUVwxyZ
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxx
All other variables have sensible defaults and are optional. See the full list below.
5

Build TypeScript

npm run build
This compiles the source to the dist/ directory.
6

Start the bot

npm start
You should see: 🚀 Steam Deals Bot iniciado correctamente

Environment variables

VariableRequiredDefaultDescription
BOT_TOKENYesTelegram bot token from @BotFather
OPENAI_API_KEYYesOpenAI API key
OPENAI_MODELNogpt-4o-miniOpenAI model used for curation
MIN_DISCOUNT_PERCENTNo50Minimum discount required (%)
MIN_METACRITIC_SCORENo70Minimum Metacritic score (0 to disable)
MIN_STEAM_RATING_PERCENTNo70Minimum Steam user rating (%)
MAX_PRICE_USDNo60Maximum sale price in USD
DEALS_PAGE_SIZENo60Number of deals to fetch from CheapShark (max 60)
DEDUP_DAYSNo7Days before a game can appear again
CRON_SCHEDULENo0 9 * * *Cron expression for daily broadcast (9 AM Colombia time)

The data/ directory

The bot creates a data/ directory at runtime to persist state between restarts. It contains three files:
FilePurpose
chat_ids.jsonSubscriber chat_id list used for daily broadcasts
notified_games.jsonDeduplication records — prevents repeating the same game within DEDUP_DAYS days
snapshot.jsonToday’s curated deals — served instantly by /deals if already generated
Do not add data/ to .gitignore if you want subscribers and deduplication history to survive redeployments. Losing data/chat_ids.json means all users must re-run /start to resubscribe.
For production use, run the bot under a process manager such as PM2 to automatically restart on crash and survive server reboots:
npm install -g pm2
pm2 start dist/bot/index.js --name steam-deals-bot
pm2 save
pm2 startup

Build docs developers (and LLMs) love