{"id":26920810,"url":"https://github.com/jon-edward/py-telegram-notifier","last_synced_at":"2025-04-01T22:48:38.991Z","repository":{"id":62583993,"uuid":"324923625","full_name":"jon-edward/py-telegram-notifier","owner":"jon-edward","description":"A tool using the Telegram Bot API for sending messages to a Telegram chat by a context manager, function call, or CLI.","archived":false,"fork":false,"pushed_at":"2024-12-18T02:50:00.000Z","size":79,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T22:04:37.730Z","etag":null,"topics":["bot","python","telegram-chat"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/py-telegram-notifier/","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/jon-edward.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":"2020-12-28T05:50:34.000Z","updated_at":"2024-12-19T23:37:01.000Z","dependencies_parsed_at":"2024-12-17T03:44:57.935Z","dependency_job_id":null,"html_url":"https://github.com/jon-edward/py-telegram-notifier","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/jon-edward%2Fpy-telegram-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jon-edward%2Fpy-telegram-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jon-edward%2Fpy-telegram-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jon-edward%2Fpy-telegram-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jon-edward","download_url":"https://codeload.github.com/jon-edward/py-telegram-notifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246724801,"owners_count":20823544,"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":["bot","python","telegram-chat"],"created_at":"2025-04-01T22:48:37.547Z","updated_at":"2025-04-01T22:48:38.981Z","avatar_url":"https://github.com/jon-edward.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-telegram-notifier\n\n[![PyPI Downloads](https://static.pepy.tech/badge/py-telegram-notifier)](https://pepy.tech/projects/py-telegram-notifier)\n\nA tool using the Telegram Bot API for sending messages to a Telegram chat by\na context manager, function call, or CLI.\n\n## Purpose\n\nThe purpose of this module is to provide a simple way to send messages to a Telegram chat using the Telegram Bot API. \nThis is especially useful for long-running automation scripts, where the user may not be around to check the logs. \n\nThis is not a wrapper for the Telegram Bot API, but rather a utility for notifying users of enter/exit events with a \ncontext manager.\n\n## Installation\n\n    pip install py-telegram-notifier\n\n## Requirements\n\nIn order for the module to function, you must supply it with a bot\n[token](https://core.telegram.org/bots/api#authorizing-your-bot) and a\n[chat id](https://core.telegram.org/bots/api#getupdates). Full instructions on creating a bot\ncan be found [here](https://core.telegram.org/bots#3-how-do-i-create-a-bot).\n\n## Usage \n\nFirstly, set up the config for your Notifier. Bot token and chat id are required and must be set as environment \nvariables (`TELEGRAM_TOKEN` and `TELEGRAM_CHAT_ID`, respectively). It's strongly recommended to use a git-ignored `.env` \nfile for this purpose, an example file can be found [here](https://github.com/jon-edward/py-telegram-notifier/blob/main/.env.example).\n\n### As a context manager\n\n```python\nimport dotenv\nfrom telegram_notifier import Notifier\n\n# Load environment variables\ndotenv.load_dotenv()\n\nwith Notifier(\"Test case\") as notifier:\n    # Enter message fired\n    notifier.send_message(\"This is a progress update\")\n# Exit message fired\n```\n\n### As a function call\n\n```python\nimport dotenv\nfrom telegram_notifier import Notifier\n\n# Load environment variables\ndotenv.load_dotenv()\n\nnotifier = Notifier()\nnotifier.send_message(\"Test message\")\n# Does not need to be used as a context manager\n```\n\n### As a CLI\n\n```bash\nTELEGRAM_TOKEN=0000000000 TELEGRAM_CHAT_ID=0000000000 python -m telegram_notifier \"Test message\"\n```\n\n## Notes\n\nThis module treats all messages as `MarkdownV2` by default, and escapes known reserved characters. See [`Notifier.send_message()`](https://github.com/jon-edward/py-telegram-notifier/blob/main/telegram_notifier/notifier.py) for more information.\n\n\n## Disclaimer\n\nThe author of this software is not affiliated, associated, authorized, endorsed by, or in any\nway officially connected with Telegram or any of its affiliates and is independently owned and\ncreated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjon-edward%2Fpy-telegram-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjon-edward%2Fpy-telegram-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjon-edward%2Fpy-telegram-notifier/lists"}