DEV Community

Cover image for πŸ‘‰ Deploy Your Telegram Bot in Minutes with Spring Boot + Docker (Free Template Inside)
Alexander Garanin
Alexander Garanin

Posted on

πŸ‘‰ Deploy Your Telegram Bot in Minutes with Spring Boot + Docker (Free Template Inside)

Build a fully functional Telegram bot with Webhook support using Java and Spring Boot β€” in just minutes. No complex setup, no boilerplate from scratch.


πŸš€ Why You’ll Love This Template

If you're a:

  • πŸ”Ή Java beginner exploring backend dev
  • πŸ”Ή Startup dev trying to ship an MVP quickly
  • πŸ”Ή Engineer needing a scalable foundation for bots

…this project helps you go from zero to bot in one evening.

πŸ” Who Is This Guide For?

  • Beginner Java developers – who want to create a bot quickly without complex configuration.
  • Experienced programmers – who need a scalable bot that can integrate with enterprise systems.
  • Startup teams – when a fast MVP launch is critical.
  • Teachers and students - Spring Boot is a great fit for learning backend development.

πŸ’‘ What’s Included

βœ… Spring Boot 3 + Java 21

βœ… /start and /calc command handling

βœ… Webhook endpoint via REST

βœ… Clean architecture (Controller / Service / Client)

βœ… Dockerfile + docker-compose.yml

βœ… GitHub Actions CI

βœ… Clear folder structure and YAML config


πŸ’¬ Sample Commands

/start
/calc 2 * 3
/calc 12 / 4
Enter fullscreen mode Exit fullscreen mode

🟒 Quick Start in 2 Minutes

1. Clone the repository

git clone https://github.com/garaninsoft/telegram-bot-spring-boot-quickstart.git
cd telegram-bot-spring-boot-quickstart
Enter fullscreen mode Exit fullscreen mode

2. Add your bot token

Open src/main/resources/application.yml and paste your Telegram Bot Token::

telegram:
  bot:
    token: your_token_here
Enter fullscreen mode Exit fullscreen mode

3. Run the app via Docker 🐳 (recommended)

docker compose build
docker compose up
Enter fullscreen mode Exit fullscreen mode

4. Set up Telegram Webhook

Use ngrok for local testing:

ngrok http 8080
Enter fullscreen mode Exit fullscreen mode

Set the Webhook:

curl -X POST \
  https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook \
  -d url=https://<your-ngrok-url>/webhook
Enter fullscreen mode Exit fullscreen mode

βœ… Done! Open Telegram, talk to your bot, and try /start.

πŸ“¦ Get the Code

πŸ”— GitHub (Free)
πŸ’°Gumroad (Pro version with CI, Docker & frontend)

πŸ§‘β€πŸ’» Support Option

Need help deploying to VPS, Railway, Render, or Fly.io?
Grab the Support pack to get:

  • 1-on-1 help with setup
  • CI/CD pipeline setup via GitHub Actions
  • Docker mentoring
  • Telegram API questions answered

πŸ”— Let’s Connect

Telegram: @garanin_soft

Top comments (0)