flowchart LR
A[WorkRhythm Scheduler] -->|Cron trigger| B[TelegramBot]
B -->|Send message| C[Registered Chat IDs]
A -->|GET random quote| D[ZenQuotes API]
A -->|POST translate| E[LibreTranslate API]
F[Telegram User] -->|Send any message| B
B -->|Persist chat id| G[chat-ids.txt]
Add your screenshot file at
images/telegram-preview.png.
- ✅ Spring Boot-based Telegram bot that sends scheduled (cron) messages
- ✅ Motivation messages + random quotes + English -> Turkish translation
- ✅ Fast setup with Docker Compose (app + LibreTranslate)
Used Technologies in The Project:
Work Rhythm is a Telegram bot that sends automated reminders to support daily and weekly work routines.
What it does:
- Sends scheduled workday messages (start, breaks, wrap-up, end of day)
- Adds a random motivational quote to the morning message
- Translates quote text into Turkish via LibreTranslate
- Automatically stores user
chatIdvalues and broadcasts to all registered chats
Flow:
1) User sends any message to the bot
2) Bot stores the chatId in chat-ids.txt
3) Scheduler triggers at configured cron times
4) Bot sends messages to all registered chatIds
5) Morning trigger enriches message using ZenQuotes + LibreTranslate
Times are based on server timezone. In Docker Compose,
TZ=Europe/Istanbulis set.
| Task | Cron | Description |
|---|---|---|
| Good Morning | 0 0 9 * * MON-FRI |
Good morning message + translated quote |
| Morning Break Start | 0 30 10 * * MON-FRI |
Short break reminder |
| Morning Break End | 0 40 10 * * MON-FRI |
Break end reminder |
| Lunch Break Start | 0 30 12 * * MON-FRI |
Lunch break start |
| Lunch Break End | 0 30 13 * * MON-FRI |
Lunch break end |
| Afternoon Break Start | 0 0 15 * * MON-FRI |
Afternoon break reminder |
| Afternoon Break End | 0 10 15 * * MON-FRI |
Afternoon break end |
| Wrap Up | 0 30 16 * * MON-FRI |
Daily wrap-up reminder |
| End Of Day | 0 0 17 * * MON-FRI |
End of workday message |
| Sunday Greeting | 0 0 21 * * SUN |
Sunday evening reminder |
| Sunday Greeting 2 | 0 10 23 * * SUN |
Additional Sunday reminder |
src/main/java/com/workrhythm/
├── WorkRhythmApplication.java
├── bot/
│ ├── BotInitializer.java # Registers Telegram bot session
│ └── TelegramBot.java # Receives/sends messages + chatId persistence
├── config/
│ ├── AppConfig.java # app.* properties
│ ├── TelegramConfig.java # bot.* properties
│ └── RestClientConfig.java # RestClient.Builder bean
├── dto/
│ ├── TranslateRequestDTO.java
│ ├── TranslateResponseDTO.java
│ └── ZenQuoteResponseDTO.java
├── scheduler/
│ └── WorkRhythmScheduler.java # Cron jobs
└── service/
├── TranslationService.java # LibreTranslate integration
└── ZenQuoteService.java # ZenQuotes integration
src/main/resources/application.yaml:
# Application Config
spring:
application:
name: work-rhythm
# Telegram Config
bot:
name: <YOUR_TELEGRAM_BOT_NAME>
token: <YOUR_TELEGRAM_BOT_TOKEN>
chat-ids-file: chat-ids.txt
app:
zen-quotes-api: https://zenquotes.io/api/random
translation-api: http://localhost:5000/translate- Each line in
chat-ids.txtmust contain one valid long value. - Invalid text or a number outside the Java
Longrange can fail application startup. - Do not commit your real bot token to the repository.
- Java 17+
- Docker Desktop (optional but recommended)
- A Telegram bot token created via BotFather
docker compose up -d --build.\gradlew.bat bootRunFor local run, translation service must be available at
http://localhost:5000/translate.
.\gradlew.bat test --no-daemonThis repo includes a basic Spring context test: WorkRhythmApplicationTests.
- Open your bot in Telegram.
- Send any message (for example:
/start). - Bot stores your
chatIdinchat-ids.txt. - You will receive scheduled messages at cron times.
- Cause:
chat-ids.txtincludes invalid text or too-large numbers. - Fix: keep only valid numeric
chatIdvalues, one per line.
- Verify bot token is correct.
- Make sure you have sent at least one message to the bot.
- Confirm
chat-ids.txtis writable. - Check logs for
Telegram bot registeredand scheduler trigger messages.
- ZenQuotes API may be temporarily unavailable.
- If LibreTranslate container is down, translated quote part may be empty.
- Provide
bot.tokenvia environment variable. - If token is exposed, rotate it immediately using Telegram BotFather.
- Keep
chat-ids.txtprotected with proper file permissions in production.
This project is licensed under the MIT License. See the LICENSE file for details
Created by Mehmet Furkan KAYA
