{"id":16530854,"url":"https://github.com/hypernova7/tg-server","last_synced_at":"2025-08-22T12:37:25.035Z","repository":{"id":39874567,"uuid":"487158952","full_name":"hypernova7/tg-server","owner":"hypernova7","description":":rocket: Deploy your own Telegram Bot API","archived":false,"fork":false,"pushed_at":"2024-09-07T02:14:42.000Z","size":107,"stargazers_count":7,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-12T18:07:25.871Z","etag":null,"topics":["docker","heroku","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","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/hypernova7.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":"2022-04-30T02:03:48.000Z","updated_at":"2024-09-07T02:14:46.000Z","dependencies_parsed_at":"2023-09-24T05:30:09.593Z","dependency_job_id":"d3f33252-0bed-4bab-ab38-eee36b18ee18","html_url":"https://github.com/hypernova7/tg-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypernova7%2Ftg-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypernova7%2Ftg-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypernova7%2Ftg-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypernova7%2Ftg-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypernova7","download_url":"https://codeload.github.com/hypernova7/tg-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221813790,"owners_count":16884911,"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","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":["docker","heroku","telegram","telegram-bot"],"created_at":"2024-10-11T18:07:19.460Z","updated_at":"2024-10-28T09:47:01.287Z","avatar_url":"https://github.com/hypernova7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eDeploy your own \u003ca href=\"https://github.com/tdlib/telegram-bot-api\"\u003eTelegram Bot API\u003c/a\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eInspired on \u003ca href=\"https://github.com/aiogram/telegram-bot-api\"\u003eaiogram\u003c/a\u003e\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/hypernova7/tg-server/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://badge.deta.dev/hypernova7/tg-server/ci.yml?colorA=363a4f\u0026greenColor=a6e3a1\u0026redColor=f38ba8\u0026orangeColor=fab387\u0026otherColor=cdd6f4\u0026label=build\u0026logo=github\u0026style=for-the-badge\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hypernova7/tg-server/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/hypernova7/tg-server?colorA=363a4f\u0026colorB=fab387\u0026logo=github\u0026style=for-the-badge\" alt=\"Issues\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hypernova7/tg-server/contributors\"\u003e\u003cimg src=\"https://img.shields.io/github/contributors/hypernova7/tg-server?colorA=363a4f\u0026colorB=cba6f7\u0026logo=github\u0026style=for-the-badge\" alt=\"Contributors\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hypernova7/tg-server/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/hypernova7/tg-server?colorA=363a4f\u0026colorB=f5e0dc\u0026logo=github\u0026style=for-the-badge\" alt=\"Stars\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://hub.docker.com/r/tgserver/tgserver\"\u003e\u003cimg src=\"https://img.shields.io/docker/v/tgserver/tgserver?colorA=363a4f\u0026colorB=cdd6f4\u0026logo=docker\u0026logoColor=fff\u0026sort=semver\u0026style=for-the-badge\" alt=\"Docker Image Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/tgserver/tgserver\"\u003e\u003cimg src=\"https://img.shields.io/docker/image-size/tgserver/tgserver?colorA=363a4f\u0026colorB=94e2d5\u0026label=size\u0026logo=docker\u0026logoColor=fff\u0026sort=semver\u0026style=for-the-badge\" alt=\"Dcoker Image Size\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/tgserver/tgserver\"\u003e\u003cimg src=\"https://img.shields.io/docker/pulls/tgserver/tgserver?colorA=363a4f\u0026colorB=b4befe\u0026label=pulls\u0026logo=docker\u0026logoColor=fff\u0026sort=semver\u0026style=for-the-badge\" alt=\"Docker Image Pulls\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/tgserver/tgserver\"\u003e\u003cimg src=\"https://img.shields.io/docker/stars/tgserver/tgserver?colorA=363a4f\u0026colorB=f9e2af\u0026label=stars\u0026logo=docker\u0026logoColor=fff\u0026sort=semver\u0026style=for-the-badge\" alt=\"Docker Image Stars\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n----\n\n## :sparkles: Features\n\n- Zero config\n- Restricted mode (`Only your bots will be able to use your bot API`)\n- Easy build of [telegram-bot-api](https://github.com/tdlib/telegram-bot-api)\n- Continuous Deployment with Github Actions\n- Increase bot API [limits](https://core.telegram.org/bots/api#using-a-local-bot-api-server)\n- Your own API endpoint(`https://yourdomain.com/bot\u003ctoken\u003e/getMe`)\n- Deploy your bot API to [Heroku](https://heroku.com) or [fly.io](https://fly.io)\n\n## :point_down: Steps\n\n\u003e [!IMPORTANT]\n\u003e Need to install [Docker Engine](https://docs.docker.com/engine/install/), [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) or [fly.io CLI](https://fly.io/docs/hands-on/install-flyctl/).\n\n\n\u003e [!NOTE]\n\u003e Before deploying, please read [this](https://github.com/tdlib/telegram-bot-api/#moving-a-bot-from-one-local-server-to-another)\n\n\n### Clone this repository\n\n```bash\ngit clone https://github.com/hypernova7/tg-server.git\ncd tg-server\ngit submodule update --init --recursive\n```\n\n\n### Create a Heroku app\n\n```bash\n# Sign In on heroku\nheroku auth:login\nheroku apps:create \u003cheroku-app-name\u003e\n```\n\n**or**\n\n### Create a fly.io app\n```bash\nflyctl auth signup\nflyctl auth login\nflyctl launch # This command will generate a fly.toml file (Please see this: https://fly.io/docs/reference/configuration/#fly-toml-line-by-line)\n```\n\n\n### Add these environment vars to your app\n\n#### Using Heroku CLI\n\n```bash\n# List your bot-ids seprate by commas so that\n# only your bots can use the API `\u003cbot-id\u003e:AABBCdfghijklmopqrstuvwxyz1234567890`\nheroku config:add ALLOWED_BOT_IDS=\u003cbot-id\u003e,\u003cbot-id\u003e,\u003cbot-id\u003e -a \u003cheroku-app-name\u003e\nheroku config:add TELEGRAM_API_ID=\u003capi-id\u003e TELEGRAM_API_HASH=\u003capi-hash\u003e -a \u003cheroku-app-name\u003e\n# NOTE: To pass extra arguments to telegram-bot-api, you can add the environment var EXTRA_ARGS\nheroku config:add EXTRA_ARGS=\"--proxy=\u003cproxy\u003e --local\" -a \u003cheroku-app-name\u003e\n```\n\n#### Using fly.io CLI\n\n```bash\n# List your bot-ids seprate by commas so that\n# only your bots can use the API `\u003cbot-id\u003e:AABBCdfghijklmopqrstuvwxyz1234567890`\nflyctl secrets set ALLOWED_BOT_IDS=\u003cbot-id\u003e,\u003cbot-id\u003e,\u003cbot-id\u003e -a \u003cheroku-app-name\u003e\nflyctl secrets set TELEGRAM_API_ID=\u003capi-id\u003e TELEGRAM_API_HASH=\u003capi-hash\u003e -a \u003cheroku-app-name\u003e\n# NOTE: To pass extra arguments to telegram-bot-api, you can add the environment var EXTRA_ARGS\nflyctl secrets set EXTRA_ARGS=\"--proxy=\u003cproxy\u003e --local\" -a \u003cheroku-app-name\u003e\n```\n\n\u003e [!TIP]\n\u003e Optionally and if required, you can set the SWAP_SIZE environment variable to setup swap, by default is disabled. Example: `SWAP_SIZE=51200K` (`51200K` = `50MB`) or `SWAP_SIZE=200M` (`200M` = `200MB`) or `SWAP_SIZE=4G` (`4GB` = `4GB`) or `SWAP_SIZE=8589934592` (`8589934592` = `8GB` in bytes)\n\n____\n\n\u003e [!TIP]\n\u003e Optionally can add full-tokens to ALLOWED_BOT_IDS, if you want to avoid exposing your token when sharing links to your bot files. For example: `ALLOWED_BOT_IDS=\u003cbot-id\u003e,\u003cbot-id\u003e:\u003cbot-token\u003e,\u003cbot-id\u003e`\n\n### Deploy to Heroku\n\n```bash\n# Sign In into Container Registry\nheroku container:login\n# Push and deploy Container\nheroku container:push web -a \u003cheroku-app-name\u003e\nheroku container:release web -a \u003cheroku-app-name\u003e\n```\n\n### Deploy to fly.io\n\n```bash\nflyctl deploy\n# Run the following commands only once\n# Since it allocates IP's as many as it runs\n# Please see this https://fly.io/docs/flyctl/ips/#usage\nflyctl ips allocate-v4\nflyctl ips allocate-v6\n```\n\n____\n\n## Environments\n\n```\nPORT=8080                               # (required) Default port\nTELEGRAM_API_ID=\u003capi-id\u003e                # (required) API ID\nTELEGRAM_API_HASH=\u003capi-hash\u003e            # (required) API HASH\nALLOWED_BOT_IDS=\u003cyour-bot-tokens\u003e       # (required) List of your bot tokens separated by comma\nSTATS_PATH_NAME=\u003cmy-secret-stats-path\u003e  # (optional) Secret path for bot API stats (Stats contain bot tokens)\nEXTRA_ARGS=--local                      # (optional) Pass extra arguments to telegram-bot-api command\n```\n\n----\n\n\n\n## :zap: Continuous Deployment with Github Actions.\n\n\n### Setup secrets\n\nThis repository already provides pre-configured Workflows for Heroku and fly.io. You only need to setup the following secrets on `Settings \u003e Secrets \u003e Actions`.\n\n\n\u003e [!CAUTION]\n\u003e Workflows are scheduled to run every day at 12am UTC, and auto-deploy on any updates to the telegram-bot-api submodule. _Optionally, can add `FORCE_DEPLOY=true` to your repository secrets or `_deploy_` to your specific commit message to force the deployment. **But remember, these Workflows runs everyday**_.\n\n\u003e [!IMPORTANT]\n\u003e For private repositories, please enable read and write permissions in `Settings \u003e Actions \u003e General \u003e Workflows permissions` for auto commits, to keep telegram-bot-api submodules updated if you want.\n\n\n#### For heroku:\n\n```\nHEROKU_API_KEY=\u003cheroku-api-key\u003e\nHEROKU_APP_NAME=\u003cheroku-app-name\u003e\n```\n\n#### For fly.io:\n\n```\nFLY_API_TOKEN=\u003cyour-fly-api-token\u003e\n```\n\n## :sparkling_heart: Special thanks to\n\n[![@sayyid5416](https://github.com/sayyid5416.png?size=50)](https://github.com/sayyid5416)\n\n## :bug: Any issue?\n\n### Please [open a new issue](https://github.com/hypernova7/tg-server/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypernova7%2Ftg-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypernova7%2Ftg-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypernova7%2Ftg-server/lists"}