{"id":24277634,"url":"https://github.com/nikdon/telepooz","last_synced_at":"2025-09-12T13:41:57.292Z","repository":{"id":80099556,"uuid":"60933010","full_name":"nikdon/telepooz","owner":"nikdon","description":"Functional Telegram Bot API wrapper for Scala on top of akka, circe, cats, and shapeless","archived":false,"fork":false,"pushed_at":"2017-10-05T09:25:47.000Z","size":426,"stargazers_count":28,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T21:28:16.671Z","etag":null,"topics":["akka","akka-streams","bot","cats","circe","free-monad","functional-programming","scala","telegram-api"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/nikdon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-12T00:01:07.000Z","updated_at":"2024-05-19T12:25:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"358fb4fa-d0a2-45a3-aa85-ec6741363690","html_url":"https://github.com/nikdon/telepooz","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/nikdon/telepooz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikdon%2Ftelepooz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikdon%2Ftelepooz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikdon%2Ftelepooz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikdon%2Ftelepooz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikdon","download_url":"https://codeload.github.com/nikdon/telepooz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikdon%2Ftelepooz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274822946,"owners_count":25356624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["akka","akka-streams","bot","cats","circe","free-monad","functional-programming","scala","telegram-api"],"created_at":"2025-01-15T23:58:28.167Z","updated_at":"2025-09-12T13:41:57.283Z","avatar_url":"https://github.com/nikdon.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# telepooz\n[![Build Status](https://travis-ci.org/nikdon/telepooz.svg?branch=master)](https://travis-ci.org/nikdon/telepooz)\n[![codecov](https://codecov.io/gh/nikdon/telepooz/branch/master/graph/badge.svg)](https://codecov.io/gh/nikdon/telepooz)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/42eedce6ec0d4c03bab471f610020aec)](https://www.codacy.com/app/nd/telepooz?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=nikdon/telepooz\u0026amp;utm_campaign=Badge_Grade)\n[![](https://jitpack.io/v/nikdon/telepooz.svg)](https://jitpack.io/#nikdon/telepooz)\n[![Telegram API](https://img.shields.io/badge/Telegram%20API-May%2018%2C%202017-green.svg)](https://core.telegram.org/bots/api#recent-changes)\n\n**telepooz** is a scala wrapper for **[Telegram Bot API][telegram-api]**.\n\n## Table of contents\n\n1. [Quick start](#quick-start)\n2. [Why?](#why)\n3. [Usage](#usage)\n4. [Contributors and participation](#contribution-and-participation)\n5. [License](#license)\n\n## Quick start\n\ntelepooz built for **scala-2.12**. To use it add following to build file:\n\n```scala\nresolvers += \"jitpack\" at \"https://jitpack.io\"\nlibraryDependencies += \"com.github.nikdon\" % \"telepooz\" % \"0.5.6\"\n```\n\nAnd configure telepooz via the `reference.conf` or `aplication.conf` or by, for ex., env variables:\n \n```scala\ntelegram {\n  host = \"api.telegram.org\"\n  token = \"123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11\"\n  token = ${?telegram_token}\n\n  polling {\n    interval = 1000 // in milliseconds\n    interval = ${?telegram_update_interval}\n    limit = 100\n    limit = ${?telegram_update_limit}\n    parallelism = 2\n    parallelism = ${?telegram_polling_parallelism}\n  }\n\n  reactor {\n    parallelism = 2\n    parallelism = ${?telegram_reactor_parallelism}\n  }\n} \n```\n\n## Why?\n\nThe only one reason to write was curiosity. Telepooz written on top of **[Akka Streams][akka]** with intention to \nmaximize using of functional abstractions provided by **[cats][cats]**. For example, API \nrequests are composable:\n\n```scala\nimport com.github.nikdon.telepooz.api._\nimport com.github.nikdon.telepooz.model.methods\nimport com.github.nikdon.telepooz.engine.ApiRequestExecutor\n\nval apiRequestExecutor = new ApiRequestExecutor() {}\n\nval req = for {\n  a ← methods.GetMe\n  b ← methods.SendMessage(\"abc\", a.result.fold(\"empty\")(_.first_name))\n} yield b\n\nval res = req.foldMap(apiRequestExecutor)\n\nwhenReady(res){ m ⇒\n  m shouldBe a [Response[_]]\n  m.ok shouldEqual true\n  m.result shouldBe defined\n  m.result.value shouldBe a [model.Message]\n}\n```\n\ntelepooz is far from completion, here is a list of some desired features to implemented in future:\n\n- File uploading via multipart/form-data\n\n## Usage\n\nIn general, bot consists of three parts: `ApiRequestExecutor`, `Polling` or `WebHook` and `Reactor`. \n`ApiRequestExecutor` creates requests to the telegram bot API endpoint. `Polling` asks telegram server about new \nupdates via `ApiRequestExecutor` and send them to the `Reactor`. `WebHook` receives new updates via incoming requests \nfrom telegram. Finally `Reactor` reacts on an input stream of incoming updates from the `Polling` or `WebHook`. \nToplevel `Telepooz` trait provides a method `instance` that is a \n`ReaderT[Future, (ApiRequestExecutor, Polling, Reactor), Done]`. To start a bot provide a valid input \nfor `instance.run(...)` with all three components described above.\n\n### Polling\n\n```scala\n/** Just an example of how the bot might look like */\nimport com.github.nikdon.telepooz.engine._\n\nobject NaiveBot extends Telepooz with App {\n\n  implicit val are = new ApiRequestExecutor {}\n  val poller       = new Polling\n  val reactor      = new Reactor {\n    val reactions = CommandBasedReactions()\n      .on(\"/start\")(implicit message ⇒ args ⇒ reply(\"You are started!\"))\n      .on(\"/test\")(implicit message ⇒ args ⇒ reply(\"Hi there!\"))\n  }\n\n  instance.run((are, poller, reactor))\n}\n```\n\n### Webhook\n\n```scala\nimport akka.stream.ActorMaterializer\nimport com.github.nikdon.telepooz.engine._\n\nobject WebhookBot extends Telepooz with App {\n\n  implicit val asm = ActorMaterializer()\n  implicit val are = new MockApiRequestExecutor(1) {}\n  val poller       = new Webhook(endpoint = \"test\", interface = \"127.0.0.1\")\n  val reactor = new Reactor {\n    val reactions = CommandBasedReactions()\n      .on(\"/start\")(implicit message ⇒\n        args ⇒ {\n          println(s\"You are started! $args\")\n          reply(\"You are started!\")\n      })\n      .on(\"/test\")(implicit message ⇒\n        args ⇒ {\n          println(s\"You are tested! $args\")\n          reply(\"You are tested!\")\n      })\n  }\n\n  webhook.run((poller, reactor))\n}\n```\n\n## Contributors and participation\n\n* [Nikolay Donets](https://github.com/nikdon)\n\n**telepooz** support the [Typelevel][typelevel] [code of conduct][code-of-conduct], \ncontributions are always welcome. Good ways to contribute include:\n\n * Raising bugs and feature requests,\n * Fixing bugs and developing new features (I will attempt to merge in pull requests ASAP),\n * Improving the performance of **telepooz**,\n * Provide examples of bots.\n\n## License\n\n**telepooz** is licensed under the **[Apache License, Version 2.0][apache]** (the \"License\"); \nyou may not use this software except in compliance with the License.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n[akka]: https://github.com/akka/akka\n[apache]: http://www.apache.org/licenses/LICENSE-2.0\n[cats]: https://github.com/typelevel/cats\n[code-of-conduct]: http://typelevel.org/conduct.html\n[shapeless]: https://github.com/milessabin/shapeless\n[telegram-api]: https://core.telegram.org/bots/api\n[typelevel]: http://typelevel.org/\n[webhooks]: https://core.telegram.org/bots/api#getting-updates\n\n\n[![Analytics](https://ga-beacon.appspot.com/UA-91956314-1/telepooz/readme?pixel)](https://github.com/igrigorik/ga-beacon)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikdon%2Ftelepooz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikdon%2Ftelepooz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikdon%2Ftelepooz/lists"}