{"id":25791026,"url":"https://github.com/niki4/py_webapi_telegram_bot","last_synced_at":"2026-06-08T01:32:31.309Z","repository":{"id":133496562,"uuid":"133129763","full_name":"niki4/py_webapi_telegram_bot","owner":"niki4","description":"Backend for Telegram bot that can do CRUD on your Web API (REST)","archived":false,"fork":false,"pushed_at":"2018-05-15T10:34:52.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T15:47:03.811Z","etag":null,"topics":["python-telegram-bot"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niki4.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-05-12T08:54:58.000Z","updated_at":"2023-11-02T00:13:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"7034c20f-3321-4ac9-ab5a-91fc49d84bba","html_url":"https://github.com/niki4/py_webapi_telegram_bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/niki4/py_webapi_telegram_bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niki4%2Fpy_webapi_telegram_bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niki4%2Fpy_webapi_telegram_bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niki4%2Fpy_webapi_telegram_bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niki4%2Fpy_webapi_telegram_bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niki4","download_url":"https://codeload.github.com/niki4/py_webapi_telegram_bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niki4%2Fpy_webapi_telegram_bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34044919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"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":["python-telegram-bot"],"created_at":"2025-02-27T12:40:58.415Z","updated_at":"2026-06-08T01:32:31.305Z","avatar_url":"https://github.com/niki4.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram Bot for WebAPI\nTelegram bot that can run CRUD operations on your Web API.\n\nIt has built-in abilities to restrict performing _unsafe_ operations\n(POST/PUT/DELETE methods) only to bot admin, allowing GET for all users.\nAdditionally it supports\nWeb API that requires authentication.\n\nSounds interesting? Give a try it with the following Web API's:\n* [py_webapi_django_example](https://github.com/niki4/py_webapi_django_example) - without authentication.\n* [py_webapi_django_elearning_example](https://github.com/niki4/py_webapi_django_elearning_example) - with authentication.\n\n## Installation:\nFirst of all, using your command line clone the repo with bot backend, then create and activate\nvirtual environment:\n```bash\ngit clone https://github.com/niki4/py_webapi_telegram_bot\ncd py_webapi_telegram_bot\n\npython3 -m venv ./venv\nsource venv/bin/activate\n```\nInstall all dependencies with pip:\n```bash\npip install -r requirements.txt\n```\n\nNow login to your regular Telegram client and open chat with [@BotFather](https://t.me/BotFather).\nThis is a bot that helps to register and manage another bots.\nThus, register a new bot sending following command to BotFather:\n```\n/newbot\n```\nOnce your bot registered in Telegram, BotFather will provide you a token\nto access the HTTP API. Copy it.\n\nNow it's time to set up some settings. Open `settings.py` and paste\npreviously copied Telegram API token as value for `BOT_TOKEN`.\nYet replace `ADMIN_USER` with your own Telegram username\n(keep the @ symbol at the beginning).\n\nIf you choosed to run the bot with Web API _without_ authentication\n(like [py_webapi_django_example](https://github.com/niki4/py_webapi_django_example)),\nyou're all set. Make sure you have the Web API set up and running,\nthen go on to Run section.\n\nBut if your Web API requires authentication, e.g.\n[py_webapi_django_elearning_example](https://github.com/niki4/py_webapi_django_elearning_example),\nyou additionally have to set credentials for that Web API in system variables.\nFor example:\n```bash\nexport API_LOGIN=admin\nexport API_PASS=adminpassword\n```\n\u003e For Windows users:\nuse __set__ instead of __export__ to create system variable from command line.\n\n## Run:\nSimply run bot.py script:\n```bash\npython bot.py\n```\nNow open conversation with your bot in Telegram client.\n\nSend `/start` command to retrieve list of available actions:\n```bash\nWelcome to the WebAPI Bot!\n\nMake sure you have your backend API up and running.\n\nHere is the list of available commands:\n/start - show this welcome screen\n/show - get variable number of items in given category (if no id provided, will show all items in category)\n/create - to create new item, e.g. '/create products title=IPhone price_rub=10'\n/update - to change item info, e.g. '/update products 1 price_rub=999'\n/delete - to remove item, e.g. '/delete products 1'\n\nNote that only bot admin is allowed to run /create, /update and /delete commands.\n```\n\nFirst param after command should always be desired Web API endpoint (category).\nFor example, if we have browsable Web API address http://127.0.0.1:8000/tags/\nto list all the tags, we could send following command to our telegram bot\nto get the same list:\n```bash\n/show tags\n```\n\nTo get the info _only for particular item_, specify its id (pk) number\nas a second param after command. Following is an equivalent to GET\nrequest to Web API address http://127.0.0.1:8000/tags/3/:\n```bash\n/show tags 3\n```\n\nWhen creating (=POST) and updating (=PUT) data with bot, you can provide\narbitrary number of fields that item requires in '_key=value_' format\n(note that there no spaces around equality sign!). For example:\n```bash\n/create webinars title=Python3 description=Advanced scheduled_time=2018-05-12T20:21:03Z\n```\nIf success, bot will response with the following message:\n```\nCreated.\n{\"id\":2,\"title\":\"Python3\",\"description\":\"Advanced\",\"scheduled_time\":\"2018-05-12T20:21:03Z\"}\n```\n\u003e Use __only spaces__ to separate params in commands for bot.\n\n## Docs:\nThis project created with usage of\n[python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)\nframework and utilizes [Telegram Bot API](https://core.telegram.org/bots/api).\n\n Kindly check these projects docs to learn how it works if you're about\n to amend this example project on your own taste.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniki4%2Fpy_webapi_telegram_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniki4%2Fpy_webapi_telegram_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniki4%2Fpy_webapi_telegram_bot/lists"}