Telegram Bot API for Kotlin

Hi folks! I wanted to share with you the Telegram bot API for Kotlin/Multiplatform that I just released!

The APIs are generated from the official documentation by parsing its HTML. It uses Ktor client and Kotlinx.serialization so it’s 100% Kotlin powered! Here’s an example:

val client = TelegramBotApiClient("botToken")
val user: TelegramResponse<User> = client.getMe()
val user: TelegramResponse<List<Update>> = client.getUpdates()

For more details check out the repository in the link above!

There is also this other project of mine telegrambots-ktx which offer a Ktor-like APIs to create a polling bot. At the moment telegrambots-ktx does not uses the Telegram bot API for Kotlin/Multiplatform but I plan to switch the underlying implementation soon.

Hope it helps :slight_smile:

1 Like

Did you look into KotlinPoet or other code generation tools?

1 Like

Wow I was not aware of it! Thanks :slight_smile:

1 Like