This project is a minimal yet professionally structured Spring Boot template for Telegram bots.
- Quickly starting with the Telegram API
- Beginners learning Spring Boot and REST API
- Creating MVP bots with basic command-handling logic
- ✉️ Handles Telegram Webhook requests
- ⚙️ Supports
/startand/calccommands - ⌛ Simple calculator:
/calc 2 * 3 - 🌐 REST API with clean architecture (Controller / Service / Client)
- 🧪 Ready to run locally in minutes
The Gumroad edition includes additional tools and upgrades:
- Full source code
- Setup documentation
- Everything from Basic, plus:
- 🐳 Dockerfile and
docker-compose.yml - ✅ GitHub Actions (CI)
- 🐳 Dockerfile and
- Everything from Pro, plus:
- 🛠️ Personal help with deployment (Docker, VPS, etc.)
- 🔧 Project extension advice
- 💬 Telegram/Web support (1–2 day response)
If you're using the Pro version, you can launch your bot via Docker. But why bother with Docker if ./gradlew bootRun works?
Docker guarantees that your bot will run exactly the same on any computer, regardless of your Java version, OS, or installed tools.
No more "works on my machine" bugs.
./gradlew bootRundepends on your local environment and can fail due to JDK or Gradle issues.
With Docker, your project is already prepared for production deployment.
You can host the bot on a cloud server (VPS, Railway, Fly.io, etc.) without touching the code.
Java, Gradle, ngrok and other tools are preconfigured inside Docker.
You don’t need to install anything manually — it's all in the container.
Your app runs in a sandboxed environment, with no conflicts between projects or local installations.
With the included GitHub Actions configuration, the bot can be automatically built and tested on every push.
🔥 The Pro version includes:
- Dockerfile & docker-compose
- GitHub Actions setup
- Vue frontend for sending commands
All together — this gives you a professional-grade development and deployment experience.
git clone https://github.com/garaninsoft/telegram-bot-spring-boot-quickstart.git
cd telegram-bot-spring-boot-quickstartOpen src/main/resources/application.yml and paste your Telegram Bot Token::
telegram:
bot:
token: your_token_here./gradlew bootRunJDK 21+.
We recommend switching tojava 21.
Check your version:
java -versionf it's JDK 21+, switch with:
sdk install java 21.0.3-tem
sdk use java 21.0.3-tem
java -versiondocker compose build
docker compose upUse ngrok for local testing:
ngrok http 8080Set the Webhook:
curl -X POST \
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook \
-d url=https://<your-ngrok-url>/webhooksrc/main/java/org/example/telegrambot/
├── TelegramBotApplication.java
├── controller/TelegramWebhookController.java
├── service/TelegramService.java
├── client/TelegramClient.java
├── dto/
│ ├── Update.java
│ ├── Message.java
│ ├── Chat.java
│ ├── From.java
│ └── SendMessageRequest.java
/start— Greeting and instructions/calc— Simple calculations. Examples:
/calc 10 / 2
/calc 5 * 6
- ✅ Add buttons and inline support
- 🧾 Save message history
- 🐳 Build and deploy Docker image
- 🎧 Handle voice, photo, other updates
MIT — free to use, modify, and sell as part of your own products.
Crafted with love and time efficiency — for those who want to:
- understand Telegram API from scratch
- earn money with development
- launch products quickly
Telegram: @garanin_soft
📦 Need a ready-to-use Telegram Bot on Spring Boot? 📦 Ready-to-use Telegram Bot template for Java devs — Get it on Gumroad:
👉 https://garaninsoft.gumroad.com/l/telegram-bot-quickstart