Java Telegram Bot API

This is a Telegram Bot API for Java. At the time of writing it supports all the features of the HTTP API and follows the same specification. This is a work in progress and currently has very minimal error handling and testing. Any methods or functionality outside of pro.zackpollard.telegrambot.api.internal package should remain as they are currently and should work as expected, anything inside the internal package is not guaranteed to work as expected and may yield unexpected results if used in a way that is not intended.




Telegram Channel for this API available at
Please join this channel for information about updates to this bot.
You can also contact me at
If you need help in Persian(فارسی) you can contact

Source Code

Source is stored on GitLab and mirrored to Github
Repo on GitHub
Repo on GitLab

Example Usage

You can find fully working examples of bots in the following repository

The following is a simple overview of how the API works as a kind of quick start guide:

//Main Class
public class MyBot {

    public MyBot() {

        TelegramBot telegramBot = TelegramBot.login("APIKey");

        //The API key was invalid, an error will have also been printed into the console.
        if(telegramBot == null) System.exit(-1);

        telegramBot.getEventsManager().register(new MyListener());

        //This will tell the API to start polling the servers for updates
        //If you specify true as the argument you will receive any previous messages before the bot started.
        //If you specify false the API will discard any messages from before the bot was started.

        //Thread would die, do something to keep it alive.

//Listener class
public class MyListener implements Listener {

    public void onTextMessageReceived(TextMessageReceivedEvent event) {

        event.getChat().sendMessage(SendableTextMessage.builder().message("You sent me a text based message!").replyTo(event.getMessage()).build(), telegramBot);


The API is available on Github Package Registry.


Maven is used for dependency management and deployment.


The following is required temporarily as github package registry can't be used without authentication, please follow the instructions on the following issue:


This project is licensed under the GPLv3 licence.