Skip to content
TamTam Java SDK
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

TamTam Bot SDK 𝛂

build status

TamTam Bot SDK is a simple library built on top of tamtam-bot-api that helps you to develop bots for TamTam quickly.


Add the following dependency to your project:




implementation group: 'chat.tamtam', name: 'tamtam-bot-sdk', version: '0.0.1'

Then you should choose the way how your bot will receive notifications: long-polling or webhook.


Long-polling is the easiest way to receive updates for your bot because it does not require running web server.

To start your bot just extend LongPollingBot class and add methods annotated by @UpdateHandler annotation.

These methods should have only one parameter of type Update. Every method will handle update of such type.

For example, simple bot that just replies on incoming message:

public class ReplyBot extends LongPollingBot {
    public ReplyBot(String accessToken) {

    public Object onMessageCreated(MessageCreatedUpdate update) {
        Message message = update.getMessage();
        return NewMessageBodyBuilder.ofText("Reply on: " + message.getBody()).build(); // return null if you do not want to reply synchronously

All other updates will be ignored. If you want to handle every update just override onUpdate method of TamTamBotBase.

Alternatively, you can directly create instance of LongPollingBot and pass handlers to constructor:

// handler can be any object that has methods annotated with `@UpdateHandler`
LongPollingBot bot = new LongPollingBot("%ACCESS_TOKEN%", handler1, handler2);

As soon as you created instance of bot you must start it:

ReplyBot bot = new ReplyBot("%ACCESS_TOKEN%");

This method starts separated non-daemon thread that polls Bot API in cycle. Call stop as soon as you ready to shutdown it:


Check out EchoBot for more complete example.


Webhook subscribed bot requires running HTTP server. By default we use Jetty but you can use any server you want.

All webhook bots should be put in container that manages server and handle all incoming HTTP-requests to bots:

WebhookEchoBot bot1 = new WebhookEchoBot("%ACCESS_TOKEN%");
WebhookBot bot2 = new WebhookBot("%ANOTHER_ACCESS_TOKEN%");

JettyWebhookBotContainer botContainer = new JettyWebhookBotContainer("", 8080);

// Register JVM shutdown hook to stop our server
Runtime.getRuntime().addShutdownHook(new Thread(botContainer::stop));

// `start` will run underlying Jetty server and register webhook subscription for each bot

Check out jetty-webhook-echobot for more complete example or tomcat-webhook-echobot as an example of alternative container implementation.


Minimum required version of Java is 8.


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.


This project is licensed under the Apache 2.0.

You can’t perform that action at this time.