
Type-safe, coroutine-based Telegram Bot API client with auto-generated OpenAPI bindings, modular architecture, lifecycle-aware bot framework supporting long polling, webhooks, and lightweight HTTP client integration.
Early Development Warning This project is still in its early stages of development and may contain critical bugs. Use at your own risk.
A Kotlin Multiplatform library for the Telegram Bot API. It provides type-safe, auto-generated API bindings from the Telegram Bot API OpenAPI specification using Ktorfit.
| Component | Version |
|---|---|
| Kotlin | 2.4.0 |
| Gradle | 9.6.1 |
| Ktor | 3.5.1 |
| Ktorfit | 2.7.5 |
| Telegram Bot API | 10.1 |
// build.gradle.kts
implementation("com.hiczp:telegram-bot-api-application:$version")import com.hiczp.telegram.bot.application.TelegramBotApplication
import com.hiczp.telegram.bot.application.context.action.replyMessage
import com.hiczp.telegram.bot.application.dispatcher.handler.HandlerTelegramEventDispatcher
import com.hiczp.telegram.bot.application.dispatcher.handler.command.command
import com.hiczp.telegram.bot.application.dispatcher.handler.handling
suspend fun main() {
val routes = handling {
command("start") {
handle {
replyMessage("Welcome!")
}
}
command("ping") {
handle {
replyMessage("pong")
}
}
}
val app = TelegramBotApplication.longPolling(
botToken = "YOUR_BOT_TOKEN",
eventDispatcher = HandlerTelegramEventDispatcher(routes)
)
app.start()
app.join()
}| Module | Description |
|---|---|
:protocol |
Auto-generated Telegram Bot API definitions |
:client |
High-level HTTP client wrapper |
:application |
Bot framework with lifecycle management |
:application-updatesource-webhook |
Webhook update source |
| Platform | Targets |
|---|---|
| JVM | JVM 17 toolchain |
| Android | Android Kotlin Multiplatform library |
| JS | Browser and Node.js |
| WASM | Browser, Node.js, and d8 |
| Linux |
linuxX64, linuxArm64
|
| macOS | macosArm64 |
| Windows | mingwX64 |
| iOS |
iosArm64, iosSimulatorArm64
|
| watchOS |
watchosArm32, watchosArm64, watchosSimulatorArm64
|
| tvOS |
tvosArm64, tvosSimulatorArm64
|
| Android Native |
androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86
|
Note: Some test tasks can make real Telegram API calls. Use ./gradlew assemble for build-only verification.
Start with the module READMEs:
MIT License
Early Development Warning This project is still in its early stages of development and may contain critical bugs. Use at your own risk.
A Kotlin Multiplatform library for the Telegram Bot API. It provides type-safe, auto-generated API bindings from the Telegram Bot API OpenAPI specification using Ktorfit.
| Component | Version |
|---|---|
| Kotlin | 2.4.0 |
| Gradle | 9.6.1 |
| Ktor | 3.5.1 |
| Ktorfit | 2.7.5 |
| Telegram Bot API | 10.1 |
// build.gradle.kts
implementation("com.hiczp:telegram-bot-api-application:$version")import com.hiczp.telegram.bot.application.TelegramBotApplication
import com.hiczp.telegram.bot.application.context.action.replyMessage
import com.hiczp.telegram.bot.application.dispatcher.handler.HandlerTelegramEventDispatcher
import com.hiczp.telegram.bot.application.dispatcher.handler.command.command
import com.hiczp.telegram.bot.application.dispatcher.handler.handling
suspend fun main() {
val routes = handling {
command("start") {
handle {
replyMessage("Welcome!")
}
}
command("ping") {
handle {
replyMessage("pong")
}
}
}
val app = TelegramBotApplication.longPolling(
botToken = "YOUR_BOT_TOKEN",
eventDispatcher = HandlerTelegramEventDispatcher(routes)
)
app.start()
app.join()
}| Module | Description |
|---|---|
:protocol |
Auto-generated Telegram Bot API definitions |
:client |
High-level HTTP client wrapper |
:application |
Bot framework with lifecycle management |
:application-updatesource-webhook |
Webhook update source |
| Platform | Targets |
|---|---|
| JVM | JVM 17 toolchain |
| Android | Android Kotlin Multiplatform library |
| JS | Browser and Node.js |
| WASM | Browser, Node.js, and d8 |
| Linux |
linuxX64, linuxArm64
|
| macOS | macosArm64 |
| Windows | mingwX64 |
| iOS |
iosArm64, iosSimulatorArm64
|
| watchOS |
watchosArm32, watchosArm64, watchosSimulatorArm64
|
| tvOS |
tvosArm64, tvosSimulatorArm64
|
| Android Native |
androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86
|
Note: Some test tasks can make real Telegram API calls. Use ./gradlew assemble for build-only verification.
Start with the module READMEs:
MIT License