JTeleBot
A Java library for Telegram Bot API
Maven Dependency for Consumers
Add to your pom.xml
<dependency>
<groupId>me.shib.java.lib</groupId>
<artifactId>jtelebot</artifactId>
<version>2.1.2</version>
</dependency>
Example
Start by creating an instance of the me.shib.java.lib.jtelebot.TelegramBot
with the API token you get from @BotFather
TelegramBot bot = TelegramBot.getInstance("YourBotApiTokenGoesHere");
Update[] updates;
while((updates = bot.getUpdates()) != null) {
for (Update update : updates) {
Message message = update.getMessage();
if(message != null) {
bot.sendMessage(new ChatId(message.getChat().getId()), "This is a reply from the bot! :)");
}
}
}