{"id":13407096,"url":"https://github.com/vendelieu/telegram-bot","last_synced_at":"2026-03-02T04:07:57.898Z","repository":{"id":37301259,"uuid":"496567172","full_name":"vendelieu/telegram-bot","owner":"vendelieu","description":"Telegram Bot API wrapper with handy Kotlin DSL.","archived":false,"fork":false,"pushed_at":"2026-02-04T20:46:18.000Z","size":96278,"stargazers_count":242,"open_issues_count":5,"forks_count":18,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-05T08:28:20.858Z","etag":null,"topics":["bot","hacktoberfest","kotlin","telegram","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"https://vendelieu.github.io/telegram-bot/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vendelieu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://patreon.com/vendelieu","https://www.buymeacoffee.com/vendelieu"]}},"created_at":"2022-05-26T09:59:35.000Z","updated_at":"2026-02-02T15:40:56.000Z","dependencies_parsed_at":"2024-03-18T12:02:49.617Z","dependency_job_id":"935d2027-c781-44f7-b0e4-3f73dd1fbb64","html_url":"https://github.com/vendelieu/telegram-bot","commit_stats":null,"previous_names":[],"tags_count":120,"template":false,"template_full_name":null,"purl":"pkg:github/vendelieu/telegram-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendelieu%2Ftelegram-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendelieu%2Ftelegram-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendelieu%2Ftelegram-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendelieu%2Ftelegram-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vendelieu","download_url":"https://codeload.github.com/vendelieu/telegram-bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendelieu%2Ftelegram-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29443468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T10:51:12.367Z","status":"ssl_error","status_checked_at":"2026-02-14T10:50:52.088Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","hacktoberfest","kotlin","telegram","telegram-bot","telegram-bot-api"],"created_at":"2024-07-30T20:00:19.732Z","updated_at":"2026-03-02T04:07:57.891Z","avatar_url":"https://github.com/vendelieu.png","language":"Kotlin","readme":"![Telegram bot api library logo](https://user-images.githubusercontent.com/3987067/180802441-966bb058-919b-4e1c-82c1-2b210cc9a94e.png)\n\n# Telegram Bot\n\n[![Maven Central](https://img.shields.io/maven-central/v/eu.vendeli/telegram-bot?style=flat\u0026label=Maven\u0026logo=apache-maven)](https://search.maven.org/artifact/eu.vendeli/telegram-bot)\n[![Supported version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fvendelieu%2Ftelegram-bot%2Fraw%2Fmaster%2FbuildSrc%2Fsrc%2Fmain%2Fresources%2Fapi.json\u0026query=%24.version\u0026style=flat\u0026logo=telegram\u0026label=Telegram\u0026color=blue)](https://core.telegram.org/bots/api)\\\n[![KDocs](https://img.shields.io/static/v1?label=Dokka\u0026message=KDocs\u0026color=blue\u0026logo=kotlin)](https://vendelieu.github.io/telegram-bot/)\n[![codecov](https://codecov.io/gh/vendelieu/telegram-bot/branch/master/graph/badge.svg?token=xn5xo6fu6r)](https://codecov.io/gh/vendelieu/telegram-bot) \\\n[![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram\u0026message=Chat\u0026color=blue\u0026logo=telegram)](https://t.me/venny_tgbot)\n[![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram\u0026message=Channel\u0026color=blue\u0026logo=telegram)](https://t.me/kotlingram)\n\n[![Validate Gradle Wrapper](https://github.com/vendelieu/telegram-bot/actions/workflows/gradle-wrapper-validation.yml/badge.svg)](https://github.com/vendelieu/telegram-bot/actions/workflows/gradle-wrapper-validation.yml)\n\nTelegram Bot Api wrapper with a user-friendly interface.\n\n# Installation\n\nAdd the ksp plugin and library plugin to your Gradle build file.\n\nbuild.gradle.kts example:\n\n```gradle\nplugins {\n    // ...\n    id(\"com.google.devtools.ksp\") version \"2.3.4\"\n    id(\"eu.vendeli.telegram-bot\") version \"9.3.0\"\n}\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eManually\u003c/summary\u003e\nTo set up the project without using the plugin, you need to add a dependency and configure the ksp processor:\n\n```gradle\nplugins {\n    // ...\n    id(\"com.google.devtools.ksp\") version \"2.3.4\"\n}\n\ndependencies {\n    // ...\n    implementation(\"eu.vendeli:telegram-bot:9.3.0\")\n    ksp(\"eu.vendeli:ktnip:9.3.0\")\n}\n```\n\nFor multiplatform, you need to add the dependency to common sources and define ksp for the targets you need, see example\nin [native-example](https://github.com/ktgram/native-example/blob/master/build.gradle.kts).\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ci\u003eSnapshots\u003c/i\u003e\u003c/summary\u003e\n\n[![Snapshot version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frx.vendeli.eu%2Fsnap-ver%2Ftelegram-bot\u0026query=%24%5B0%5D.name\u0026logo=github\u0026label=SNAPSHOT\u0026link=https%3A%2F%2Fgithub.com%2Fvendelieu%3Ftab%3Dpackages%26repo_name%3Dtelegram-bot)](https://github.com/vendelieu?tab=packages\u0026repo_name=telegram-bot)\n\nTo install snapshot versions, add snapshot repository,\nif you're using plugin just use `addSnapshotRepo` parameter:\n\n```gradle\nktGram {\n    forceVersion = \"branch-xxxxxx~xxxxxx\"\n    addSnapshotRepo = true\n}\n```\n\nor manually add repository:\n\n```gradle\nrepositories {\n    mavenCentral()\n    // ...\n    maven(\"https://mvn.vendeli.eu/telegram-bot\") // this\n}\n```\n\nAnd add library dependency (with ksp processor) as described in `manually` section using the latest package version\nfrom [packages](https://github.com/vendelieu?tab=packages\u0026repo_name=telegram-bot) or from badge above.\n\n\u003c/details\u003e\n\n# Samples\n\n- [Template repository](https://github.com/vendelieu/telegram-bot_template) - draft example.\n- [FeedbackBot](https://github.com/ktgram/feedback-bot) - Use ready example of a feedback bot.\n- [Conversation](https://github.com/vendelieu/telegram-bot_template/tree/conversation) - An example of using `FSM` and\n  usage of `BotContext`.\n- [Echo](https://github.com/vendelieu/telegram-bot_template/tree/echo) - Echo bot :)\n- [Poll](https://github.com/vendelieu/telegram-bot_template/tree/poll) - An example of how to build a questionnaire bot.\n- [Ktor webhook starter](https://github.com/ktgram/webhook) - An example of using webhook mode\n  with Ktor.\n- [Spring Boot usage](https://github.com/vendelieu/telegram-bot_template/tree/spring-bot) - An example of using the bot\n  organically in the Spring ecosystem, using its built-in DI.\n- [GatekeeperBot](https://github.com/ktgram/gatekeeper) - Gatekeeper bot.\n- [Native example](https://github.com/ktgram/native-example) - An example of using a bot with Kotlin Native target.\n- [Web app](https://github.com/ktgram/webapp) - Example of a bot using Telegram Webapps.\n\n\u003c/details\u003e\n\n# Usage\n\n```kotlin\nsuspend fun main() {\n    val bot = TelegramBot(\"BOT_TOKEN\")\n\n    bot.handleUpdates()\n    // start long-polling listener\n}\n\n@CommandHandler([\"/start\"])\nsuspend fun start(user: User, bot: TelegramBot) {\n    sendMessage { \"Hello, what's your name?\" }.send(user, bot)\n    bot.inputListener[user] = \"conversation\"\n}\n\n@InputHandler([\"conversation\"])\n@Guard(UserPresentGuard::class)\nsuspend fun startConversation(update: ProcessedUpdate, user: User, bot: TelegramBot) {\n    sendMessage { \"Nice to meet you, ${update.text}\" }.send(user, bot)\n    sendMessage { \"What is your favorite food?\" }.send(user, bot)\n\n    bot.inputListener.set(user) { \"conversation-2step\" } // another way to set input\n}\n\n@CommonHandler.Regex(\"blue colo?r\")\nsuspend fun color(user: User, bot: TelegramBot) {\n    message { \"Oh you also like blue color?\" }.send(user, bot)\n}\n//..\n```\n\n*a little more detailed about handlers you can see\nin [handlers](https://github.com/vendelieu/telegram-bot/wiki/Handlers) article.*\n\nIt is also possible to set functionality through dsl:\n\n```kotlin\nfun main() = runBlocking {\n    val bot = TelegramBot(\"BOT_TOKEN\")\n\n    bot.setFunctionality {\n        onCommand(\"/start\") {\n            message { \"Hello, what's your name?\" }.send(user, bot)\n            bot.inputListener[user] = \"conversation\"\n        }\n        inputChain(\"conversation\") {\n            message { \"Nice to meet you, ${message.text}\" }.send(update.getUser(), bot)\n            message { \"What is your favorite food?\" }.send(update.getUser(), bot)\n        }.breakIf({ message.text == \"peanut butter\" }) { // chain break condition\n            message { \"Oh, too bad, I'm allergic to it.\" }.send(update.getUser(), bot)\n            // action that will be applied when match\n        }.andThen {\n            // next input point if break condition doesn't match\n        }\n    }\n    \n    bot.handleUpdates()\n}\n```\n\n### Configuration\n\nThe library has very flexible customization options, and there are different options to configure through external\nsources.\n\nYou can read more in a [Bot configuration](https://github.com/vendelieu/telegram-bot/wiki/Bot-configuration) article.\n\nAlso, you can check plugin\nconfiguration [options](https://vendelieu.github.io/telegram-bot/ktgram-gradle-plugin/eu.vendeli.ktgram.gradle/-kt-gram-ext/index.html).\n\n### Processing responses\n\nTo process over response or/and have more control over request flow\nuse [\n`sendReturning()`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.interfaces.action/-action/send-returning.html)\ninstead\nof [\n`send()`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.interfaces.action/-action/send.html)\nmethod,\nwhich\nreturns [\n`Response`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.types.component/-response/index.html):\n\n```kotlin\nmessage { \"test\" }.sendReturning(user, bot).onFailure {\n    println(\"code: ${it.errorCode} description: ${it.description}\")\n}\n```\n\nAll `sendReturning` methods returns\na [\n`Response`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.types.component/-response/index.html)\non which you can also use\nmethods [\n`getOrNull()`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.types.component/get-or-null.html)\n, [\n`isSuccess()`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.types.component/is-success.html)\n, [\n`onFailure()`](https://vendelieu.github.io/telegram-bot/telegram-bot/eu.vendeli.tgbot.types.component/on-failure.html)\n\n### Additional resources\n\n* There is a [wiki](https://github.com/vendelieu/telegram-bot/wiki) section that has helpful information.\n* [API reference](https://vendelieu.github.io/telegram-bot/)\n\n### Questions\n\nYou're always welcome in our [chat](https://t.me/venny_tgbot), feel free to ask.\n\n### For AI assistants\n\nAI coding assistants: see [AGENTS.md](AGENTS.md) for project context and conventions.\n\n## Acknowledgements\n\nA big thank you to everyone who has contributed to this project. Your support and feedback are invaluable.\n\nIf you find this library useful, please consider giving it a star. Your support helps us continue to improve\nand maintain this project.\n","funding_links":["https://patreon.com/vendelieu","https://www.buymeacoffee.com/vendelieu"],"categories":["Telegram Libraries","Bots","Libraries"],"sub_categories":["Kotlin","Bot Libs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvendelieu%2Ftelegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvendelieu%2Ftelegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvendelieu%2Ftelegram-bot/lists"}