Spring Boot 3 compatibility issues with Telegram bot library

I’m trying to integrate a Telegram bot into my Spring Boot 3.3.4 application but running into compatibility problems. I attempted to use the org.telegram.telegrambots-spring-boot-starter dependency version 6.9.7.1, however it seems like there are no versions that properly support Spring Boot 3.

Has anyone successfully set up a Telegram bot with Spring Boot 3? What’s the recommended approach to get this working? Are there alternative libraries or workarounds that I should consider?

I really need to get some version of the Telegram bot framework running in my Spring Boot 3 project. Any guidance would be much appreciated!

I encountered similar challenges when upgrading to Spring Boot 3. Many Telegram bot libraries haven’t caught up with the latest Spring Boot updates. What proved effective for me was to bypass the Spring Boot starter entirely and rely on the core telegrambots library. Specifically, I added the dependency org.telegram:telegrambots version 6.8.0 and configured the bot manually as a Spring component using @Component and @PostConstruct annotations. This approach provided better control over the initialization process, allowing me to avoid compatibility issues. While it does require handling webhook setup individually, it became manageable once the initial configuration was complete. My implementation has been stable in production for several months.

Yeah, telegrambots-spring-boot-starter doesn’t play nice with Spring Boot 3.x. I temporarily downgraded to Spring Boot 2.7.x until they fix it - worked perfectly. If you’re stuck on Spring Boot 3, just use the rubenlagus/TelegramBots library directly. You’ll have to write your own config class and manually register the bot session, but it works. Or if you’re already using Apache Camel, try camel-telegram - it handles newer Spring versions way better. You lose some convenience features but everything else works fine.

Had the same headache last month! Ended up ditching the starter and using telegrambots-meta 6.9.7 with manual setup instead. Just create a @Configuration class and register TelegramBotsApi manually in a @Bean method. Takes a bit more work but runs perfectly with Spring Boot 3.3.x without any issues.