SDK

Java SDK

Maven io.starim:bot-sdk (0.1.13+). StarIMBot + StarIMBotClient aligned with the Bot Token gateway.

Dependency

<dependency>
  <groupId>io.starim</groupId>
  <artifactId>bot-sdk</artifactId>
  <version>0.1.13</version>
</dependency>

JDK 17+. Package io.starim.botsdk.*. Local install: mvn -f botsdk/java clean install if Central lags.

Quick webhook echo

StarIMBot bot = StarIMBot.builder()
    .token(System.getenv("STARIM_BOT_TOKEN"))
    .baseUrl(System.getenv("STARIM_API_BASE"))
    .secretToken(System.getenv("STARIM_WEBHOOK_SECRET"))
    .build();

bot.on(UpdateType.MESSAGE, ctx -> {
  String text = ctx.getMessage().getText();
  if (text != null) ctx.reply(text, true);
});
bot.start(8787, "/webhook");

Layers

  • StarIMBot — webhook server + polling + routing
  • StarIMBotClient — direct HTTP API
client.sendMessage(new SendMessageParams("<chatId>", "hello"));
client.sendPhotoFromFile("<chatId>", Path.of("photo.jpg"), "cap");

Examples (same as repo — runnable)

Sources: botsdk/java/examples/ — EchoBot, SlashCommand, SendPhoto.

export STARIM_API_BASE="https://<api-host>/api/v1"
export STARIM_BOT_TOKEN="sbot_..."
export STARIM_WEBHOOK_SECRET="..."
bot.on(UpdateType.MESSAGE, ctx -> {
  String text = ctx.getMessage().getText();
  if (text != null) ctx.reply(text);
});
bot.start(8787, "/webhook");
bot.command("start", ctx -> ctx.reply("Welcome"));
client.sendPhotoFromFile(chatId, Path.of("photo.png"), "caption");
bot.startPolling(30);

Method map

AreaSDKDocs
Send / filessend*, sendPhotoFromFileSend
DeliverysetWebhook, startPollingWebhook
ChatsgetMyChats, pin/forward/copyChat read
OrchestrationsimulateSendMessageGuide

Full contract: API index.

MediaUploadCache is deprecated/no-op.