A Docker-containerized bot that monitors TCDD (Turkish State Railways) train ticket availability and sends Telegram notifications when economy seats become available.
- Monitors multiple dates via environment variable
- Telegram notifications for available seats
- Automatic retry with exponential backoff
- Sustained failure alerts and recovery notifications
- Structured logging with configurable log level
- Docker
- Docker Compose (optional)
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envwith your credentials:- Telegram bot token and chat ID
- TCDD API authorization tokens
- Routes to monitor (e.g., ISTANBUL-KONYA,ANKARA-ISTANBUL)
- Dates to monitor
-
Build and run:
docker-compose up -d
| Variable | Required | Default | Description |
|---|---|---|---|
ROUTES |
Yes | - | Comma-separated routes (e.g., ISTANBUL-KONYA,ANKARA-ISTANBUL) |
CHECK_DATES |
Yes | - | Comma-separated dates in DD-MM-YYYY format |
SEAT_CLASSES |
No | EKONOMI | Comma-separated seat classes or keywords (ANY, ALL) |
CHECK_INTERVAL |
No | 300 | Seconds between availability checks |
LOG_LEVEL |
No | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |
TELEGRAM_BOT_TOKEN |
Yes | - | Telegram bot token |
TELEGRAM_CHAT_ID |
Yes | - | Telegram chat ID for notifications |
USER_AUTHORIZATION |
Yes | - | TCDD API user authorization token |
AUTHORIZATION |
Yes | - | TCDD API authorization token |
| Route | From | To |
|---|---|---|
| ISTANBUL-KONYA | İstanbul (Pendik) | Konya (Selçuklu YHT) |
| ISTANBUL-ANKARA | Istanbul (Pendik) | Ankara (Gar) |
| ANKARA-ISTANBUL | Ankara (Gar) | Istanbul (Pendik) |
| ANKARA-KONYA | Ankara (Gar) | Konya (Selçuklu YHT) |
| KONYA-ISTANBUL | Konya (Selçuklu YHT) | Istanbul (Pendik) |
| KONYA-ANKARA | Konya (Selçuklu YHT) | Ankara (Gar) |
| Class | Code | Description |
|---|---|---|
| Economy | EKONOMI | Standard economy class |
| Business | BUSINESS | Business class |
| Sleeper | YATAKLI | Sleeper/Bed (not on all routes) |
| Loca | LOCA | Private compartment |
| Disabled | DISABLED | Wheelchair accessible |
Keywords:
ANY- Monitor all classes except DISABLEDALL- Monitor all classes including DISABLED
Note: This bot monitors high-speed train (YHT) routes.
# Build and start
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down# Build
docker build -t tcdd-bot .
# Run
docker run -d \
--name tcdd-bot \
-e ROUTES="ISTANBUL-KONYA,ANKARA-ISTANBUL" \
-e CHECK_DATES="21-03-2026,22-03-2026" \
-e TELEGRAM_BOT_TOKEN="your_token" \
-e TELEGRAM_CHAT_ID="your_chat_id" \
-e USER_AUTHORIZATION="your_auth" \
-e AUTHORIZATION="your_auth" \
tcdd-bot
# View logs
docker logs -f tcdd-bot
# Stop
docker stop tcdd-bot- Check that
CHECK_DATESis set and contains valid dates - Ensure dates are not in the past
- Verify Telegram credentials are correct
- Verify
TELEGRAM_BOT_TOKENandTELEGRAM_CHAT_IDare correct - Check logs for Telegram API errors
- Check network connectivity
- Verify TCDD API tokens are not expired
- Check logs for specific error messages